commit 1313d727cf0a571e1c18c0129813cec9b12814c0 Author: adrianaepure Date: Thu Jun 8 09:36:06 2023 +0300 Add LND test wallet diff --git a/Lndmobile.framework/Headers b/Lndmobile.framework/Headers new file mode 120000 index 0000000..a177d2a --- /dev/null +++ b/Lndmobile.framework/Headers @@ -0,0 +1 @@ +Versions/Current/Headers \ No newline at end of file diff --git a/Lndmobile.framework/Lndmobile b/Lndmobile.framework/Lndmobile new file mode 120000 index 0000000..15d3b72 --- /dev/null +++ b/Lndmobile.framework/Lndmobile @@ -0,0 +1 @@ +Versions/Current/Lndmobile \ No newline at end of file diff --git a/Lndmobile.framework/Modules b/Lndmobile.framework/Modules new file mode 120000 index 0000000..5736f31 --- /dev/null +++ b/Lndmobile.framework/Modules @@ -0,0 +1 @@ +Versions/Current/Modules \ No newline at end of file diff --git a/Lndmobile.framework/Resources b/Lndmobile.framework/Resources new file mode 120000 index 0000000..953ee36 --- /dev/null +++ b/Lndmobile.framework/Resources @@ -0,0 +1 @@ +Versions/Current/Resources \ No newline at end of file diff --git a/Lndmobile.framework/Versions/A/Headers/Lndmobile.h b/Lndmobile.framework/Versions/A/Headers/Lndmobile.h new file mode 100644 index 0000000..a0dd72e --- /dev/null +++ b/Lndmobile.framework/Versions/A/Headers/Lndmobile.h @@ -0,0 +1,13 @@ + +// Objective-C API for talking to the following Go packages +// +// github.com/lightningnetwork/lnd/mobile +// +// File is generated by gomobile bind. Do not edit. +#ifndef __Lndmobile_FRAMEWORK_H__ +#define __Lndmobile_FRAMEWORK_H__ + +#include "Lndmobile.objc.h" +#include "Universe.objc.h" + +#endif diff --git a/Lndmobile.framework/Versions/A/Headers/Lndmobile.objc.h b/Lndmobile.framework/Versions/A/Headers/Lndmobile.objc.h new file mode 100644 index 0000000..44672ad --- /dev/null +++ b/Lndmobile.framework/Versions/A/Headers/Lndmobile.objc.h @@ -0,0 +1,839 @@ +// Objective-C API for talking to github.com/lightningnetwork/lnd/mobile Go package. +// gobind -lang=objc github.com/lightningnetwork/lnd/mobile +// +// File is generated by gobind. Do not edit. + +#ifndef __Lndmobile_H__ +#define __Lndmobile_H__ + +@import Foundation; +#include "ref.h" +#include "Universe.objc.h" + + +@protocol LndmobileCallback; +@class LndmobileCallback; +@protocol LndmobileRecvStream; +@class LndmobileRecvStream; +@protocol LndmobileSendStream; +@class LndmobileSendStream; + +@protocol LndmobileCallback +- (void)onError:(NSError* _Nullable)p0; +- (void)onResponse:(NSData* _Nullable)p0; +@end + +@protocol LndmobileRecvStream +- (void)onError:(NSError* _Nullable)p0; +- (void)onResponse:(NSData* _Nullable)p0; +@end + +@protocol LndmobileSendStream +- (BOOL)send:(NSData* _Nullable)p0 error:(NSError* _Nullable* _Nullable)error; +- (BOOL)stop:(NSError* _Nullable* _Nullable)error; +@end + +/** + * AbandonChannel removes all channel state from the database except for a +close summary. This method can be used to get rid of permanently unusable +channels due to bugs fixed in newer versions of lnd. This method can also be +used to remove externally funded channels where the funding transaction was +never broadcast. Only available for non-externally funded channels in dev +build. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileAbandonChannel(NSData* _Nullable msg, id _Nullable callback); + +/** + * AddInvoice attempts to add a new invoice to the invoice database. Any +duplicated invoices are rejected, therefore all invoices *must* have a +unique payment preimage. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileAddInvoice(NSData* _Nullable msg, id _Nullable callback); + +/** + * BakeMacaroon allows the creation of a new macaroon with custom read and +write permissions. No first-party caveats are added since this can be done +offline. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileBakeMacaroon(NSData* _Nullable msg, id _Nullable callback); + +/** + * ChangePassword changes the password of the encrypted wallet. This will +automatically unlock the wallet database if successful. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileChangePassword(NSData* _Nullable msg, id _Nullable callback); + +/** + * ChannelAcceptor dispatches a bi-directional streaming RPC in which +OpenChannel requests are sent to the client and the client responds with +a boolean that tells LND whether or not to accept the channel. This allows +node operators to specify their own criteria for accepting inbound channels +through a single persistent connection. + +NOTE: This method produces a stream of responses, and the receive stream can +be called zero or more times. After EOF error is returned, no more responses +will be produced. The send stream can accept zero or more requests before it +is closed. + */ +FOUNDATION_EXPORT id _Nullable LndmobileChannelAcceptor(id _Nullable rStream, NSError* _Nullable* _Nullable error); + +/** + * ChannelBalance returns the total funds available across all open channels +in satoshis. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileChannelBalance(NSData* _Nullable msg, id _Nullable callback); + +/** + * CloseChannel attempts to close an active channel identified by its channel +outpoint (ChannelPoint). The actions of this method can additionally be +augmented to attempt a force close after a timeout period in the case of an +inactive peer. If a non-force close (cooperative closure) is requested, +then the user can specify either a target number of blocks until the +closure transaction is confirmed, or a manual fee rate. If neither are +specified, then a default lax, block confirmation target is used. + +NOTE: This method produces a stream of responses, and the receive stream can +be called zero or more times. After EOF error is returned, no more responses +will be produced. + */ +FOUNDATION_EXPORT void LndmobileCloseChannel(NSData* _Nullable msg, id _Nullable rStream); + +/** + * ClosedChannels returns a description of all the closed channels that +this node was a participant in. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileClosedChannels(NSData* _Nullable msg, id _Nullable callback); + +/** + * ConnectPeer attempts to establish a connection to a remote peer. This is at +the networking level, and is used for communication between nodes. This is +distinct from establishing a channel with a peer. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileConnectPeer(NSData* _Nullable msg, id _Nullable callback); + +/** + * DebugLevel allows a caller to programmatically set the logging verbosity of +lnd. The logging can be targeted according to a coarse daemon-wide logging +level, or in a granular fashion to specify the logging for a target +sub-system. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileDebugLevel(NSData* _Nullable msg, id _Nullable callback); + +/** + * DecodePayReq takes an encoded payment request string and attempts to decode +it, returning a full description of the conditions encoded within the +payment request. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileDecodePayReq(NSData* _Nullable msg, id _Nullable callback); + +/** + * DeleteAllPayments deletes all outgoing payments from DB. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileDeleteAllPayments(NSData* _Nullable msg, id _Nullable callback); + +/** + * DescribeGraph returns a description of the latest graph state from the +point of view of the node. The graph information is partitioned into two +components: all the nodes/vertexes, and all the edges that connect the +vertexes themselves. As this is a directed graph, the edges also contain +the node directional specific routing policy which includes: the time lock +delta, fee information, etc. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileDescribeGraph(NSData* _Nullable msg, id _Nullable callback); + +/** + * DisconnectPeer attempts to disconnect one peer from another identified by a +given pubKey. In the case that we currently have a pending or active channel +with the target peer, then this action will be not be allowed. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileDisconnectPeer(NSData* _Nullable msg, id _Nullable callback); + +/** + * EstimateFee asks the chain backend to estimate the fee rate and total fees +for a transaction that pays to multiple specified outputs. + +When using REST, the `AddrToAmount` map type can be set by appending +`&AddrToAmount[
]=` to the URL. Unfortunately this +map type doesn't appear in the REST API documentation because of a bug in +the grpc-gateway library. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileEstimateFee(NSData* _Nullable msg, id _Nullable callback); + +/** + * ExportAllChannelBackups returns static channel backups for all existing +channels known to lnd. A set of regular singular static channel backups for +each channel are returned. Additionally, a multi-channel backup is returned +as well, which contains a single encrypted blob containing the backups of +each channel. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileExportAllChannelBackups(NSData* _Nullable msg, id _Nullable callback); + +/** + * ExportChannelBackup attempts to return an encrypted static channel backup +for the target channel identified by it channel point. The backup is +encrypted with a key generated from the aezeed seed of the user. The +returned backup can either be restored using the RestoreChannelBackup +method once lnd is running, or via the InitWallet and UnlockWallet methods +from the WalletUnlocker service. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileExportChannelBackup(NSData* _Nullable msg, id _Nullable callback); + +/** + * FeeReport allows the caller to obtain a report detailing the current fee +schedule enforced by the node globally for each channel. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileFeeReport(NSData* _Nullable msg, id _Nullable callback); + +/** + * ForwardingHistory allows the caller to query the htlcswitch for a record of +all HTLCs forwarded within the target time range, and integer offset +within that time range. If no time-range is specified, then the first chunk +of the past 24 hrs of forwarding history are returned. + +A list of forwarding events are returned. The size of each forwarding event +is 40 bytes, and the max message size able to be returned in gRPC is 4 MiB. +As a result each message can only contain 50k entries. Each response has +the index offset of the last entry. The index offset can be provided to the +request to allow the caller to skip a series of records. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileForwardingHistory(NSData* _Nullable msg, id _Nullable callback); + +/** + * FundingStateStep is an advanced funding related call that allows the caller +to either execute some preparatory steps for a funding workflow, or +manually progress a funding workflow. The primary way a funding flow is +identified is via its pending channel ID. As an example, this method can be +used to specify that we're expecting a funding flow for a particular +pending channel ID, for which we need to use specific parameters. +Alternatively, this can be used to interactively drive PSBT signing for +funding for partially complete funding transactions. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileFundingStateStep(NSData* _Nullable msg, id _Nullable callback); + +/** + * GenSeed is the first method that should be used to instantiate a new lnd +instance. This method allows a caller to generate a new aezeed cipher seed +given an optional passphrase. If provided, the passphrase will be necessary +to decrypt the cipherseed to expose the internal wallet seed. + +Once the cipherseed is obtained and verified by the user, the InitWallet +method should be used to commit the newly generated seed, and create the +wallet. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileGenSeed(NSData* _Nullable msg, id _Nullable callback); + +/** + * GetChanInfo returns the latest authenticated network announcement for the +given channel identified by its channel ID: an 8-byte integer which +uniquely identifies the location of transaction's funding output within the +blockchain. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileGetChanInfo(NSData* _Nullable msg, id _Nullable callback); + +/** + * GetInfo returns general information concerning the lightning node including +it's identity pubkey, alias, the chains it is connected to, and information +concerning the number of open+pending channels. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileGetInfo(NSData* _Nullable msg, id _Nullable callback); + +/** + * GetNetworkInfo returns some basic stats about the known channel graph from +the point of view of the node. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileGetNetworkInfo(NSData* _Nullable msg, id _Nullable callback); + +/** + * GetNodeInfo returns the latest advertised, aggregated, and authenticated +channel information for the specified node identified by its public key. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileGetNodeInfo(NSData* _Nullable msg, id _Nullable callback); + +/** + * GetNodeMetrics returns node metrics calculated from the graph. Currently +the only supported metric is betweenness centrality of individual nodes. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileGetNodeMetrics(NSData* _Nullable msg, id _Nullable callback); + +/** + * GetRecoveryInfo returns information concerning the recovery mode including +whether it's in a recovery mode, whether the recovery is finished, and the +progress made so far. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileGetRecoveryInfo(NSData* _Nullable msg, id _Nullable callback); + +/** + * GetTransactions returns a list describing all the known transactions +relevant to the wallet. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileGetTransactions(NSData* _Nullable msg, id _Nullable callback); + +/** + * InitWallet is used when lnd is starting up for the first time to fully +initialize the daemon and its internal wallet. At the very least a wallet +password must be provided. This will be used to encrypt sensitive material +on disk. + +In the case of a recovery scenario, the user can also specify their aezeed +mnemonic and passphrase. If set, then the daemon will use this prior state +to initialize its internal wallet. + +Alternatively, this can be used along with the GenSeed RPC to obtain a +seed, then present it to the user. Once it has been verified by the user, +the seed can be fed into this RPC in order to commit the new wallet. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileInitWallet(NSData* _Nullable msg, id _Nullable callback); + +/** + * ListChannels returns a description of all the open channels that this node +is a participant in. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileListChannels(NSData* _Nullable msg, id _Nullable callback); + +/** + * ListInvoices returns a list of all the invoices currently stored within the +database. Any active debug invoices are ignored. It has full support for +paginated responses, allowing users to query for specific invoices through +their add_index. This can be done by using either the first_index_offset or +last_index_offset fields included in the response as the index_offset of the +next request. By default, the first 100 invoices created will be returned. +Backwards pagination is also supported through the Reversed flag. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileListInvoices(NSData* _Nullable msg, id _Nullable callback); + +/** + * ListPayments returns a list of all outgoing payments. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileListPayments(NSData* _Nullable msg, id _Nullable callback); + +/** + * ListPeers returns a verbose listing of all currently active peers. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileListPeers(NSData* _Nullable msg, id _Nullable callback); + +/** + * ListPermissions lists all RPC method URIs and their required macaroon +permissions to access them. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileListPermissions(NSData* _Nullable msg, id _Nullable callback); + +/** + * NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileListUnspent(NSData* _Nullable msg, id _Nullable callback); + +/** + * LookupInvoice attempts to look up an invoice according to its payment hash. +The passed payment hash *must* be exactly 32 bytes, if not, an error is +returned. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileLookupInvoice(NSData* _Nullable msg, id _Nullable callback); + +/** + * ModifyStatus is used to modify the status of the autopilot agent, like +enabling or disabling it. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileModifyStatus(NSData* _Nullable msg, id _Nullable callback); + +/** + * NewAddress creates a new address under control of the local wallet. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileNewAddress(NSData* _Nullable msg, id _Nullable callback); + +/** + * OpenChannel attempts to open a singly funded channel specified in the +request to a remote peer. Users are able to specify a target number of +blocks that the funding transaction should be confirmed in, or a manual fee +rate to us for the funding transaction. If neither are specified, then a +lax block confirmation target is used. Each OpenStatusUpdate will return +the pending channel ID of the in-progress channel. Depending on the +arguments specified in the OpenChannelRequest, this pending channel ID can +then be used to manually progress the channel funding flow. + +NOTE: This method produces a stream of responses, and the receive stream can +be called zero or more times. After EOF error is returned, no more responses +will be produced. + */ +FOUNDATION_EXPORT void LndmobileOpenChannel(NSData* _Nullable msg, id _Nullable rStream); + +/** + * OpenChannelSync is a synchronous version of the OpenChannel RPC call. This +call is meant to be consumed by clients to the REST proxy. As with all +other sync calls, all byte slices are intended to be populated as hex +encoded strings. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileOpenChannelSync(NSData* _Nullable msg, id _Nullable callback); + +/** + * PendingChannels returns a list of all the channels that are currently +considered "pending". A channel is pending if it has finished the funding +workflow and is waiting for confirmations for the funding txn, or is in the +process of closure, either initiated cooperatively or non-cooperatively. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobilePendingChannels(NSData* _Nullable msg, id _Nullable callback); + +/** + * QueryRoutes attempts to query the daemon's Channel Router for a possible +route to a target destination capable of carrying a specific amount of +satoshis. The returned route contains the full details required to craft and +send an HTLC, also including the necessary information that should be +present within the Sphinx packet encapsulated within the HTLC. + +When using REST, the `dest_custom_records` map type can be set by appending +`&dest_custom_records[]=` +to the URL. Unfortunately this map type doesn't appear in the REST API +documentation because of a bug in the grpc-gateway library. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileQueryRoutes(NSData* _Nullable msg, id _Nullable callback); + +/** + * QueryScores queries all available autopilot heuristics, in addition to any +active combination of these heruristics, for the scores they would give to +the given nodes. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileQueryScores(NSData* _Nullable msg, id _Nullable callback); + +/** + * RestoreChannelBackups accepts a set of singular channel backups, or a +single encrypted multi-chan backup and attempts to recover any funds +remaining within the channel. If we are able to unpack the backup, then the +new channel will be shown under listchannels, as well as pending channels. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileRestoreChannelBackups(NSData* _Nullable msg, id _Nullable callback); + +/** + * SendCoins executes a request to send coins to a particular address. Unlike +SendMany, this RPC call only allows creating a single output at a time. If +neither target_conf, or sat_per_byte are set, then the internal wallet will +consult its fee model to determine a fee for the default confirmation +target. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileSendCoins(NSData* _Nullable msg, id _Nullable callback); + +/** + * SendMany handles a request for a transaction that creates multiple specified +outputs in parallel. If neither target_conf, or sat_per_byte are set, then +the internal wallet will consult its fee model to determine a fee for the +default confirmation target. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileSendMany(NSData* _Nullable msg, id _Nullable callback); + +/** + * NOTE: This method produces a stream of responses, and the receive stream can +be called zero or more times. After EOF error is returned, no more responses +will be produced. The send stream can accept zero or more requests before it +is closed. + */ +FOUNDATION_EXPORT id _Nullable LndmobileSendPayment(id _Nullable rStream, NSError* _Nullable* _Nullable error); + +/** + * SendPaymentSync is the synchronous non-streaming version of SendPayment. +This RPC is intended to be consumed by clients of the REST proxy. +Additionally, this RPC expects the destination's public key and the payment +hash (if any) to be encoded as hex strings. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileSendPaymentSync(NSData* _Nullable msg, id _Nullable callback); + +/** + * NOTE: This method produces a stream of responses, and the receive stream can +be called zero or more times. After EOF error is returned, no more responses +will be produced. The send stream can accept zero or more requests before it +is closed. + */ +FOUNDATION_EXPORT id _Nullable LndmobileSendToRoute(id _Nullable rStream, NSError* _Nullable* _Nullable error); + +/** + * SendToRouteSync is a synchronous version of SendToRoute. It Will block +until the payment either fails or succeeds. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileSendToRouteSync(NSData* _Nullable msg, id _Nullable callback); + +/** + * SetScores attempts to set the scores used by the running autopilot agent, +if the external scoring heuristic is enabled. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileSetScores(NSData* _Nullable msg, id _Nullable callback); + +/** + * SignMessage signs a message with this node's private key. The returned +signature string is `zbase32` encoded and pubkey recoverable, meaning that +only the message digest and signature are needed for verification. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileSignMessage(NSData* _Nullable msg, id _Nullable callback); + +/** + * Start starts lnd in a new goroutine. + +extraArgs can be used to pass command line arguments to lnd that will +override what is found in the config file. Example: + extraArgs = "--bitcoin.testnet --lnddir=\"/tmp/folder name/\" --profile=5050" + +The unlockerReady callback is called when the WalletUnlocker service is +ready, and rpcReady is called after the wallet has been unlocked and lnd is +ready to accept RPC calls. + +NOTE: On mobile platforms the '--lnddir` argument should be set to the +current app directory in order to ensure lnd has the permissions needed to +write to it. + */ +FOUNDATION_EXPORT void LndmobileStart(NSString* _Nullable extraArgs, id _Nullable unlockerReady, id _Nullable rpcReady); + +/** + * Status returns whether the daemon's autopilot agent is active. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileStatus(NSData* _Nullable msg, id _Nullable callback); + +/** + * StopDaemon will send a shutdown request to the interrupt handler, triggering +a graceful shutdown of the daemon. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileStopDaemon(NSData* _Nullable msg, id _Nullable callback); + +/** + * SubscribeChannelBackups allows a client to sub-subscribe to the most up to +date information concerning the state of all channel backups. Each time a +new channel is added, we return the new set of channels, along with a +multi-chan backup containing the backup info for all channels. Each time a +channel is closed, we send a new update, which contains new new chan back +ups, but the updated set of encrypted multi-chan backups with the closed +channel(s) removed. + +NOTE: This method produces a stream of responses, and the receive stream can +be called zero or more times. After EOF error is returned, no more responses +will be produced. + */ +FOUNDATION_EXPORT void LndmobileSubscribeChannelBackups(NSData* _Nullable msg, id _Nullable rStream); + +/** + * SubscribeChannelEvents creates a uni-directional stream from the server to +the client in which any updates relevant to the state of the channels are +sent over. Events include new active channels, inactive channels, and closed +channels. + +NOTE: This method produces a stream of responses, and the receive stream can +be called zero or more times. After EOF error is returned, no more responses +will be produced. + */ +FOUNDATION_EXPORT void LndmobileSubscribeChannelEvents(NSData* _Nullable msg, id _Nullable rStream); + +/** + * SubscribeChannelGraph launches a streaming RPC that allows the caller to +receive notifications upon any changes to the channel graph topology from +the point of view of the responding node. Events notified include: new +nodes coming online, nodes updating their authenticated attributes, new +channels being advertised, updates in the routing policy for a directional +channel edge, and when channels are closed on-chain. + +NOTE: This method produces a stream of responses, and the receive stream can +be called zero or more times. After EOF error is returned, no more responses +will be produced. + */ +FOUNDATION_EXPORT void LndmobileSubscribeChannelGraph(NSData* _Nullable msg, id _Nullable rStream); + +/** + * SubscribeInvoices returns a uni-directional stream (server -> client) for +notifying the client of newly added/settled invoices. The caller can +optionally specify the add_index and/or the settle_index. If the add_index +is specified, then we'll first start by sending add invoice events for all +invoices with an add_index greater than the specified value. If the +settle_index is specified, the next, we'll send out all settle events for +invoices with a settle_index greater than the specified value. One or both +of these fields can be set. If no fields are set, then we'll only send out +the latest add/settle events. + +NOTE: This method produces a stream of responses, and the receive stream can +be called zero or more times. After EOF error is returned, no more responses +will be produced. + */ +FOUNDATION_EXPORT void LndmobileSubscribeInvoices(NSData* _Nullable msg, id _Nullable rStream); + +/** + * SubscribePeerEvents creates a uni-directional stream from the server to +the client in which any events relevant to the state of peers are sent +over. Events include peers going online and offline. + +NOTE: This method produces a stream of responses, and the receive stream can +be called zero or more times. After EOF error is returned, no more responses +will be produced. + */ +FOUNDATION_EXPORT void LndmobileSubscribePeerEvents(NSData* _Nullable msg, id _Nullable rStream); + +/** + * SubscribeTransactions creates a uni-directional stream from the server to +the client in which any newly discovered transactions relevant to the +wallet are sent over. + +NOTE: This method produces a stream of responses, and the receive stream can +be called zero or more times. After EOF error is returned, no more responses +will be produced. + */ +FOUNDATION_EXPORT void LndmobileSubscribeTransactions(NSData* _Nullable msg, id _Nullable rStream); + +/** + * UnlockWallet is used at startup of lnd to provide a password to unlock +the wallet database. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileUnlockWallet(NSData* _Nullable msg, id _Nullable callback); + +/** + * UpdateChannelPolicy allows the caller to update the fee schedule and +channel policies for all channels globally, or a particular channel. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileUpdateChannelPolicy(NSData* _Nullable msg, id _Nullable callback); + +/** + * VerifyChanBackup allows a caller to verify the integrity of a channel backup +snapshot. This method will accept either a packed Single or a packed Multi. +Specifying both will result in an error. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileVerifyChanBackup(NSData* _Nullable msg, id _Nullable callback); + +/** + * VerifyMessage verifies a signature over a msg. The signature must be +zbase32 encoded and signed by an active node in the resident node's +channel database. In addition to returning the validity of the signature, +VerifyMessage also returns the recovered pubkey from the signature. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileVerifyMessage(NSData* _Nullable msg, id _Nullable callback); + +/** + * WalletBalance returns total unspent outputs(confirmed and unconfirmed), all +confirmed unspent outputs and all unconfirmed unspent outputs under control +of the wallet. + +NOTE: This method produces a single result or error, and the callback will +be called only once. + */ +FOUNDATION_EXPORT void LndmobileWalletBalance(NSData* _Nullable msg, id _Nullable callback); + +@class LndmobileCallback; + +@class LndmobileRecvStream; + +@class LndmobileSendStream; + +/** + * Callback is an interface that is passed in by callers of the library, and +specifies where the responses should be delivered. + */ +@interface LndmobileCallback : NSObject { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +/** + * OnError is called by the library if any error is encountered during +the execution of the RPC call. + */ +- (void)onError:(NSError* _Nullable)p0; +/** + * OnResponse is called by the library when a response from the daemon +for the associated RPC call is received. The reponse is a serialized +protobuf for the expected response, and must be deserialized by the +caller. + */ +- (void)onResponse:(NSData* _Nullable)p0; +@end + +/** + * RecvStream is an interface that is passed in by callers of the library, and +specifies where the streaming responses should be delivered. + */ +@interface LndmobileRecvStream : NSObject { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +/** + * OnError is called by the library if any error is encountered during +the execution of the RPC call, or if the response stream ends. No +more stream responses will be received after this. + */ +- (void)onError:(NSError* _Nullable)p0; +/** + * OnResponse is called by the library when a new stream response from +the daemon for the associated RPC call is available. The reponse is +a serialized protobuf for the expected response, and must be +deserialized by the caller. + */ +- (void)onResponse:(NSData* _Nullable)p0; +@end + +/** + * SendStream is an interface that the caller of the library can use to send +requests to the server during the execution of a bidirectional streaming RPC +call, or stop the stream. + */ +@interface LndmobileSendStream : NSObject { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +/** + * Send sends the serialized protobuf request to the server. + */ +- (BOOL)send:(NSData* _Nullable)p0 error:(NSError* _Nullable* _Nullable)error; +/** + * Stop closes the bidirecrional connection. + */ +- (BOOL)stop:(NSError* _Nullable* _Nullable)error; +@end + +#endif diff --git a/Lndmobile.framework/Versions/A/Headers/Universe.objc.h b/Lndmobile.framework/Versions/A/Headers/Universe.objc.h new file mode 100644 index 0000000..019e750 --- /dev/null +++ b/Lndmobile.framework/Versions/A/Headers/Universe.objc.h @@ -0,0 +1,29 @@ +// Objective-C API for talking to Go package. +// gobind -lang=objc +// +// File is generated by gobind. Do not edit. + +#ifndef __Universe_H__ +#define __Universe_H__ + +@import Foundation; +#include "ref.h" + +@protocol Universeerror; +@class Universeerror; + +@protocol Universeerror +- (NSString* _Nonnull)error; +@end + +@class Universeerror; + +@interface Universeerror : NSError { +} +@property(strong, readonly) _Nonnull id _ref; + +- (nonnull instancetype)initWithRef:(_Nonnull id)ref; +- (NSString* _Nonnull)error; +@end + +#endif diff --git a/Lndmobile.framework/Versions/A/Headers/ref.h b/Lndmobile.framework/Versions/A/Headers/ref.h new file mode 100644 index 0000000..b8036a4 --- /dev/null +++ b/Lndmobile.framework/Versions/A/Headers/ref.h @@ -0,0 +1,35 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +#ifndef __GO_REF_HDR__ +#define __GO_REF_HDR__ + +#include + +// GoSeqRef is an object tagged with an integer for passing back and +// forth across the language boundary. A GoSeqRef may represent either +// an instance of a Go object, or an Objective-C object passed to Go. +// The explicit allocation of a GoSeqRef is used to pin a Go object +// when it is passed to Objective-C. The Go seq package maintains a +// reference to the Go object in a map keyed by the refnum along with +// a reference count. When the reference count reaches zero, the Go +// seq package will clear the corresponding entry in the map. +@interface GoSeqRef : NSObject { +} +@property(readonly) int32_t refnum; +@property(strong) id obj; // NULL when representing a Go object. + +// new GoSeqRef object to proxy a Go object. The refnum must be +// provided from Go side. +- (instancetype)initWithRefnum:(int32_t)refnum obj:(id)obj; + +- (int32_t)incNum; + +@end + +@protocol goSeqRefInterface +-(GoSeqRef*) _ref; +@end + +#endif diff --git a/Lndmobile.framework/Versions/A/Lndmobile b/Lndmobile.framework/Versions/A/Lndmobile new file mode 100644 index 0000000..272767d Binary files /dev/null and b/Lndmobile.framework/Versions/A/Lndmobile differ diff --git a/Lndmobile.framework/Versions/A/Modules/module.modulemap b/Lndmobile.framework/Versions/A/Modules/module.modulemap new file mode 100644 index 0000000..f3a64b3 --- /dev/null +++ b/Lndmobile.framework/Versions/A/Modules/module.modulemap @@ -0,0 +1,8 @@ +framework module "Lndmobile" { + header "ref.h" + header "Lndmobile.objc.h" + header "Universe.objc.h" + header "Lndmobile.h" + + export * +} \ No newline at end of file diff --git a/Lndmobile.framework/Versions/A/Resources/Info.plist b/Lndmobile.framework/Versions/A/Resources/Info.plist new file mode 100644 index 0000000..0d1a4b8 --- /dev/null +++ b/Lndmobile.framework/Versions/A/Resources/Info.plist @@ -0,0 +1,6 @@ + + + + + + diff --git a/Lndmobile.framework/Versions/Current b/Lndmobile.framework/Versions/Current new file mode 120000 index 0000000..8c7e5a6 --- /dev/null +++ b/Lndmobile.framework/Versions/Current @@ -0,0 +1 @@ +A \ No newline at end of file diff --git a/Podfile b/Podfile new file mode 100644 index 0000000..6790b8e --- /dev/null +++ b/Podfile @@ -0,0 +1,20 @@ +# Uncomment the next line to define a global platform for your project +# platform :ios, '9.0' + +target 'wallet' do + # Comment the next line if you don't want to use dynamic frameworks + use_frameworks! + + # Pods for wallet + pod 'SwiftProtobuf', '~> 1.0' + pod 'QR-Code-Scanner-iOS' + target 'walletTests' do + inherit! :search_paths + # Pods for testing + end + + target 'walletUITests' do + # Pods for testing + end + +end diff --git a/Podfile.lock b/Podfile.lock new file mode 100644 index 0000000..8618cbb --- /dev/null +++ b/Podfile.lock @@ -0,0 +1,20 @@ +PODS: + - QR-Code-Scanner-iOS (1.0.0) + - SwiftProtobuf (1.12.0) + +DEPENDENCIES: + - QR-Code-Scanner-iOS + - SwiftProtobuf (~> 1.0) + +SPEC REPOS: + trunk: + - QR-Code-Scanner-iOS + - SwiftProtobuf + +SPEC CHECKSUMS: + QR-Code-Scanner-iOS: 6633d5157a50467d66ab357af2432b576c702e5e + SwiftProtobuf: 4ef85479c18ca85b5482b343df9c319c62bda699 + +PODFILE CHECKSUM: d7310fa0d2b536b55397de242eb9357089f5f87c + +COCOAPODS: 1.11.3 diff --git a/Pods/Manifest.lock b/Pods/Manifest.lock new file mode 100644 index 0000000..8618cbb --- /dev/null +++ b/Pods/Manifest.lock @@ -0,0 +1,20 @@ +PODS: + - QR-Code-Scanner-iOS (1.0.0) + - SwiftProtobuf (1.12.0) + +DEPENDENCIES: + - QR-Code-Scanner-iOS + - SwiftProtobuf (~> 1.0) + +SPEC REPOS: + trunk: + - QR-Code-Scanner-iOS + - SwiftProtobuf + +SPEC CHECKSUMS: + QR-Code-Scanner-iOS: 6633d5157a50467d66ab357af2432b576c702e5e + SwiftProtobuf: 4ef85479c18ca85b5482b343df9c319c62bda699 + +PODFILE CHECKSUM: d7310fa0d2b536b55397de242eb9357089f5f87c + +COCOAPODS: 1.11.3 diff --git a/Pods/Pods.xcodeproj/project.pbxproj b/Pods/Pods.xcodeproj/project.pbxproj new file mode 100644 index 0000000..c9d72b5 --- /dev/null +++ b/Pods/Pods.xcodeproj/project.pbxproj @@ -0,0 +1,1523 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 51; + objects = { + +/* Begin PBXBuildFile section */ + 02C9348158E6E0582770A9A86DAF39F2 /* CameraAccessDeniedViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9647EFC698ED930B5F4BAFFB486D0175 /* CameraAccessDeniedViewController.swift */; }; + 03DC8AA9D0BB917802FFD7C7958E7F2E /* SimpleExtensionMap.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2632A62A2EA47B332CA87CEDA1D61A9 /* SimpleExtensionMap.swift */; }; + 0A6B9F20E3D4300D2F1EFD1444927247 /* ExtensibleMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF5E7AC680CC33CA5EA6F84988BC3FFF /* ExtensibleMessage.swift */; }; + 0B075C48FAD06219B32FAF533F3F55B0 /* AnyUnpackError.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9235CB92060D1C5F116126D488B26E4 /* AnyUnpackError.swift */; }; + 0BE93E9BC271A4250AF1E2F9CBE04AF1 /* any.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D69CC2C320976FD87984360B059A93F /* any.pb.swift */; }; + 0FA26C131C63B653843EF66C81B16E16 /* BinaryDelimited.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52BBFFDDA2380867DE18A9EB1ABC2A08 /* BinaryDelimited.swift */; }; + 19CC1192BE3F53932F19A42808AF2DBE /* CustomJSONCodable.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB3DE43496A80847AB22332BBE607408 /* CustomJSONCodable.swift */; }; + 1AA028CE24E76925A981C67CF6662B5D /* ZigZag.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2ED1632A277ACFED961A0D774C0B7508 /* ZigZag.swift */; }; + 21D69507A07B9257F28036134235BC52 /* Decoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = D91E3082C3A52834CC167F5EC2757029 /* Decoder.swift */; }; + 2314E1F1A7D7713A19D82AF3535BF64E /* JSONMapEncodingVisitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62C5EE0699B3F17C0E58843F507466AB /* JSONMapEncodingVisitor.swift */; }; + 2B0770096805134D01ED027BBEDBE54B /* JSONEncodingOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = D3D6D365D822D6333E2486CA053E6904 /* JSONEncodingOptions.swift */; }; + 2B1A4B0FC062686B3285AE2D2A970E30 /* BinaryEncodingError.swift in Sources */ = {isa = PBXBuildFile; fileRef = A124F2F6D600A29EE2F67311F97F93A4 /* BinaryEncodingError.swift */; }; + 325EB1D034D0A514CA1CFB6C512F2A84 /* AnyMessageStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBE319C957EC7C5F36BF9F10B2F05123 /* AnyMessageStorage.swift */; }; + 3484E6510D1C2A92FCC8385EBBAE877B /* empty.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2090058E1F53C1427C5B31D537367B64 /* empty.pb.swift */; }; + 397764E493AF1BA28409B3E6BEC36669 /* JSONDecoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3AFCBB9CA485048941CC3AC78D51D15 /* JSONDecoder.swift */; }; + 3EFBE542093E25A3141BCFC0DEC7B09A /* Google_Protobuf_Duration+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5EC110A9A3864E27A84856FD38556F84 /* Google_Protobuf_Duration+Extensions.swift */; }; + 4A61CE0A4B73C814A57D2A9D3E7C21F7 /* Pods-wallet-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = FB9B807A42D7F1E9DC7132DA2CE6AFB4 /* Pods-wallet-dummy.m */; }; + 50DC4B530D2E03085FCFA77F64F28018 /* QRCodeScanViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAB8F3DBD00E98B44AE7CDEB82CF96A1 /* QRCodeScanViewController.swift */; }; + 52205B13CDE7FB35BE4BFCF75C93F7ED /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 73010CC983E3809BECEE5348DA1BB8C6 /* Foundation.framework */; }; + 55F1EA9B8F0BB40375A73C335D9A2253 /* UnsafeBufferPointer+Shims.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53D13D19D0859851C54DD32C1AFF1F33 /* UnsafeBufferPointer+Shims.swift */; }; + 577D8FDF1D69F285A7A2DEC6C755A981 /* TextFormatEncoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4B7CC104291A2F3CC15179A8BB683A8 /* TextFormatEncoder.swift */; }; + 59FD399030E7E0BB2B9461AEEE2DC6C9 /* Google_Protobuf_Wrappers+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9750965B91F52686C14631C8C6AAC674 /* Google_Protobuf_Wrappers+Extensions.swift */; }; + 5E19567D0E57401A2D6DF5A90F052D50 /* Pods-walletTests-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = C3C6AED543073CAE27F3C809E087D069 /* Pods-walletTests-dummy.m */; }; + 61898B2CBC1CB0F2FAC8652F3D33D842 /* timestamp.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = F438C2022FCB92E3936976FEB0ECF3C2 /* timestamp.pb.swift */; }; + 6342AF94E5184A8009D0CD79261E71FB /* MathUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 456198322B26C30D0A12C3AB4898A7E2 /* MathUtils.swift */; }; + 637AE22B3369D5350F3E5F9B0ECA99F7 /* Version.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95F73997DBE54920D1A436F21F4F7191 /* Version.swift */; }; + 65CBBE094D083261A315D5DE18A95E29 /* BinaryEncodingVisitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7219DF0DEC97C9EDB4FD1BD954ABCAF2 /* BinaryEncodingVisitor.swift */; }; + 68658FDE33DB912350AC6EC32733C1A3 /* Google_Protobuf_Timestamp+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 302A85D57581D1E962C57C82EC81B2C0 /* Google_Protobuf_Timestamp+Extensions.swift */; }; + 6AE6E4ECA50F1CDC6E43F61E9B092732 /* Google_Protobuf_Any+Registry.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6FF07A4433E8D23B15C840AAB8567709 /* Google_Protobuf_Any+Registry.swift */; }; + 6D917476411F5083D1B7EE65F404E39B /* BinaryEncodingSizeVisitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB76A38EFE53B80D00548C6C9F92A16A /* BinaryEncodingSizeVisitor.swift */; }; + 714F3B85B7A0A673B913DE790D3BEB03 /* Visitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ABCD0835232C027ABC46D7464650325 /* Visitor.swift */; }; + 7159E860E2081CAF7E06DA2BA49DD735 /* TextFormatDecoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8EB487DE3F50B616591A9E1876333C81 /* TextFormatDecoder.swift */; }; + 73B9FF2ED2F382A23ACE7E54176A9FF6 /* TextFormatDecodingError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4172F34D77D834FBE1282BF52D7BF2B5 /* TextFormatDecodingError.swift */; }; + 75930600B1620E32EF69F5F3AEE36324 /* JSONDecodingError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42B18CEE14A926A1D737DFDE339CA34C /* JSONDecodingError.swift */; }; + 77669A73AEE9B6D3B6ADCECC83927C4E /* UnsafeRawPointer+Shims.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AB9C729C46FDF122902DB35E8E15CDF /* UnsafeRawPointer+Shims.swift */; }; + 7A51348B6D71F05D6A27B25BC121668C /* field_mask.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9F2C1F274FF04EB8EB1128D4178082A /* field_mask.pb.swift */; }; + 7C1F3D55C49E8E99564511458245B48C /* QR-Code-Scanner-iOS-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 5F1B0277965AF8FA4731E9A99F16B7A8 /* QR-Code-Scanner-iOS-dummy.m */; }; + 7D3AF422FA58C91F66A9CBBF82C422FB /* JSONScanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 605F05678934B0060EFE53E755B81217 /* JSONScanner.swift */; }; + 7F393704FB1EF4919C043F43346B524D /* DoubleParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CACAD72AD50B6D7BA588D9BA5C84769 /* DoubleParser.swift */; }; + 7FF66AA222BC78CCBC3D559A230E2044 /* Google_Protobuf_Value+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24B0565A60D0E7BB38FC98CB0357CC09 /* Google_Protobuf_Value+Extensions.swift */; }; + 815D71443DB342EC7F2A23293CF7248B /* SelectiveVisitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF96E25BEEA28D79B304E1ADA94049F2 /* SelectiveVisitor.swift */; }; + 83B22FC0350CC97DDA410C5B9D17ECC3 /* duration.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9DFC5F3F2867C86F51125E0B9AB38D4 /* duration.pb.swift */; }; + 841074B04094F51B67058B79C590986C /* JSONEncoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A90A2ABD3E51DA1529ABA5B09999520 /* JSONEncoder.swift */; }; + 8551038B1D3232FC41FAA8483D57FAF3 /* WireFormat.swift in Sources */ = {isa = PBXBuildFile; fileRef = F6462A848E6AD69B9E0C9EAF224CA184 /* WireFormat.swift */; }; + 873A5680BD4362D36A7DC6A2920B3ADC /* NameMap.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2173873BC233ACB0DC0E59214CC206F4 /* NameMap.swift */; }; + 8AF726C002AB0C6717A44F4C21B9C6E3 /* BinaryEncoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1E06B11647E1ECF744F0BBB0E29195F /* BinaryEncoder.swift */; }; + 8C6086FE07AED5AB3910F2BAECCCEE68 /* Google_Protobuf_FieldMask+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 948908C4840BFB19553A504F51C52567 /* Google_Protobuf_FieldMask+Extensions.swift */; }; + 8D24AE69AD1870310B63F54125BCD08F /* ExtensionFields.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81A25B994CA2A077E5771214360CB6B0 /* ExtensionFields.swift */; }; + 8E871C1C7ACDFD1A14337B22475320B2 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 73010CC983E3809BECEE5348DA1BB8C6 /* Foundation.framework */; }; + 909EFFCFFEA3A1479DA195D3E2376778 /* QRCode.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 10E5C02EDDCC1032D8269E48A0BB159C /* QRCode.storyboard */; }; + 91F179560186F0705155710DDDFCF318 /* wrappers.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = B041A8B43E51082A8B6D9660FCF394E6 /* wrappers.pb.swift */; }; + 92BD4B45DD4D344E3D22E87B74A7EBB4 /* MessageExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25B4608416254A3EA09D005DC4550AC0 /* MessageExtension.swift */; }; + 98221E7C27A56981EB5F9EA25911F968 /* TextFormatScanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = FBE77BC35F99D4A17F7F7D4C1ECE07C2 /* TextFormatScanner.swift */; }; + 9AEBA9FBB6145412750D64924A0D53AA /* FieldTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89B9B2625D619AC1AC946DBC9A307E28 /* FieldTypes.swift */; }; + 9EBFB7F3464C1527E680479276FDE01F /* FieldTag.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76A954A2B9F622977E9F95292556BC1E /* FieldTag.swift */; }; + A5330425C557D0EBCC2541081EA73941 /* api.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDE4459F0F0929C676B04B8B9149DBCC /* api.pb.swift */; }; + A6460786CF9CA3C53BCD7A2651280914 /* Pods-wallet-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = D3144F7AB4C02BC805E43145B984FF09 /* Pods-wallet-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AA1C395D46798F2CB1279653810DC921 /* Enum.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6904164B45010312C0A941DD39550BD /* Enum.swift */; }; + AB528F9105AA61C3A1273B6669235761 /* ExtensionFieldValueSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE3613E5B364ACA4F5DD2AD79D41A0A0 /* ExtensionFieldValueSet.swift */; }; + AB84E1B40107FA34740ECCC232FAD8A6 /* BinaryDecoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = A368C8AB1A5DE0C60CECF6693284948F /* BinaryDecoder.swift */; }; + AE3E17C8F327DEE3DD9AD856036CB80C /* ProtoNameProviding.swift in Sources */ = {isa = PBXBuildFile; fileRef = D63F28F0B3AB6C22B82E19BBDA24F3FE /* ProtoNameProviding.swift */; }; + AE4AF83FD866DC8CCB63B2FBCE277087 /* Varint.swift in Sources */ = {isa = PBXBuildFile; fileRef = D22D8DCFB29502868358A0E07B2CA255 /* Varint.swift */; }; + AFE29667448E06D24C5AB884DC4F9AC0 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 73010CC983E3809BECEE5348DA1BB8C6 /* Foundation.framework */; }; + B20044327CD5E625E08351A9A86B184D /* type.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = D12832E3D8BBE833BFA402032AEF71CC /* type.pb.swift */; }; + B7C1AC40079FDCCFBC50E015824815D5 /* Pods-walletTests-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = DCA65E90899F1919B0AFE002BD1C17F0 /* Pods-walletTests-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + B90AEDF924CC52AC7585B73E1030AEAB /* HashVisitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69C4FC4FCE7681D782B70631E1D223ED /* HashVisitor.swift */; }; + BD0A958B00C37DA756D950084EA57B52 /* Pods-wallet-walletUITests-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = F67EAC0CDBCE7D9D07F460D1889A830C /* Pods-wallet-walletUITests-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C0735FA5855D093FFA8C685BE85A9FA9 /* JSONEncodingVisitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = F6438060F08A1F9400680666F350A806 /* JSONEncodingVisitor.swift */; }; + C3A2D6FCFB53A6E87A8F1151E48C9062 /* Media.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C25EB6FDECC8D2CBC210DF1BC213E6F1 /* Media.xcassets */; }; + C3AF3321F45F1C10EEDF787945A7C94D /* Google_Protobuf_Struct+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46BD9E9B234B3E8203F476AFE623F614 /* Google_Protobuf_Struct+Extensions.swift */; }; + C70A59B0078EF6E688CC9D29238543CD /* Google_Protobuf_NullValue+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CA12395CAB6A820E9DCF27989D70824 /* Google_Protobuf_NullValue+Extensions.swift */; }; + C7D59D9B065F71D17F060D8E8435DA8A /* StringUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3306EE85AC157C7FE1C963999EBCEABA /* StringUtils.swift */; }; + C86E0637C60F6874DC13AC04EFA81204 /* struct.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = C59C6705C67D9D3DDFE193077C92B670 /* struct.pb.swift */; }; + CA703181EEF7141CC95B7865678843D9 /* Google_Protobuf_Any+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 282292677D72F65EB7AA919E2AF3E8BB /* Google_Protobuf_Any+Extensions.swift */; }; + CA816A4726A4E162D8EEC81768E7D3D0 /* JSONDecodingOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BB456CB2AA42CE47AE5E701ABF8D2F6 /* JSONDecodingOptions.swift */; }; + CD9D5474B92B8C2A6FE59A9B041C7AA0 /* Google_Protobuf_ListValue+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8C6E60118976A1C5FF6015FBC859179 /* Google_Protobuf_ListValue+Extensions.swift */; }; + CECF508F06F1E7BDACB3C88FD79F0595 /* Pods-wallet-walletUITests-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 70E43AA065F0FA1593C0F40AB3077C40 /* Pods-wallet-walletUITests-dummy.m */; }; + CFF2D2090B0177BE98EBD24962A3F986 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 73010CC983E3809BECEE5348DA1BB8C6 /* Foundation.framework */; }; + D0AC31F628026177B458D65DAB5C37FE /* TextFormatEncodingVisitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = D29CFEA8F1426990C51D0EFE3C9E5822 /* TextFormatEncodingVisitor.swift */; }; + D5553EDDC5E223955C958A35B7449F58 /* Message+BinaryAdditions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 376E5DDF2750E1BADD96BBB02D9C6E73 /* Message+BinaryAdditions.swift */; }; + DA76D0FBC608E660D83E06861AEDC546 /* UnknownStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F48640CEE3CF4873C0893D6B6B40B19 /* UnknownStorage.swift */; }; + DAE6445D2D0AD17AAA5BFB4BAEF42030 /* SwiftProtobuf-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = C3BCA840F5066F30A8C7D03900CE0BF5 /* SwiftProtobuf-dummy.m */; }; + DC98276493047FB776A42073BB4C54BE /* source_context.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = D733B58250CDBAD1484A3124B207CE05 /* source_context.pb.swift */; }; + DD6BB823A983F099A774C4F8ACD05832 /* Data+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = E8EF2888FFEC0CB182048C614BF549A1 /* Data+Extensions.swift */; }; + DE1CB1B53A73788DF601470451DE3BF7 /* Message+JSONAdditions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AC3B31993B2BA6EF1F1CE36F4ACD6BD /* Message+JSONAdditions.swift */; }; + E10D21176D3A1431CA6F204FCD04C42F /* Internal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B7EAB017C37BB81ED28BF38F9D71D21 /* Internal.swift */; }; + E2D31368CF29470F154AC9E45E6DEB34 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 73010CC983E3809BECEE5348DA1BB8C6 /* Foundation.framework */; }; + E349A26F1BDBB83D86D03A35DD566091 /* ProtobufMap.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F68E2F231CA2243B996937C5C967EF0 /* ProtobufMap.swift */; }; + E46EA4CF016F53F6899CFBF8C686514C /* JSONEncodingError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2168F4567273D66C8A3A8199AEF72BCF /* JSONEncodingError.swift */; }; + E5BCB1E5E9479C366A2301A64A742C4E /* Message+TextFormatAdditions.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2BE3DA63AE294FDA05BCA38CACD5F37 /* Message+TextFormatAdditions.swift */; }; + E6C1B3E7C71879D476EF43F0B4A5C4C0 /* ProtobufAPIVersionCheck.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CF00CDD8187667438863FCF3FB1E7F4 /* ProtobufAPIVersionCheck.swift */; }; + ED4AB92E1D2D7CF20C2C53B7AD2CC532 /* BinaryDecodingOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD2ADB954905505378D55F9DA59DA719 /* BinaryDecodingOptions.swift */; }; + ED50698FB65DD44300731403CF6D27ED /* Message+JSONArrayAdditions.swift in Sources */ = {isa = PBXBuildFile; fileRef = A6FF1CEF2ABD6DFC91D71EAC395FBA21 /* Message+JSONArrayAdditions.swift */; }; + F1499CDA776BDA6801D6ED57B7C3465B /* TextFormatEncodingOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94D72469D83B8C1C9523DAEFCBD81A6D /* TextFormatEncodingOptions.swift */; }; + F1F3A8E96D63B61C0966491531AAEAB8 /* ExtensionMap.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C7249A73E69715C97EC34D93A7BC8EF /* ExtensionMap.swift */; }; + F2974D726148AB2AFD112F509654CB78 /* Message.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40EB0A2168BEC68E987A2B185377E610 /* Message.swift */; }; + F47D92094BBC730646D251DA440F8250 /* QR-Code-Scanner-iOS-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 3014866D96C746894FD0F085E09B6F30 /* QR-Code-Scanner-iOS-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + F499A244617D0D00C539CEBFC56673E3 /* TimeUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = F100D8FD92D188113F02465318C5C223 /* TimeUtils.swift */; }; + F84CD37245C16382A95AEDA48F9268A6 /* SwiftProtobuf-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BEDCB305E59098B83712A529C35EC69 /* SwiftProtobuf-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + F98E150F1422D9DCB84C9348770184DE /* Message+AnyAdditions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D31872E4717078FDCBCAF8B527CE287 /* Message+AnyAdditions.swift */; }; + FCE62D4C84738D235FC0C822C11BFCFC /* descriptor.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EDB46DC1A2D4D5E5DDB4D10E36B3F06 /* descriptor.pb.swift */; }; + FD85E5AF6B72D9B33173452E626A1049 /* BinaryDecodingError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E50D6E7E6825DB06F608439CA67F227 /* BinaryDecodingError.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 1CC6D210283EFAD79E44C5F85701A5FE /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 03F8264CAE2EC0684FD64871C2FF793E; + remoteInfo = "QR-Code-Scanner-iOS"; + }; + 2E11626515B8519D3BBD8B37813264C3 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = A5F702E0DA383BC1479572581615A916; + remoteInfo = SwiftProtobuf; + }; + 80E44C83062844344E3E66A26F240A88 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4179979D0E7E44B4D103FAD5DF24E7E8; + remoteInfo = "Pods-wallet"; + }; + A50707F8E02A73B8AFDA4C558AB2DC50 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 03F8264CAE2EC0684FD64871C2FF793E; + remoteInfo = "QR-Code-Scanner-iOS"; + }; + FB7449B04276A838FDC1F1018B07424F /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = A5F702E0DA383BC1479572581615A916; + remoteInfo = SwiftProtobuf; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 00170BBF77840F17C6E4F8EF78DAE68D /* Pods-walletTests */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = "Pods-walletTests"; path = Pods_walletTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 00E005EC429ED62580BDE52DF4D1BFC0 /* Pods-wallet-walletUITests-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-wallet-walletUITests-acknowledgements.plist"; sourceTree = ""; }; + 0717CEB42AB9900F55F2D13B8E2B9EE3 /* Pods-wallet-walletUITests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-wallet-walletUITests.debug.xcconfig"; sourceTree = ""; }; + 085B6CB08733B092E08180A2B71E304C /* Pods-wallet-walletUITests */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = "Pods-wallet-walletUITests"; path = Pods_wallet_walletUITests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 09ED74926D1582CBAB28921A1C37CD82 /* Pods-wallet.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-wallet.debug.xcconfig"; sourceTree = ""; }; + 128311B4E8A2B7867C77E940FD437AF4 /* QR-Code-Scanner-iOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "QR-Code-Scanner-iOS.debug.xcconfig"; sourceTree = ""; }; + 17E0DF26CAEBF457A37AEE7B17392958 /* QR-Code-Scanner-iOS */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = "QR-Code-Scanner-iOS"; path = QRCodeScanner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 1AB9C729C46FDF122902DB35E8E15CDF /* UnsafeRawPointer+Shims.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UnsafeRawPointer+Shims.swift"; path = "Sources/SwiftProtobuf/UnsafeRawPointer+Shims.swift"; sourceTree = ""; }; + 1AC3B31993B2BA6EF1F1CE36F4ACD6BD /* Message+JSONAdditions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Message+JSONAdditions.swift"; path = "Sources/SwiftProtobuf/Message+JSONAdditions.swift"; sourceTree = ""; }; + 1BEA97957E4061D5113A323E0C7DEAB9 /* Pods-wallet */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = "Pods-wallet"; path = Pods_wallet.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 1CA12395CAB6A820E9DCF27989D70824 /* Google_Protobuf_NullValue+Extensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Google_Protobuf_NullValue+Extensions.swift"; path = "Sources/SwiftProtobuf/Google_Protobuf_NullValue+Extensions.swift"; sourceTree = ""; }; + 1D31872E4717078FDCBCAF8B527CE287 /* Message+AnyAdditions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Message+AnyAdditions.swift"; path = "Sources/SwiftProtobuf/Message+AnyAdditions.swift"; sourceTree = ""; }; + 1E50D6E7E6825DB06F608439CA67F227 /* BinaryDecodingError.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BinaryDecodingError.swift; path = Sources/SwiftProtobuf/BinaryDecodingError.swift; sourceTree = ""; }; + 2090058E1F53C1427C5B31D537367B64 /* empty.pb.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = empty.pb.swift; path = Sources/SwiftProtobuf/empty.pb.swift; sourceTree = ""; }; + 2168F4567273D66C8A3A8199AEF72BCF /* JSONEncodingError.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = JSONEncodingError.swift; path = Sources/SwiftProtobuf/JSONEncodingError.swift; sourceTree = ""; }; + 2173873BC233ACB0DC0E59214CC206F4 /* NameMap.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NameMap.swift; path = Sources/SwiftProtobuf/NameMap.swift; sourceTree = ""; }; + 21E5CC407327A9A9EFA597E5CF95461A /* Pods-wallet-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-wallet-acknowledgements.markdown"; sourceTree = ""; }; + 2307380895EA03CB1091251F2E7E8D74 /* Pods-wallet.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = "Pods-wallet.modulemap"; sourceTree = ""; }; + 24B0565A60D0E7BB38FC98CB0357CC09 /* Google_Protobuf_Value+Extensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Google_Protobuf_Value+Extensions.swift"; path = "Sources/SwiftProtobuf/Google_Protobuf_Value+Extensions.swift"; sourceTree = ""; }; + 24F1A5AA46C57511EDA0D8F97143CFE0 /* Pods-wallet.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-wallet.release.xcconfig"; sourceTree = ""; }; + 25B4608416254A3EA09D005DC4550AC0 /* MessageExtension.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MessageExtension.swift; path = Sources/SwiftProtobuf/MessageExtension.swift; sourceTree = ""; }; + 282292677D72F65EB7AA919E2AF3E8BB /* Google_Protobuf_Any+Extensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Google_Protobuf_Any+Extensions.swift"; path = "Sources/SwiftProtobuf/Google_Protobuf_Any+Extensions.swift"; sourceTree = ""; }; + 2BB456CB2AA42CE47AE5E701ABF8D2F6 /* JSONDecodingOptions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = JSONDecodingOptions.swift; path = Sources/SwiftProtobuf/JSONDecodingOptions.swift; sourceTree = ""; }; + 2ED1632A277ACFED961A0D774C0B7508 /* ZigZag.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ZigZag.swift; path = Sources/SwiftProtobuf/ZigZag.swift; sourceTree = ""; }; + 3014866D96C746894FD0F085E09B6F30 /* QR-Code-Scanner-iOS-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "QR-Code-Scanner-iOS-umbrella.h"; sourceTree = ""; }; + 302A85D57581D1E962C57C82EC81B2C0 /* Google_Protobuf_Timestamp+Extensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Google_Protobuf_Timestamp+Extensions.swift"; path = "Sources/SwiftProtobuf/Google_Protobuf_Timestamp+Extensions.swift"; sourceTree = ""; }; + 30F601AF6F1C6FB41592D030E94A63CC /* QR-Code-Scanner-iOS-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "QR-Code-Scanner-iOS-prefix.pch"; sourceTree = ""; }; + 3306EE85AC157C7FE1C963999EBCEABA /* StringUtils.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = StringUtils.swift; path = Sources/SwiftProtobuf/StringUtils.swift; sourceTree = ""; }; + 376E5DDF2750E1BADD96BBB02D9C6E73 /* Message+BinaryAdditions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Message+BinaryAdditions.swift"; path = "Sources/SwiftProtobuf/Message+BinaryAdditions.swift"; sourceTree = ""; }; + 39A9C71366A0006B610DD7A2B84618CB /* SwiftProtobuf-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "SwiftProtobuf-prefix.pch"; sourceTree = ""; }; + 3ABCD0835232C027ABC46D7464650325 /* Visitor.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Visitor.swift; path = Sources/SwiftProtobuf/Visitor.swift; sourceTree = ""; }; + 3B2666C84AFACA90A2B873D09AB132E3 /* Pods-walletTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-walletTests.release.xcconfig"; sourceTree = ""; }; + 3CF00CDD8187667438863FCF3FB1E7F4 /* ProtobufAPIVersionCheck.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ProtobufAPIVersionCheck.swift; path = Sources/SwiftProtobuf/ProtobufAPIVersionCheck.swift; sourceTree = ""; }; + 3EDB46DC1A2D4D5E5DDB4D10E36B3F06 /* descriptor.pb.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = descriptor.pb.swift; path = Sources/SwiftProtobuf/descriptor.pb.swift; sourceTree = ""; }; + 40EB0A2168BEC68E987A2B185377E610 /* Message.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Message.swift; path = Sources/SwiftProtobuf/Message.swift; sourceTree = ""; }; + 4172F34D77D834FBE1282BF52D7BF2B5 /* TextFormatDecodingError.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TextFormatDecodingError.swift; path = Sources/SwiftProtobuf/TextFormatDecodingError.swift; sourceTree = ""; }; + 42B18CEE14A926A1D737DFDE339CA34C /* JSONDecodingError.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = JSONDecodingError.swift; path = Sources/SwiftProtobuf/JSONDecodingError.swift; sourceTree = ""; }; + 430C217AF2FEAADF28B000D51D6C6EDA /* Pods-wallet-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-wallet-Info.plist"; sourceTree = ""; }; + 456198322B26C30D0A12C3AB4898A7E2 /* MathUtils.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MathUtils.swift; path = Sources/SwiftProtobuf/MathUtils.swift; sourceTree = ""; }; + 46BD9E9B234B3E8203F476AFE623F614 /* Google_Protobuf_Struct+Extensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Google_Protobuf_Struct+Extensions.swift"; path = "Sources/SwiftProtobuf/Google_Protobuf_Struct+Extensions.swift"; sourceTree = ""; }; + 50050A19ADA648A90F3589BC13E8E9B3 /* QRCode.storyboard */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = file.storyboard; name = QRCode.storyboard; path = Base.lproj/QRCode.storyboard; sourceTree = ""; }; + 52BBFFDDA2380867DE18A9EB1ABC2A08 /* BinaryDelimited.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BinaryDelimited.swift; path = Sources/SwiftProtobuf/BinaryDelimited.swift; sourceTree = ""; }; + 53234C0447207D077919CBBAF6B0DE0F /* Pods-wallet-walletUITests.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = "Pods-wallet-walletUITests.modulemap"; sourceTree = ""; }; + 539442DA05EAB42A983443D896627389 /* Pods-walletTests-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-walletTests-acknowledgements.plist"; sourceTree = ""; }; + 53D13D19D0859851C54DD32C1AFF1F33 /* UnsafeBufferPointer+Shims.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UnsafeBufferPointer+Shims.swift"; path = "Sources/SwiftProtobuf/UnsafeBufferPointer+Shims.swift"; sourceTree = ""; }; + 559D830AF59FC263E3F21CD068910622 /* SwiftProtobuf.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = SwiftProtobuf.release.xcconfig; sourceTree = ""; }; + 56DFDAD8BC9A9D2290585787C5E9EF55 /* QR-Code-Scanner-iOS.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = "QR-Code-Scanner-iOS.modulemap"; sourceTree = ""; }; + 5CACAD72AD50B6D7BA588D9BA5C84769 /* DoubleParser.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DoubleParser.swift; path = Sources/SwiftProtobuf/DoubleParser.swift; sourceTree = ""; }; + 5EC110A9A3864E27A84856FD38556F84 /* Google_Protobuf_Duration+Extensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Google_Protobuf_Duration+Extensions.swift"; path = "Sources/SwiftProtobuf/Google_Protobuf_Duration+Extensions.swift"; sourceTree = ""; }; + 5F1B0277965AF8FA4731E9A99F16B7A8 /* QR-Code-Scanner-iOS-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "QR-Code-Scanner-iOS-dummy.m"; sourceTree = ""; }; + 605F05678934B0060EFE53E755B81217 /* JSONScanner.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = JSONScanner.swift; path = Sources/SwiftProtobuf/JSONScanner.swift; sourceTree = ""; }; + 62C5EE0699B3F17C0E58843F507466AB /* JSONMapEncodingVisitor.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = JSONMapEncodingVisitor.swift; path = Sources/SwiftProtobuf/JSONMapEncodingVisitor.swift; sourceTree = ""; }; + 69C4FC4FCE7681D782B70631E1D223ED /* HashVisitor.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = HashVisitor.swift; path = Sources/SwiftProtobuf/HashVisitor.swift; sourceTree = ""; }; + 6FF07A4433E8D23B15C840AAB8567709 /* Google_Protobuf_Any+Registry.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Google_Protobuf_Any+Registry.swift"; path = "Sources/SwiftProtobuf/Google_Protobuf_Any+Registry.swift"; sourceTree = ""; }; + 70E43AA065F0FA1593C0F40AB3077C40 /* Pods-wallet-walletUITests-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-wallet-walletUITests-dummy.m"; sourceTree = ""; }; + 7219DF0DEC97C9EDB4FD1BD954ABCAF2 /* BinaryEncodingVisitor.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BinaryEncodingVisitor.swift; path = Sources/SwiftProtobuf/BinaryEncodingVisitor.swift; sourceTree = ""; }; + 73010CC983E3809BECEE5348DA1BB8C6 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; + 76A954A2B9F622977E9F95292556BC1E /* FieldTag.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = FieldTag.swift; path = Sources/SwiftProtobuf/FieldTag.swift; sourceTree = ""; }; + 7836032CE48C4FE7577A97016C1B5875 /* Pods-wallet-walletUITests-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-wallet-walletUITests-frameworks.sh"; sourceTree = ""; }; + 7B62C2B5AD0FEA378724B7F524250995 /* Pods-wallet-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-wallet-acknowledgements.plist"; sourceTree = ""; }; + 7B7EAB017C37BB81ED28BF38F9D71D21 /* Internal.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Internal.swift; path = Sources/SwiftProtobuf/Internal.swift; sourceTree = ""; }; + 7F68E2F231CA2243B996937C5C967EF0 /* ProtobufMap.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ProtobufMap.swift; path = Sources/SwiftProtobuf/ProtobufMap.swift; sourceTree = ""; }; + 81A25B994CA2A077E5771214360CB6B0 /* ExtensionFields.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ExtensionFields.swift; path = Sources/SwiftProtobuf/ExtensionFields.swift; sourceTree = ""; }; + 81A45384096C8231E5AA62A9DD176CD8 /* Pods-walletTests-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-walletTests-acknowledgements.markdown"; sourceTree = ""; }; + 81F6EA7ECF729B2C368B84F595B0F461 /* SwiftProtobuf-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "SwiftProtobuf-Info.plist"; sourceTree = ""; }; + 89B9B2625D619AC1AC946DBC9A307E28 /* FieldTypes.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = FieldTypes.swift; path = Sources/SwiftProtobuf/FieldTypes.swift; sourceTree = ""; }; + 8BEDCB305E59098B83712A529C35EC69 /* SwiftProtobuf-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "SwiftProtobuf-umbrella.h"; sourceTree = ""; }; + 8EB487DE3F50B616591A9E1876333C81 /* TextFormatDecoder.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TextFormatDecoder.swift; path = Sources/SwiftProtobuf/TextFormatDecoder.swift; sourceTree = ""; }; + 8F48640CEE3CF4873C0893D6B6B40B19 /* UnknownStorage.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = UnknownStorage.swift; path = Sources/SwiftProtobuf/UnknownStorage.swift; sourceTree = ""; }; + 943D347E61A2E181A4FA2CA894307B6E /* SwiftProtobuf */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = SwiftProtobuf; path = SwiftProtobuf.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 948908C4840BFB19553A504F51C52567 /* Google_Protobuf_FieldMask+Extensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Google_Protobuf_FieldMask+Extensions.swift"; path = "Sources/SwiftProtobuf/Google_Protobuf_FieldMask+Extensions.swift"; sourceTree = ""; }; + 94D72469D83B8C1C9523DAEFCBD81A6D /* TextFormatEncodingOptions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TextFormatEncodingOptions.swift; path = Sources/SwiftProtobuf/TextFormatEncodingOptions.swift; sourceTree = ""; }; + 95F73997DBE54920D1A436F21F4F7191 /* Version.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Version.swift; path = Sources/SwiftProtobuf/Version.swift; sourceTree = ""; }; + 9647EFC698ED930B5F4BAFFB486D0175 /* CameraAccessDeniedViewController.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CameraAccessDeniedViewController.swift; path = "QR Code Scanner/CameraAccessDeniedViewController.swift"; sourceTree = ""; }; + 9750965B91F52686C14631C8C6AAC674 /* Google_Protobuf_Wrappers+Extensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Google_Protobuf_Wrappers+Extensions.swift"; path = "Sources/SwiftProtobuf/Google_Protobuf_Wrappers+Extensions.swift"; sourceTree = ""; }; + 98AA3151C1F066641891135CC143FA2D /* Pods-wallet-walletUITests-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-wallet-walletUITests-acknowledgements.markdown"; sourceTree = ""; }; + 998B69803EED73756D59F1EBBDFE6B3D /* Pods-walletTests.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = "Pods-walletTests.modulemap"; sourceTree = ""; }; + 9A90A2ABD3E51DA1529ABA5B09999520 /* JSONEncoder.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = JSONEncoder.swift; path = Sources/SwiftProtobuf/JSONEncoder.swift; sourceTree = ""; }; + 9C7249A73E69715C97EC34D93A7BC8EF /* ExtensionMap.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ExtensionMap.swift; path = Sources/SwiftProtobuf/ExtensionMap.swift; sourceTree = ""; }; + 9D69CC2C320976FD87984360B059A93F /* any.pb.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = any.pb.swift; path = Sources/SwiftProtobuf/any.pb.swift; sourceTree = ""; }; + 9D940727FF8FB9C785EB98E56350EF41 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; indentWidth = 2; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; tabWidth = 2; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; + A124F2F6D600A29EE2F67311F97F93A4 /* BinaryEncodingError.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BinaryEncodingError.swift; path = Sources/SwiftProtobuf/BinaryEncodingError.swift; sourceTree = ""; }; + A2EB6DB721A4C42BFFDCD7A945132EFD /* Pods-wallet-walletUITests-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-wallet-walletUITests-Info.plist"; sourceTree = ""; }; + A368C8AB1A5DE0C60CECF6693284948F /* BinaryDecoder.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BinaryDecoder.swift; path = Sources/SwiftProtobuf/BinaryDecoder.swift; sourceTree = ""; }; + A6FF1CEF2ABD6DFC91D71EAC395FBA21 /* Message+JSONArrayAdditions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Message+JSONArrayAdditions.swift"; path = "Sources/SwiftProtobuf/Message+JSONArrayAdditions.swift"; sourceTree = ""; }; + AF96E25BEEA28D79B304E1ADA94049F2 /* SelectiveVisitor.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SelectiveVisitor.swift; path = Sources/SwiftProtobuf/SelectiveVisitor.swift; sourceTree = ""; }; + B041A8B43E51082A8B6D9660FCF394E6 /* wrappers.pb.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = wrappers.pb.swift; path = Sources/SwiftProtobuf/wrappers.pb.swift; sourceTree = ""; }; + B49A1710606C975AC93FB24A0E10FF59 /* Pods-walletTests-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-walletTests-Info.plist"; sourceTree = ""; }; + BB3DE43496A80847AB22332BBE607408 /* CustomJSONCodable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CustomJSONCodable.swift; path = Sources/SwiftProtobuf/CustomJSONCodable.swift; sourceTree = ""; }; + BE3613E5B364ACA4F5DD2AD79D41A0A0 /* ExtensionFieldValueSet.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ExtensionFieldValueSet.swift; path = Sources/SwiftProtobuf/ExtensionFieldValueSet.swift; sourceTree = ""; }; + BF3337E940A069FFC19732C60373B722 /* SwiftProtobuf.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = SwiftProtobuf.debug.xcconfig; sourceTree = ""; }; + C1E06B11647E1ECF744F0BBB0E29195F /* BinaryEncoder.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BinaryEncoder.swift; path = Sources/SwiftProtobuf/BinaryEncoder.swift; sourceTree = ""; }; + C25EB6FDECC8D2CBC210DF1BC213E6F1 /* Media.xcassets */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = folder.assetcatalog; name = Media.xcassets; path = "QR Code Scanner/Media.xcassets"; sourceTree = ""; }; + C3AFCBB9CA485048941CC3AC78D51D15 /* JSONDecoder.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = JSONDecoder.swift; path = Sources/SwiftProtobuf/JSONDecoder.swift; sourceTree = ""; }; + C3BCA840F5066F30A8C7D03900CE0BF5 /* SwiftProtobuf-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "SwiftProtobuf-dummy.m"; sourceTree = ""; }; + C3C6AED543073CAE27F3C809E087D069 /* Pods-walletTests-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-walletTests-dummy.m"; sourceTree = ""; }; + C5789E10300FB3742C9A86D10A24B4DE /* Pods-wallet-walletUITests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-wallet-walletUITests.release.xcconfig"; sourceTree = ""; }; + C59C6705C67D9D3DDFE193077C92B670 /* struct.pb.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = struct.pb.swift; path = Sources/SwiftProtobuf/struct.pb.swift; sourceTree = ""; }; + C9F2C1F274FF04EB8EB1128D4178082A /* field_mask.pb.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = field_mask.pb.swift; path = Sources/SwiftProtobuf/field_mask.pb.swift; sourceTree = ""; }; + CBE319C957EC7C5F36BF9F10B2F05123 /* AnyMessageStorage.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AnyMessageStorage.swift; path = Sources/SwiftProtobuf/AnyMessageStorage.swift; sourceTree = ""; }; + CD2ADB954905505378D55F9DA59DA719 /* BinaryDecodingOptions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BinaryDecodingOptions.swift; path = Sources/SwiftProtobuf/BinaryDecodingOptions.swift; sourceTree = ""; }; + CF5F5FC4D4C0DA13E8E46DF1E3FC3867 /* SwiftProtobuf.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = SwiftProtobuf.modulemap; sourceTree = ""; }; + D12832E3D8BBE833BFA402032AEF71CC /* type.pb.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = type.pb.swift; path = Sources/SwiftProtobuf/type.pb.swift; sourceTree = ""; }; + D22D8DCFB29502868358A0E07B2CA255 /* Varint.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Varint.swift; path = Sources/SwiftProtobuf/Varint.swift; sourceTree = ""; }; + D29CD50D2E483CB3637F96580B11A597 /* QR-Code-Scanner-iOS-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "QR-Code-Scanner-iOS-Info.plist"; sourceTree = ""; }; + D29CFEA8F1426990C51D0EFE3C9E5822 /* TextFormatEncodingVisitor.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TextFormatEncodingVisitor.swift; path = Sources/SwiftProtobuf/TextFormatEncodingVisitor.swift; sourceTree = ""; }; + D3144F7AB4C02BC805E43145B984FF09 /* Pods-wallet-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-wallet-umbrella.h"; sourceTree = ""; }; + D3814349F80753B782BDF4C7EB4CDEC0 /* Pods-walletTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-walletTests.debug.xcconfig"; sourceTree = ""; }; + D3D6D365D822D6333E2486CA053E6904 /* JSONEncodingOptions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = JSONEncodingOptions.swift; path = Sources/SwiftProtobuf/JSONEncodingOptions.swift; sourceTree = ""; }; + D4B7CC104291A2F3CC15179A8BB683A8 /* TextFormatEncoder.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TextFormatEncoder.swift; path = Sources/SwiftProtobuf/TextFormatEncoder.swift; sourceTree = ""; }; + D63F28F0B3AB6C22B82E19BBDA24F3FE /* ProtoNameProviding.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ProtoNameProviding.swift; path = Sources/SwiftProtobuf/ProtoNameProviding.swift; sourceTree = ""; }; + D6904164B45010312C0A941DD39550BD /* Enum.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Enum.swift; path = Sources/SwiftProtobuf/Enum.swift; sourceTree = ""; }; + D733B58250CDBAD1484A3124B207CE05 /* source_context.pb.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = source_context.pb.swift; path = Sources/SwiftProtobuf/source_context.pb.swift; sourceTree = ""; }; + D91E3082C3A52834CC167F5EC2757029 /* Decoder.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Decoder.swift; path = Sources/SwiftProtobuf/Decoder.swift; sourceTree = ""; }; + DCA65E90899F1919B0AFE002BD1C17F0 /* Pods-walletTests-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-walletTests-umbrella.h"; sourceTree = ""; }; + E2632A62A2EA47B332CA87CEDA1D61A9 /* SimpleExtensionMap.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SimpleExtensionMap.swift; path = Sources/SwiftProtobuf/SimpleExtensionMap.swift; sourceTree = ""; }; + E2BE3DA63AE294FDA05BCA38CACD5F37 /* Message+TextFormatAdditions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Message+TextFormatAdditions.swift"; path = "Sources/SwiftProtobuf/Message+TextFormatAdditions.swift"; sourceTree = ""; }; + E8EF2888FFEC0CB182048C614BF549A1 /* Data+Extensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Data+Extensions.swift"; path = "Sources/SwiftProtobuf/Data+Extensions.swift"; sourceTree = ""; }; + EAB8F3DBD00E98B44AE7CDEB82CF96A1 /* QRCodeScanViewController.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = QRCodeScanViewController.swift; path = "QR Code Scanner/QRCodeScanViewController.swift"; sourceTree = ""; }; + EB76A38EFE53B80D00548C6C9F92A16A /* BinaryEncodingSizeVisitor.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BinaryEncodingSizeVisitor.swift; path = Sources/SwiftProtobuf/BinaryEncodingSizeVisitor.swift; sourceTree = ""; }; + EDE4459F0F0929C676B04B8B9149DBCC /* api.pb.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = api.pb.swift; path = Sources/SwiftProtobuf/api.pb.swift; sourceTree = ""; }; + F100D8FD92D188113F02465318C5C223 /* TimeUtils.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TimeUtils.swift; path = Sources/SwiftProtobuf/TimeUtils.swift; sourceTree = ""; }; + F38640DF8D52C77AF07ED4BCD5FD2702 /* QR-Code-Scanner-iOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "QR-Code-Scanner-iOS.release.xcconfig"; sourceTree = ""; }; + F438C2022FCB92E3936976FEB0ECF3C2 /* timestamp.pb.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = timestamp.pb.swift; path = Sources/SwiftProtobuf/timestamp.pb.swift; sourceTree = ""; }; + F6438060F08A1F9400680666F350A806 /* JSONEncodingVisitor.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = JSONEncodingVisitor.swift; path = Sources/SwiftProtobuf/JSONEncodingVisitor.swift; sourceTree = ""; }; + F6462A848E6AD69B9E0C9EAF224CA184 /* WireFormat.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = WireFormat.swift; path = Sources/SwiftProtobuf/WireFormat.swift; sourceTree = ""; }; + F67EAC0CDBCE7D9D07F460D1889A830C /* Pods-wallet-walletUITests-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-wallet-walletUITests-umbrella.h"; sourceTree = ""; }; + F8C6E60118976A1C5FF6015FBC859179 /* Google_Protobuf_ListValue+Extensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Google_Protobuf_ListValue+Extensions.swift"; path = "Sources/SwiftProtobuf/Google_Protobuf_ListValue+Extensions.swift"; sourceTree = ""; }; + F9235CB92060D1C5F116126D488B26E4 /* AnyUnpackError.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AnyUnpackError.swift; path = Sources/SwiftProtobuf/AnyUnpackError.swift; sourceTree = ""; }; + F9DFC5F3F2867C86F51125E0B9AB38D4 /* duration.pb.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = duration.pb.swift; path = Sources/SwiftProtobuf/duration.pb.swift; sourceTree = ""; }; + FA0B06BFFD06E4721A976A2A55E84115 /* Pods-wallet-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-wallet-frameworks.sh"; sourceTree = ""; }; + FB9B807A42D7F1E9DC7132DA2CE6AFB4 /* Pods-wallet-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-wallet-dummy.m"; sourceTree = ""; }; + FBE77BC35F99D4A17F7F7D4C1ECE07C2 /* TextFormatScanner.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TextFormatScanner.swift; path = Sources/SwiftProtobuf/TextFormatScanner.swift; sourceTree = ""; }; + FF5E7AC680CC33CA5EA6F84988BC3FFF /* ExtensibleMessage.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ExtensibleMessage.swift; path = Sources/SwiftProtobuf/ExtensibleMessage.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 20C1E820D9317729EAB50C225005B518 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 8E871C1C7ACDFD1A14337B22475320B2 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 29F6158AAB1238A4A7DD124FCDB4F811 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 52205B13CDE7FB35BE4BFCF75C93F7ED /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 6FD464D4032AC35A5884E841EC8B0248 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + AFE29667448E06D24C5AB884DC4F9AC0 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 814FE815A5B563CD5DA34A04ED08A674 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + CFF2D2090B0177BE98EBD24962A3F986 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + E62B61576CE79426208E274DDAA945BC /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + E2D31368CF29470F154AC9E45E6DEB34 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 0108D80881F1BD2068066318DC5AF13B /* Pods */ = { + isa = PBXGroup; + children = ( + FF9B36669E6595B72145615CD4377EC6 /* QR-Code-Scanner-iOS */, + 1B0246D1C57CA4C818DAAFCBE969A28B /* SwiftProtobuf */, + ); + name = Pods; + sourceTree = ""; + }; + 1B0246D1C57CA4C818DAAFCBE969A28B /* SwiftProtobuf */ = { + isa = PBXGroup; + children = ( + 9D69CC2C320976FD87984360B059A93F /* any.pb.swift */, + CBE319C957EC7C5F36BF9F10B2F05123 /* AnyMessageStorage.swift */, + F9235CB92060D1C5F116126D488B26E4 /* AnyUnpackError.swift */, + EDE4459F0F0929C676B04B8B9149DBCC /* api.pb.swift */, + A368C8AB1A5DE0C60CECF6693284948F /* BinaryDecoder.swift */, + 1E50D6E7E6825DB06F608439CA67F227 /* BinaryDecodingError.swift */, + CD2ADB954905505378D55F9DA59DA719 /* BinaryDecodingOptions.swift */, + 52BBFFDDA2380867DE18A9EB1ABC2A08 /* BinaryDelimited.swift */, + C1E06B11647E1ECF744F0BBB0E29195F /* BinaryEncoder.swift */, + A124F2F6D600A29EE2F67311F97F93A4 /* BinaryEncodingError.swift */, + EB76A38EFE53B80D00548C6C9F92A16A /* BinaryEncodingSizeVisitor.swift */, + 7219DF0DEC97C9EDB4FD1BD954ABCAF2 /* BinaryEncodingVisitor.swift */, + BB3DE43496A80847AB22332BBE607408 /* CustomJSONCodable.swift */, + E8EF2888FFEC0CB182048C614BF549A1 /* Data+Extensions.swift */, + D91E3082C3A52834CC167F5EC2757029 /* Decoder.swift */, + 3EDB46DC1A2D4D5E5DDB4D10E36B3F06 /* descriptor.pb.swift */, + 5CACAD72AD50B6D7BA588D9BA5C84769 /* DoubleParser.swift */, + F9DFC5F3F2867C86F51125E0B9AB38D4 /* duration.pb.swift */, + 2090058E1F53C1427C5B31D537367B64 /* empty.pb.swift */, + D6904164B45010312C0A941DD39550BD /* Enum.swift */, + FF5E7AC680CC33CA5EA6F84988BC3FFF /* ExtensibleMessage.swift */, + 81A25B994CA2A077E5771214360CB6B0 /* ExtensionFields.swift */, + BE3613E5B364ACA4F5DD2AD79D41A0A0 /* ExtensionFieldValueSet.swift */, + 9C7249A73E69715C97EC34D93A7BC8EF /* ExtensionMap.swift */, + C9F2C1F274FF04EB8EB1128D4178082A /* field_mask.pb.swift */, + 76A954A2B9F622977E9F95292556BC1E /* FieldTag.swift */, + 89B9B2625D619AC1AC946DBC9A307E28 /* FieldTypes.swift */, + 282292677D72F65EB7AA919E2AF3E8BB /* Google_Protobuf_Any+Extensions.swift */, + 6FF07A4433E8D23B15C840AAB8567709 /* Google_Protobuf_Any+Registry.swift */, + 5EC110A9A3864E27A84856FD38556F84 /* Google_Protobuf_Duration+Extensions.swift */, + 948908C4840BFB19553A504F51C52567 /* Google_Protobuf_FieldMask+Extensions.swift */, + F8C6E60118976A1C5FF6015FBC859179 /* Google_Protobuf_ListValue+Extensions.swift */, + 1CA12395CAB6A820E9DCF27989D70824 /* Google_Protobuf_NullValue+Extensions.swift */, + 46BD9E9B234B3E8203F476AFE623F614 /* Google_Protobuf_Struct+Extensions.swift */, + 302A85D57581D1E962C57C82EC81B2C0 /* Google_Protobuf_Timestamp+Extensions.swift */, + 24B0565A60D0E7BB38FC98CB0357CC09 /* Google_Protobuf_Value+Extensions.swift */, + 9750965B91F52686C14631C8C6AAC674 /* Google_Protobuf_Wrappers+Extensions.swift */, + 69C4FC4FCE7681D782B70631E1D223ED /* HashVisitor.swift */, + 7B7EAB017C37BB81ED28BF38F9D71D21 /* Internal.swift */, + C3AFCBB9CA485048941CC3AC78D51D15 /* JSONDecoder.swift */, + 42B18CEE14A926A1D737DFDE339CA34C /* JSONDecodingError.swift */, + 2BB456CB2AA42CE47AE5E701ABF8D2F6 /* JSONDecodingOptions.swift */, + 9A90A2ABD3E51DA1529ABA5B09999520 /* JSONEncoder.swift */, + 2168F4567273D66C8A3A8199AEF72BCF /* JSONEncodingError.swift */, + D3D6D365D822D6333E2486CA053E6904 /* JSONEncodingOptions.swift */, + F6438060F08A1F9400680666F350A806 /* JSONEncodingVisitor.swift */, + 62C5EE0699B3F17C0E58843F507466AB /* JSONMapEncodingVisitor.swift */, + 605F05678934B0060EFE53E755B81217 /* JSONScanner.swift */, + 456198322B26C30D0A12C3AB4898A7E2 /* MathUtils.swift */, + 40EB0A2168BEC68E987A2B185377E610 /* Message.swift */, + 1D31872E4717078FDCBCAF8B527CE287 /* Message+AnyAdditions.swift */, + 376E5DDF2750E1BADD96BBB02D9C6E73 /* Message+BinaryAdditions.swift */, + 1AC3B31993B2BA6EF1F1CE36F4ACD6BD /* Message+JSONAdditions.swift */, + A6FF1CEF2ABD6DFC91D71EAC395FBA21 /* Message+JSONArrayAdditions.swift */, + E2BE3DA63AE294FDA05BCA38CACD5F37 /* Message+TextFormatAdditions.swift */, + 25B4608416254A3EA09D005DC4550AC0 /* MessageExtension.swift */, + 2173873BC233ACB0DC0E59214CC206F4 /* NameMap.swift */, + 3CF00CDD8187667438863FCF3FB1E7F4 /* ProtobufAPIVersionCheck.swift */, + 7F68E2F231CA2243B996937C5C967EF0 /* ProtobufMap.swift */, + D63F28F0B3AB6C22B82E19BBDA24F3FE /* ProtoNameProviding.swift */, + AF96E25BEEA28D79B304E1ADA94049F2 /* SelectiveVisitor.swift */, + E2632A62A2EA47B332CA87CEDA1D61A9 /* SimpleExtensionMap.swift */, + D733B58250CDBAD1484A3124B207CE05 /* source_context.pb.swift */, + 3306EE85AC157C7FE1C963999EBCEABA /* StringUtils.swift */, + C59C6705C67D9D3DDFE193077C92B670 /* struct.pb.swift */, + 8EB487DE3F50B616591A9E1876333C81 /* TextFormatDecoder.swift */, + 4172F34D77D834FBE1282BF52D7BF2B5 /* TextFormatDecodingError.swift */, + D4B7CC104291A2F3CC15179A8BB683A8 /* TextFormatEncoder.swift */, + 94D72469D83B8C1C9523DAEFCBD81A6D /* TextFormatEncodingOptions.swift */, + D29CFEA8F1426990C51D0EFE3C9E5822 /* TextFormatEncodingVisitor.swift */, + FBE77BC35F99D4A17F7F7D4C1ECE07C2 /* TextFormatScanner.swift */, + F438C2022FCB92E3936976FEB0ECF3C2 /* timestamp.pb.swift */, + F100D8FD92D188113F02465318C5C223 /* TimeUtils.swift */, + D12832E3D8BBE833BFA402032AEF71CC /* type.pb.swift */, + 8F48640CEE3CF4873C0893D6B6B40B19 /* UnknownStorage.swift */, + 53D13D19D0859851C54DD32C1AFF1F33 /* UnsafeBufferPointer+Shims.swift */, + 1AB9C729C46FDF122902DB35E8E15CDF /* UnsafeRawPointer+Shims.swift */, + D22D8DCFB29502868358A0E07B2CA255 /* Varint.swift */, + 95F73997DBE54920D1A436F21F4F7191 /* Version.swift */, + 3ABCD0835232C027ABC46D7464650325 /* Visitor.swift */, + F6462A848E6AD69B9E0C9EAF224CA184 /* WireFormat.swift */, + B041A8B43E51082A8B6D9660FCF394E6 /* wrappers.pb.swift */, + 2ED1632A277ACFED961A0D774C0B7508 /* ZigZag.swift */, + 7188BC6571DEC9280F75F7C10E0A7EC0 /* Support Files */, + ); + name = SwiftProtobuf; + path = SwiftProtobuf; + sourceTree = ""; + }; + 3A91E86E11A1EB46F1B8883F181101CC /* Pods-wallet-walletUITests */ = { + isa = PBXGroup; + children = ( + 53234C0447207D077919CBBAF6B0DE0F /* Pods-wallet-walletUITests.modulemap */, + 98AA3151C1F066641891135CC143FA2D /* Pods-wallet-walletUITests-acknowledgements.markdown */, + 00E005EC429ED62580BDE52DF4D1BFC0 /* Pods-wallet-walletUITests-acknowledgements.plist */, + 70E43AA065F0FA1593C0F40AB3077C40 /* Pods-wallet-walletUITests-dummy.m */, + 7836032CE48C4FE7577A97016C1B5875 /* Pods-wallet-walletUITests-frameworks.sh */, + A2EB6DB721A4C42BFFDCD7A945132EFD /* Pods-wallet-walletUITests-Info.plist */, + F67EAC0CDBCE7D9D07F460D1889A830C /* Pods-wallet-walletUITests-umbrella.h */, + 0717CEB42AB9900F55F2D13B8E2B9EE3 /* Pods-wallet-walletUITests.debug.xcconfig */, + C5789E10300FB3742C9A86D10A24B4DE /* Pods-wallet-walletUITests.release.xcconfig */, + ); + name = "Pods-wallet-walletUITests"; + path = "Target Support Files/Pods-wallet-walletUITests"; + sourceTree = ""; + }; + 414E75D3ED2358F587514D6F925368D9 /* Resources */ = { + isa = PBXGroup; + children = ( + C25EB6FDECC8D2CBC210DF1BC213E6F1 /* Media.xcassets */, + 10E5C02EDDCC1032D8269E48A0BB159C /* QRCode.storyboard */, + ); + name = Resources; + sourceTree = ""; + }; + 578452D2E740E91742655AC8F1636D1F /* iOS */ = { + isa = PBXGroup; + children = ( + 73010CC983E3809BECEE5348DA1BB8C6 /* Foundation.framework */, + ); + name = iOS; + sourceTree = ""; + }; + 66863EFC1A724605F53463CC05614007 /* Targets Support Files */ = { + isa = PBXGroup; + children = ( + ADC7354609FE4CBF64914B0989BE1B52 /* Pods-wallet */, + 3A91E86E11A1EB46F1B8883F181101CC /* Pods-wallet-walletUITests */, + FBD4E32D1D2849C377213C4489B7F53B /* Pods-walletTests */, + ); + name = "Targets Support Files"; + sourceTree = ""; + }; + 7188BC6571DEC9280F75F7C10E0A7EC0 /* Support Files */ = { + isa = PBXGroup; + children = ( + CF5F5FC4D4C0DA13E8E46DF1E3FC3867 /* SwiftProtobuf.modulemap */, + C3BCA840F5066F30A8C7D03900CE0BF5 /* SwiftProtobuf-dummy.m */, + 81F6EA7ECF729B2C368B84F595B0F461 /* SwiftProtobuf-Info.plist */, + 39A9C71366A0006B610DD7A2B84618CB /* SwiftProtobuf-prefix.pch */, + 8BEDCB305E59098B83712A529C35EC69 /* SwiftProtobuf-umbrella.h */, + BF3337E940A069FFC19732C60373B722 /* SwiftProtobuf.debug.xcconfig */, + 559D830AF59FC263E3F21CD068910622 /* SwiftProtobuf.release.xcconfig */, + ); + name = "Support Files"; + path = "../Target Support Files/SwiftProtobuf"; + sourceTree = ""; + }; + 9E1456163B8DB92A83F14A0CE979DF20 /* Support Files */ = { + isa = PBXGroup; + children = ( + 56DFDAD8BC9A9D2290585787C5E9EF55 /* QR-Code-Scanner-iOS.modulemap */, + 5F1B0277965AF8FA4731E9A99F16B7A8 /* QR-Code-Scanner-iOS-dummy.m */, + D29CD50D2E483CB3637F96580B11A597 /* QR-Code-Scanner-iOS-Info.plist */, + 30F601AF6F1C6FB41592D030E94A63CC /* QR-Code-Scanner-iOS-prefix.pch */, + 3014866D96C746894FD0F085E09B6F30 /* QR-Code-Scanner-iOS-umbrella.h */, + 128311B4E8A2B7867C77E940FD437AF4 /* QR-Code-Scanner-iOS.debug.xcconfig */, + F38640DF8D52C77AF07ED4BCD5FD2702 /* QR-Code-Scanner-iOS.release.xcconfig */, + ); + name = "Support Files"; + path = "../Target Support Files/QR-Code-Scanner-iOS"; + sourceTree = ""; + }; + ADC7354609FE4CBF64914B0989BE1B52 /* Pods-wallet */ = { + isa = PBXGroup; + children = ( + 2307380895EA03CB1091251F2E7E8D74 /* Pods-wallet.modulemap */, + 21E5CC407327A9A9EFA597E5CF95461A /* Pods-wallet-acknowledgements.markdown */, + 7B62C2B5AD0FEA378724B7F524250995 /* Pods-wallet-acknowledgements.plist */, + FB9B807A42D7F1E9DC7132DA2CE6AFB4 /* Pods-wallet-dummy.m */, + FA0B06BFFD06E4721A976A2A55E84115 /* Pods-wallet-frameworks.sh */, + 430C217AF2FEAADF28B000D51D6C6EDA /* Pods-wallet-Info.plist */, + D3144F7AB4C02BC805E43145B984FF09 /* Pods-wallet-umbrella.h */, + 09ED74926D1582CBAB28921A1C37CD82 /* Pods-wallet.debug.xcconfig */, + 24F1A5AA46C57511EDA0D8F97143CFE0 /* Pods-wallet.release.xcconfig */, + ); + name = "Pods-wallet"; + path = "Target Support Files/Pods-wallet"; + sourceTree = ""; + }; + CF1408CF629C7361332E53B88F7BD30C = { + isa = PBXGroup; + children = ( + 9D940727FF8FB9C785EB98E56350EF41 /* Podfile */, + D210D550F4EA176C3123ED886F8F87F5 /* Frameworks */, + 0108D80881F1BD2068066318DC5AF13B /* Pods */, + E03D00D9EA49249946EA99090CFA021E /* Products */, + 66863EFC1A724605F53463CC05614007 /* Targets Support Files */, + ); + sourceTree = ""; + }; + D210D550F4EA176C3123ED886F8F87F5 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 578452D2E740E91742655AC8F1636D1F /* iOS */, + ); + name = Frameworks; + sourceTree = ""; + }; + E03D00D9EA49249946EA99090CFA021E /* Products */ = { + isa = PBXGroup; + children = ( + 1BEA97957E4061D5113A323E0C7DEAB9 /* Pods-wallet */, + 085B6CB08733B092E08180A2B71E304C /* Pods-wallet-walletUITests */, + 00170BBF77840F17C6E4F8EF78DAE68D /* Pods-walletTests */, + 17E0DF26CAEBF457A37AEE7B17392958 /* QR-Code-Scanner-iOS */, + 943D347E61A2E181A4FA2CA894307B6E /* SwiftProtobuf */, + ); + name = Products; + sourceTree = ""; + }; + FBD4E32D1D2849C377213C4489B7F53B /* Pods-walletTests */ = { + isa = PBXGroup; + children = ( + 998B69803EED73756D59F1EBBDFE6B3D /* Pods-walletTests.modulemap */, + 81A45384096C8231E5AA62A9DD176CD8 /* Pods-walletTests-acknowledgements.markdown */, + 539442DA05EAB42A983443D896627389 /* Pods-walletTests-acknowledgements.plist */, + C3C6AED543073CAE27F3C809E087D069 /* Pods-walletTests-dummy.m */, + B49A1710606C975AC93FB24A0E10FF59 /* Pods-walletTests-Info.plist */, + DCA65E90899F1919B0AFE002BD1C17F0 /* Pods-walletTests-umbrella.h */, + D3814349F80753B782BDF4C7EB4CDEC0 /* Pods-walletTests.debug.xcconfig */, + 3B2666C84AFACA90A2B873D09AB132E3 /* Pods-walletTests.release.xcconfig */, + ); + name = "Pods-walletTests"; + path = "Target Support Files/Pods-walletTests"; + sourceTree = ""; + }; + FF9B36669E6595B72145615CD4377EC6 /* QR-Code-Scanner-iOS */ = { + isa = PBXGroup; + children = ( + 9647EFC698ED930B5F4BAFFB486D0175 /* CameraAccessDeniedViewController.swift */, + EAB8F3DBD00E98B44AE7CDEB82CF96A1 /* QRCodeScanViewController.swift */, + 414E75D3ED2358F587514D6F925368D9 /* Resources */, + 9E1456163B8DB92A83F14A0CE979DF20 /* Support Files */, + ); + name = "QR-Code-Scanner-iOS"; + path = "QR-Code-Scanner-iOS"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 3D435FE655D7EB1A29E1BF1DE5572C41 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + B7C1AC40079FDCCFBC50E015824815D5 /* Pods-walletTests-umbrella.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 6387D989CF1BC556DA4D572C4EE36989 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + F47D92094BBC730646D251DA440F8250 /* QR-Code-Scanner-iOS-umbrella.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 67A3CCC0397FB68D89968C42B849882E /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + F84CD37245C16382A95AEDA48F9268A6 /* SwiftProtobuf-umbrella.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 829613F4CE40DC15703F37D6CD46EB97 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + A6460786CF9CA3C53BCD7A2651280914 /* Pods-wallet-umbrella.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + F69957CF67B1812A6699BDF429401FD5 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + BD0A958B00C37DA756D950084EA57B52 /* Pods-wallet-walletUITests-umbrella.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 03F8264CAE2EC0684FD64871C2FF793E /* QR-Code-Scanner-iOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = 60A33BB80E78B9C7E100C498C93D22C1 /* Build configuration list for PBXNativeTarget "QR-Code-Scanner-iOS" */; + buildPhases = ( + 6387D989CF1BC556DA4D572C4EE36989 /* Headers */, + 842B855D5E2D5BC2A395D9F32E978AF2 /* Sources */, + 814FE815A5B563CD5DA34A04ED08A674 /* Frameworks */, + E98F0C39137B9E9EEDDAEA62F7BAC77C /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "QR-Code-Scanner-iOS"; + productName = QRCodeScanner; + productReference = 17E0DF26CAEBF457A37AEE7B17392958 /* QR-Code-Scanner-iOS */; + productType = "com.apple.product-type.framework"; + }; + 4179979D0E7E44B4D103FAD5DF24E7E8 /* Pods-wallet */ = { + isa = PBXNativeTarget; + buildConfigurationList = 4A167D96767B9A63C2DD4AFB9D42FB02 /* Build configuration list for PBXNativeTarget "Pods-wallet" */; + buildPhases = ( + 829613F4CE40DC15703F37D6CD46EB97 /* Headers */, + C581D001424DEA1903AC6EC0825F3C93 /* Sources */, + E62B61576CE79426208E274DDAA945BC /* Frameworks */, + 88F542AB49990A7688CBBEED624B6D66 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 291A8C4949263EC203B0970FCD48BE84 /* PBXTargetDependency */, + 03E11F4822AE5C7C12B0DB6728C77A57 /* PBXTargetDependency */, + ); + name = "Pods-wallet"; + productName = Pods_wallet; + productReference = 1BEA97957E4061D5113A323E0C7DEAB9 /* Pods-wallet */; + productType = "com.apple.product-type.framework"; + }; + 693D2B0034E6B7BD37FCF5DEA7D2B0F9 /* Pods-wallet-walletUITests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 9A7B8C6FE1074681FD74F345DDEEC70E /* Build configuration list for PBXNativeTarget "Pods-wallet-walletUITests" */; + buildPhases = ( + F69957CF67B1812A6699BDF429401FD5 /* Headers */, + 4809BA422B09811476DB3B0311696687 /* Sources */, + 6FD464D4032AC35A5884E841EC8B0248 /* Frameworks */, + B962874A15AF0247C6CF287159FD3FA5 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 1232582A13A1D0181DB49F3A6537F135 /* PBXTargetDependency */, + 66777B6E1DB8313D22F584C8485F074C /* PBXTargetDependency */, + ); + name = "Pods-wallet-walletUITests"; + productName = Pods_wallet_walletUITests; + productReference = 085B6CB08733B092E08180A2B71E304C /* Pods-wallet-walletUITests */; + productType = "com.apple.product-type.framework"; + }; + A5F702E0DA383BC1479572581615A916 /* SwiftProtobuf */ = { + isa = PBXNativeTarget; + buildConfigurationList = 0EC4FBCEEE537EC6C045BC81EBB289A3 /* Build configuration list for PBXNativeTarget "SwiftProtobuf" */; + buildPhases = ( + 67A3CCC0397FB68D89968C42B849882E /* Headers */, + A9DC3355EAFAC771E8DC8BE545982FC1 /* Sources */, + 29F6158AAB1238A4A7DD124FCDB4F811 /* Frameworks */, + 7C67E42E6BA74DE7B6D206D83A8C8C8F /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = SwiftProtobuf; + productName = SwiftProtobuf; + productReference = 943D347E61A2E181A4FA2CA894307B6E /* SwiftProtobuf */; + productType = "com.apple.product-type.framework"; + }; + E41B0A6CFA9B0917167875ECF1B1A50D /* Pods-walletTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 7D824D0E344AF2F4193C4D5C5E244D31 /* Build configuration list for PBXNativeTarget "Pods-walletTests" */; + buildPhases = ( + 3D435FE655D7EB1A29E1BF1DE5572C41 /* Headers */, + 188635E74E383FBDF0EA7F021059D0B3 /* Sources */, + 20C1E820D9317729EAB50C225005B518 /* Frameworks */, + 9C527F914E53D188E040282C3D260006 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + DDDCAC4C383D6771BFC5CE5B4D9E493A /* PBXTargetDependency */, + ); + name = "Pods-walletTests"; + productName = Pods_walletTests; + productReference = 00170BBF77840F17C6E4F8EF78DAE68D /* Pods-walletTests */; + productType = "com.apple.product-type.framework"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + BFDFE7DC352907FC980B868725387E98 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1240; + LastUpgradeCheck = 1240; + }; + buildConfigurationList = 4821239608C13582E20E6DA73FD5F1F9 /* Build configuration list for PBXProject "Pods" */; + compatibilityVersion = "Xcode 10.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + Base, + en, + ); + mainGroup = CF1408CF629C7361332E53B88F7BD30C; + productRefGroup = E03D00D9EA49249946EA99090CFA021E /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 4179979D0E7E44B4D103FAD5DF24E7E8 /* Pods-wallet */, + 693D2B0034E6B7BD37FCF5DEA7D2B0F9 /* Pods-wallet-walletUITests */, + E41B0A6CFA9B0917167875ECF1B1A50D /* Pods-walletTests */, + 03F8264CAE2EC0684FD64871C2FF793E /* QR-Code-Scanner-iOS */, + A5F702E0DA383BC1479572581615A916 /* SwiftProtobuf */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 7C67E42E6BA74DE7B6D206D83A8C8C8F /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 88F542AB49990A7688CBBEED624B6D66 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 9C527F914E53D188E040282C3D260006 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B962874A15AF0247C6CF287159FD3FA5 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + E98F0C39137B9E9EEDDAEA62F7BAC77C /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + C3A2D6FCFB53A6E87A8F1151E48C9062 /* Media.xcassets in Resources */, + 909EFFCFFEA3A1479DA195D3E2376778 /* QRCode.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 188635E74E383FBDF0EA7F021059D0B3 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 5E19567D0E57401A2D6DF5A90F052D50 /* Pods-walletTests-dummy.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4809BA422B09811476DB3B0311696687 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + CECF508F06F1E7BDACB3C88FD79F0595 /* Pods-wallet-walletUITests-dummy.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 842B855D5E2D5BC2A395D9F32E978AF2 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 02C9348158E6E0582770A9A86DAF39F2 /* CameraAccessDeniedViewController.swift in Sources */, + 7C1F3D55C49E8E99564511458245B48C /* QR-Code-Scanner-iOS-dummy.m in Sources */, + 50DC4B530D2E03085FCFA77F64F28018 /* QRCodeScanViewController.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A9DC3355EAFAC771E8DC8BE545982FC1 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 0BE93E9BC271A4250AF1E2F9CBE04AF1 /* any.pb.swift in Sources */, + 325EB1D034D0A514CA1CFB6C512F2A84 /* AnyMessageStorage.swift in Sources */, + 0B075C48FAD06219B32FAF533F3F55B0 /* AnyUnpackError.swift in Sources */, + A5330425C557D0EBCC2541081EA73941 /* api.pb.swift in Sources */, + AB84E1B40107FA34740ECCC232FAD8A6 /* BinaryDecoder.swift in Sources */, + FD85E5AF6B72D9B33173452E626A1049 /* BinaryDecodingError.swift in Sources */, + ED4AB92E1D2D7CF20C2C53B7AD2CC532 /* BinaryDecodingOptions.swift in Sources */, + 0FA26C131C63B653843EF66C81B16E16 /* BinaryDelimited.swift in Sources */, + 8AF726C002AB0C6717A44F4C21B9C6E3 /* BinaryEncoder.swift in Sources */, + 2B1A4B0FC062686B3285AE2D2A970E30 /* BinaryEncodingError.swift in Sources */, + 6D917476411F5083D1B7EE65F404E39B /* BinaryEncodingSizeVisitor.swift in Sources */, + 65CBBE094D083261A315D5DE18A95E29 /* BinaryEncodingVisitor.swift in Sources */, + 19CC1192BE3F53932F19A42808AF2DBE /* CustomJSONCodable.swift in Sources */, + DD6BB823A983F099A774C4F8ACD05832 /* Data+Extensions.swift in Sources */, + 21D69507A07B9257F28036134235BC52 /* Decoder.swift in Sources */, + FCE62D4C84738D235FC0C822C11BFCFC /* descriptor.pb.swift in Sources */, + 7F393704FB1EF4919C043F43346B524D /* DoubleParser.swift in Sources */, + 83B22FC0350CC97DDA410C5B9D17ECC3 /* duration.pb.swift in Sources */, + 3484E6510D1C2A92FCC8385EBBAE877B /* empty.pb.swift in Sources */, + AA1C395D46798F2CB1279653810DC921 /* Enum.swift in Sources */, + 0A6B9F20E3D4300D2F1EFD1444927247 /* ExtensibleMessage.swift in Sources */, + 8D24AE69AD1870310B63F54125BCD08F /* ExtensionFields.swift in Sources */, + AB528F9105AA61C3A1273B6669235761 /* ExtensionFieldValueSet.swift in Sources */, + F1F3A8E96D63B61C0966491531AAEAB8 /* ExtensionMap.swift in Sources */, + 7A51348B6D71F05D6A27B25BC121668C /* field_mask.pb.swift in Sources */, + 9EBFB7F3464C1527E680479276FDE01F /* FieldTag.swift in Sources */, + 9AEBA9FBB6145412750D64924A0D53AA /* FieldTypes.swift in Sources */, + CA703181EEF7141CC95B7865678843D9 /* Google_Protobuf_Any+Extensions.swift in Sources */, + 6AE6E4ECA50F1CDC6E43F61E9B092732 /* Google_Protobuf_Any+Registry.swift in Sources */, + 3EFBE542093E25A3141BCFC0DEC7B09A /* Google_Protobuf_Duration+Extensions.swift in Sources */, + 8C6086FE07AED5AB3910F2BAECCCEE68 /* Google_Protobuf_FieldMask+Extensions.swift in Sources */, + CD9D5474B92B8C2A6FE59A9B041C7AA0 /* Google_Protobuf_ListValue+Extensions.swift in Sources */, + C70A59B0078EF6E688CC9D29238543CD /* Google_Protobuf_NullValue+Extensions.swift in Sources */, + C3AF3321F45F1C10EEDF787945A7C94D /* Google_Protobuf_Struct+Extensions.swift in Sources */, + 68658FDE33DB912350AC6EC32733C1A3 /* Google_Protobuf_Timestamp+Extensions.swift in Sources */, + 7FF66AA222BC78CCBC3D559A230E2044 /* Google_Protobuf_Value+Extensions.swift in Sources */, + 59FD399030E7E0BB2B9461AEEE2DC6C9 /* Google_Protobuf_Wrappers+Extensions.swift in Sources */, + B90AEDF924CC52AC7585B73E1030AEAB /* HashVisitor.swift in Sources */, + E10D21176D3A1431CA6F204FCD04C42F /* Internal.swift in Sources */, + 397764E493AF1BA28409B3E6BEC36669 /* JSONDecoder.swift in Sources */, + 75930600B1620E32EF69F5F3AEE36324 /* JSONDecodingError.swift in Sources */, + CA816A4726A4E162D8EEC81768E7D3D0 /* JSONDecodingOptions.swift in Sources */, + 841074B04094F51B67058B79C590986C /* JSONEncoder.swift in Sources */, + E46EA4CF016F53F6899CFBF8C686514C /* JSONEncodingError.swift in Sources */, + 2B0770096805134D01ED027BBEDBE54B /* JSONEncodingOptions.swift in Sources */, + C0735FA5855D093FFA8C685BE85A9FA9 /* JSONEncodingVisitor.swift in Sources */, + 2314E1F1A7D7713A19D82AF3535BF64E /* JSONMapEncodingVisitor.swift in Sources */, + 7D3AF422FA58C91F66A9CBBF82C422FB /* JSONScanner.swift in Sources */, + 6342AF94E5184A8009D0CD79261E71FB /* MathUtils.swift in Sources */, + F2974D726148AB2AFD112F509654CB78 /* Message.swift in Sources */, + F98E150F1422D9DCB84C9348770184DE /* Message+AnyAdditions.swift in Sources */, + D5553EDDC5E223955C958A35B7449F58 /* Message+BinaryAdditions.swift in Sources */, + DE1CB1B53A73788DF601470451DE3BF7 /* Message+JSONAdditions.swift in Sources */, + ED50698FB65DD44300731403CF6D27ED /* Message+JSONArrayAdditions.swift in Sources */, + E5BCB1E5E9479C366A2301A64A742C4E /* Message+TextFormatAdditions.swift in Sources */, + 92BD4B45DD4D344E3D22E87B74A7EBB4 /* MessageExtension.swift in Sources */, + 873A5680BD4362D36A7DC6A2920B3ADC /* NameMap.swift in Sources */, + E6C1B3E7C71879D476EF43F0B4A5C4C0 /* ProtobufAPIVersionCheck.swift in Sources */, + E349A26F1BDBB83D86D03A35DD566091 /* ProtobufMap.swift in Sources */, + AE3E17C8F327DEE3DD9AD856036CB80C /* ProtoNameProviding.swift in Sources */, + 815D71443DB342EC7F2A23293CF7248B /* SelectiveVisitor.swift in Sources */, + 03DC8AA9D0BB917802FFD7C7958E7F2E /* SimpleExtensionMap.swift in Sources */, + DC98276493047FB776A42073BB4C54BE /* source_context.pb.swift in Sources */, + C7D59D9B065F71D17F060D8E8435DA8A /* StringUtils.swift in Sources */, + C86E0637C60F6874DC13AC04EFA81204 /* struct.pb.swift in Sources */, + DAE6445D2D0AD17AAA5BFB4BAEF42030 /* SwiftProtobuf-dummy.m in Sources */, + 7159E860E2081CAF7E06DA2BA49DD735 /* TextFormatDecoder.swift in Sources */, + 73B9FF2ED2F382A23ACE7E54176A9FF6 /* TextFormatDecodingError.swift in Sources */, + 577D8FDF1D69F285A7A2DEC6C755A981 /* TextFormatEncoder.swift in Sources */, + F1499CDA776BDA6801D6ED57B7C3465B /* TextFormatEncodingOptions.swift in Sources */, + D0AC31F628026177B458D65DAB5C37FE /* TextFormatEncodingVisitor.swift in Sources */, + 98221E7C27A56981EB5F9EA25911F968 /* TextFormatScanner.swift in Sources */, + 61898B2CBC1CB0F2FAC8652F3D33D842 /* timestamp.pb.swift in Sources */, + F499A244617D0D00C539CEBFC56673E3 /* TimeUtils.swift in Sources */, + B20044327CD5E625E08351A9A86B184D /* type.pb.swift in Sources */, + DA76D0FBC608E660D83E06861AEDC546 /* UnknownStorage.swift in Sources */, + 55F1EA9B8F0BB40375A73C335D9A2253 /* UnsafeBufferPointer+Shims.swift in Sources */, + 77669A73AEE9B6D3B6ADCECC83927C4E /* UnsafeRawPointer+Shims.swift in Sources */, + AE4AF83FD866DC8CCB63B2FBCE277087 /* Varint.swift in Sources */, + 637AE22B3369D5350F3E5F9B0ECA99F7 /* Version.swift in Sources */, + 714F3B85B7A0A673B913DE790D3BEB03 /* Visitor.swift in Sources */, + 8551038B1D3232FC41FAA8483D57FAF3 /* WireFormat.swift in Sources */, + 91F179560186F0705155710DDDFCF318 /* wrappers.pb.swift in Sources */, + 1AA028CE24E76925A981C67CF6662B5D /* ZigZag.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + C581D001424DEA1903AC6EC0825F3C93 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 4A61CE0A4B73C814A57D2A9D3E7C21F7 /* Pods-wallet-dummy.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 03E11F4822AE5C7C12B0DB6728C77A57 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = SwiftProtobuf; + target = A5F702E0DA383BC1479572581615A916 /* SwiftProtobuf */; + targetProxy = 2E11626515B8519D3BBD8B37813264C3 /* PBXContainerItemProxy */; + }; + 1232582A13A1D0181DB49F3A6537F135 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "QR-Code-Scanner-iOS"; + target = 03F8264CAE2EC0684FD64871C2FF793E /* QR-Code-Scanner-iOS */; + targetProxy = 1CC6D210283EFAD79E44C5F85701A5FE /* PBXContainerItemProxy */; + }; + 291A8C4949263EC203B0970FCD48BE84 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "QR-Code-Scanner-iOS"; + target = 03F8264CAE2EC0684FD64871C2FF793E /* QR-Code-Scanner-iOS */; + targetProxy = A50707F8E02A73B8AFDA4C558AB2DC50 /* PBXContainerItemProxy */; + }; + 66777B6E1DB8313D22F584C8485F074C /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = SwiftProtobuf; + target = A5F702E0DA383BC1479572581615A916 /* SwiftProtobuf */; + targetProxy = FB7449B04276A838FDC1F1018B07424F /* PBXContainerItemProxy */; + }; + DDDCAC4C383D6771BFC5CE5B4D9E493A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "Pods-wallet"; + target = 4179979D0E7E44B4D103FAD5DF24E7E8 /* Pods-wallet */; + targetProxy = 80E44C83062844344E3E66A26F240A88 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 10E5C02EDDCC1032D8269E48A0BB159C /* QRCode.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 50050A19ADA648A90F3589BC13E8E9B3 /* QRCode.storyboard */, + ); + name = QRCode.storyboard; + path = "QR Code Scanner"; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 05A9667C5709BECC0C959B8BC83881B7 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 24F1A5AA46C57511EDA0D8F97143CFE0 /* Pods-wallet.release.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = "Target Support Files/Pods-wallet/Pods-wallet-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + MODULEMAP_FILE = "Target Support Files/Pods-wallet/Pods-wallet.modulemap"; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 0D5E77FF2944CC17A83653C79A8F4D9B /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 559D830AF59FC263E3F21CD068910622 /* SwiftProtobuf.release.xcconfig */; + buildSettings = { + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "Target Support Files/SwiftProtobuf/SwiftProtobuf-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/SwiftProtobuf/SwiftProtobuf-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MODULEMAP_FILE = "Target Support Files/SwiftProtobuf/SwiftProtobuf.modulemap"; + PRODUCT_MODULE_NAME = SwiftProtobuf; + PRODUCT_NAME = SwiftProtobuf; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 11614EC2AEF5D1478C86C9631FC07C05 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 128311B4E8A2B7867C77E940FD437AF4 /* QR-Code-Scanner-iOS.debug.xcconfig */; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "Target Support Files/QR-Code-Scanner-iOS/QR-Code-Scanner-iOS-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/QR-Code-Scanner-iOS/QR-Code-Scanner-iOS-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MODULEMAP_FILE = "Target Support Files/QR-Code-Scanner-iOS/QR-Code-Scanner-iOS.modulemap"; + PRODUCT_MODULE_NAME = QRCodeScanner; + PRODUCT_NAME = QRCodeScanner; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_VERSION = 5; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 3EC1476FEC49A0B87EAB0F74BE90F598 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = BF3337E940A069FFC19732C60373B722 /* SwiftProtobuf.debug.xcconfig */; + buildSettings = { + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "Target Support Files/SwiftProtobuf/SwiftProtobuf-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/SwiftProtobuf/SwiftProtobuf-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MODULEMAP_FILE = "Target Support Files/SwiftProtobuf/SwiftProtobuf.modulemap"; + PRODUCT_MODULE_NAME = SwiftProtobuf; + PRODUCT_NAME = SwiftProtobuf; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 47C5C138552C574EC3A2A35B45E47717 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = C5789E10300FB3742C9A86D10A24B4DE /* Pods-wallet-walletUITests.release.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = "Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + MODULEMAP_FILE = "Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests.modulemap"; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 78CF4CC051F886972FF8500D8BA6E035 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = F38640DF8D52C77AF07ED4BCD5FD2702 /* QR-Code-Scanner-iOS.release.xcconfig */; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "Target Support Files/QR-Code-Scanner-iOS/QR-Code-Scanner-iOS-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/QR-Code-Scanner-iOS/QR-Code-Scanner-iOS-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MODULEMAP_FILE = "Target Support Files/QR-Code-Scanner-iOS/QR-Code-Scanner-iOS.modulemap"; + PRODUCT_MODULE_NAME = QRCodeScanner; + PRODUCT_NAME = QRCodeScanner; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_VERSION = 5; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 7C4747036771C15E393CF33121FFF2A1 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = D3814349F80753B782BDF4C7EB4CDEC0 /* Pods-walletTests.debug.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = "Target Support Files/Pods-walletTests/Pods-walletTests-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + MODULEMAP_FILE = "Target Support Files/Pods-walletTests/Pods-walletTests.modulemap"; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 8EB225882C0BF889B2324F7076535B58 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 3B2666C84AFACA90A2B873D09AB132E3 /* Pods-walletTests.release.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = "Target Support Files/Pods-walletTests/Pods-walletTests-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + MODULEMAP_FILE = "Target Support Files/Pods-walletTests/Pods-walletTests.modulemap"; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 90D4D09BCB6A4660E43ACBE9ECB6FE9A /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "POD_CONFIGURATION_DEBUG=1", + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + STRIP_INSTALLED_PRODUCT = NO; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + SYMROOT = "${SRCROOT}/../build"; + }; + name = Debug; + }; + 9553C89E183877A5CB2F3C6801BEC129 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "POD_CONFIGURATION_RELEASE=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + STRIP_INSTALLED_PRODUCT = NO; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_VERSION = 5.0; + SYMROOT = "${SRCROOT}/../build"; + }; + name = Release; + }; + A42A77C64BA9025CE1E357C8C2A780BF /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 0717CEB42AB9900F55F2D13B8E2B9EE3 /* Pods-wallet-walletUITests.debug.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = "Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + MODULEMAP_FILE = "Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests.modulemap"; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + BC39A1F413C61114691AC3BF435A04DF /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 09ED74926D1582CBAB28921A1C37CD82 /* Pods-wallet.debug.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = "Target Support Files/Pods-wallet/Pods-wallet-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + MODULEMAP_FILE = "Target Support Files/Pods-wallet/Pods-wallet.modulemap"; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 0EC4FBCEEE537EC6C045BC81EBB289A3 /* Build configuration list for PBXNativeTarget "SwiftProtobuf" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 3EC1476FEC49A0B87EAB0F74BE90F598 /* Debug */, + 0D5E77FF2944CC17A83653C79A8F4D9B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 4821239608C13582E20E6DA73FD5F1F9 /* Build configuration list for PBXProject "Pods" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 90D4D09BCB6A4660E43ACBE9ECB6FE9A /* Debug */, + 9553C89E183877A5CB2F3C6801BEC129 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 4A167D96767B9A63C2DD4AFB9D42FB02 /* Build configuration list for PBXNativeTarget "Pods-wallet" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + BC39A1F413C61114691AC3BF435A04DF /* Debug */, + 05A9667C5709BECC0C959B8BC83881B7 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 60A33BB80E78B9C7E100C498C93D22C1 /* Build configuration list for PBXNativeTarget "QR-Code-Scanner-iOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 11614EC2AEF5D1478C86C9631FC07C05 /* Debug */, + 78CF4CC051F886972FF8500D8BA6E035 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 7D824D0E344AF2F4193C4D5C5E244D31 /* Build configuration list for PBXNativeTarget "Pods-walletTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 7C4747036771C15E393CF33121FFF2A1 /* Debug */, + 8EB225882C0BF889B2324F7076535B58 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 9A7B8C6FE1074681FD74F345DDEEC70E /* Build configuration list for PBXNativeTarget "Pods-wallet-walletUITests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A42A77C64BA9025CE1E357C8C2A780BF /* Debug */, + 47C5C138552C574EC3A2A35B45E47717 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = BFDFE7DC352907FC980B868725387E98 /* Project object */; +} diff --git a/Pods/Pods.xcodeproj/xcuserdata/adriana.xcuserdatad/xcschemes/Pods-wallet-walletUITests.xcscheme b/Pods/Pods.xcodeproj/xcuserdata/adriana.xcuserdatad/xcschemes/Pods-wallet-walletUITests.xcscheme new file mode 100644 index 0000000..711c7fd --- /dev/null +++ b/Pods/Pods.xcodeproj/xcuserdata/adriana.xcuserdatad/xcschemes/Pods-wallet-walletUITests.xcscheme @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Pods/Pods.xcodeproj/xcuserdata/adriana.xcuserdatad/xcschemes/Pods-wallet.xcscheme b/Pods/Pods.xcodeproj/xcuserdata/adriana.xcuserdatad/xcschemes/Pods-wallet.xcscheme new file mode 100644 index 0000000..fb639f2 --- /dev/null +++ b/Pods/Pods.xcodeproj/xcuserdata/adriana.xcuserdatad/xcschemes/Pods-wallet.xcscheme @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Pods/Pods.xcodeproj/xcuserdata/adriana.xcuserdatad/xcschemes/Pods-walletTests.xcscheme b/Pods/Pods.xcodeproj/xcuserdata/adriana.xcuserdatad/xcschemes/Pods-walletTests.xcscheme new file mode 100644 index 0000000..9fd67d9 --- /dev/null +++ b/Pods/Pods.xcodeproj/xcuserdata/adriana.xcuserdatad/xcschemes/Pods-walletTests.xcscheme @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Pods/Pods.xcodeproj/xcuserdata/adriana.xcuserdatad/xcschemes/QR-Code-Scanner-iOS.xcscheme b/Pods/Pods.xcodeproj/xcuserdata/adriana.xcuserdatad/xcschemes/QR-Code-Scanner-iOS.xcscheme new file mode 100644 index 0000000..7f15f64 --- /dev/null +++ b/Pods/Pods.xcodeproj/xcuserdata/adriana.xcuserdatad/xcschemes/QR-Code-Scanner-iOS.xcscheme @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Pods/Pods.xcodeproj/xcuserdata/adriana.xcuserdatad/xcschemes/SwiftProtobuf.xcscheme b/Pods/Pods.xcodeproj/xcuserdata/adriana.xcuserdatad/xcschemes/SwiftProtobuf.xcscheme new file mode 100644 index 0000000..8320915 --- /dev/null +++ b/Pods/Pods.xcodeproj/xcuserdata/adriana.xcuserdatad/xcschemes/SwiftProtobuf.xcscheme @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Pods/Pods.xcodeproj/xcuserdata/adriana.xcuserdatad/xcschemes/xcschememanagement.plist b/Pods/Pods.xcodeproj/xcuserdata/adriana.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..fea0786 --- /dev/null +++ b/Pods/Pods.xcodeproj/xcuserdata/adriana.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,46 @@ + + + + + SchemeUserState + + Pods-wallet-walletUITests.xcscheme + + isShown + + orderHint + 1 + + Pods-wallet.xcscheme + + isShown + + orderHint + 0 + + Pods-walletTests.xcscheme + + isShown + + orderHint + 2 + + QR-Code-Scanner-iOS.xcscheme + + isShown + + orderHint + 3 + + SwiftProtobuf.xcscheme + + isShown + + orderHint + 4 + + + SuppressBuildableAutocreation + + + diff --git a/Pods/QR-Code-Scanner-iOS/LICENSE b/Pods/QR-Code-Scanner-iOS/LICENSE new file mode 100644 index 0000000..dfcca50 --- /dev/null +++ b/Pods/QR-Code-Scanner-iOS/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2020 Applied Recognition, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/Pods/QR-Code-Scanner-iOS/QR Code Scanner/Base.lproj/QRCode.storyboard b/Pods/QR-Code-Scanner-iOS/QR Code Scanner/Base.lproj/QRCode.storyboard new file mode 100644 index 0000000..55d7c7e --- /dev/null +++ b/Pods/QR-Code-Scanner-iOS/QR Code Scanner/Base.lproj/QRCode.storyboard @@ -0,0 +1,160 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Pods/QR-Code-Scanner-iOS/QR Code Scanner/CameraAccessDeniedViewController.swift b/Pods/QR-Code-Scanner-iOS/QR Code Scanner/CameraAccessDeniedViewController.swift new file mode 100644 index 0000000..c0a2997 --- /dev/null +++ b/Pods/QR-Code-Scanner-iOS/QR Code Scanner/CameraAccessDeniedViewController.swift @@ -0,0 +1,27 @@ +// +// CameraAccessDeniedViewController.swift +// +// Created by Jakub Dolejs on 28/03/2018. +// Copyright © 2018 Applied Recognition Inc. All rights reserved. +// + +import UIKit + +class CameraAccessDeniedViewController: UIViewController { + + @IBOutlet var label: UILabel! + + override func viewDidLoad() { + super.viewDidLoad() + if let appName = Bundle.main.infoDictionary?[kCFBundleNameKey as String] as? String { + label.text = String(format: "Camera access denied. Please go to settings and enable camera for %@.", appName) + } + } + + @IBAction func openSettings() { + if let settingsURL = URL(string: UIApplication.openSettingsURLString) { + UIApplication.shared.open(settingsURL, options: [:], completionHandler: nil) + } + } + +} diff --git a/Pods/QR-Code-Scanner-iOS/QR Code Scanner/Media.xcassets/Contents.json b/Pods/QR-Code-Scanner-iOS/QR Code Scanner/Media.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/Pods/QR-Code-Scanner-iOS/QR Code Scanner/Media.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Pods/QR-Code-Scanner-iOS/QR Code Scanner/Media.xcassets/qr_code.imageset/Contents.json b/Pods/QR-Code-Scanner-iOS/QR Code Scanner/Media.xcassets/qr_code.imageset/Contents.json new file mode 100644 index 0000000..6dd2015 --- /dev/null +++ b/Pods/QR-Code-Scanner-iOS/QR Code Scanner/Media.xcassets/qr_code.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "qr_code.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "qr_code@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "qr_code@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Pods/QR-Code-Scanner-iOS/QR Code Scanner/Media.xcassets/qr_code.imageset/qr_code.png b/Pods/QR-Code-Scanner-iOS/QR Code Scanner/Media.xcassets/qr_code.imageset/qr_code.png new file mode 100644 index 0000000..2d69377 Binary files /dev/null and b/Pods/QR-Code-Scanner-iOS/QR Code Scanner/Media.xcassets/qr_code.imageset/qr_code.png differ diff --git a/Pods/QR-Code-Scanner-iOS/QR Code Scanner/Media.xcassets/qr_code.imageset/qr_code@2x.png b/Pods/QR-Code-Scanner-iOS/QR Code Scanner/Media.xcassets/qr_code.imageset/qr_code@2x.png new file mode 100644 index 0000000..a68ab5b Binary files /dev/null and b/Pods/QR-Code-Scanner-iOS/QR Code Scanner/Media.xcassets/qr_code.imageset/qr_code@2x.png differ diff --git a/Pods/QR-Code-Scanner-iOS/QR Code Scanner/Media.xcassets/qr_code.imageset/qr_code@3x.png b/Pods/QR-Code-Scanner-iOS/QR Code Scanner/Media.xcassets/qr_code.imageset/qr_code@3x.png new file mode 100644 index 0000000..70b8215 Binary files /dev/null and b/Pods/QR-Code-Scanner-iOS/QR Code Scanner/Media.xcassets/qr_code.imageset/qr_code@3x.png differ diff --git a/Pods/QR-Code-Scanner-iOS/QR Code Scanner/QRCodeScanViewController.swift b/Pods/QR-Code-Scanner-iOS/QR Code Scanner/QRCodeScanViewController.swift new file mode 100644 index 0000000..6838ae4 --- /dev/null +++ b/Pods/QR-Code-Scanner-iOS/QR Code Scanner/QRCodeScanViewController.swift @@ -0,0 +1,186 @@ +// +// QRCodeScanViewController.swift +// BFL Authenticator +// +// Created by Jakub Dolejs on 28/03/2018. +// Copyright © 2018 Applied Recognition Inc. All rights reserved. +// + +import UIKit +import AVFoundation + +public class QRCodeScanViewController: UIViewController, AVCaptureMetadataOutputObjectsDelegate { + + public weak var delegate: QRCodeScanViewControllerDelegate? + public var prompt: String? + + public static func create() -> QRCodeScanViewController { + let storyboard = UIStoryboard(name: "QRCode", bundle: Bundle(for: QRCodeScanViewController.self)) + return storyboard.instantiateInitialViewController() as! QRCodeScanViewController + } + + private override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { + super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) + } + + required init?(coder: NSCoder) { + super.init(coder: coder) + } + + @IBOutlet var cameraView: UIView! + @IBOutlet var promptLabel: UILabel! + var captureSession: AVCaptureSession! + lazy var barcodeScanQueue: DispatchQueue = { + let queue = DispatchQueue.init(label: "com.appliedrec.qrcodescan") + return queue + }() + var avCaptureVideoOrientation: AVCaptureVideoOrientation { + switch UIApplication.shared.statusBarOrientation { + case .portraitUpsideDown: + return AVCaptureVideoOrientation.portraitUpsideDown + case .landscapeRight: + return AVCaptureVideoOrientation.landscapeRight + case .landscapeLeft: + return AVCaptureVideoOrientation.landscapeLeft + default: + return AVCaptureVideoOrientation.portrait + } + } + + public override func viewDidLoad() { + super.viewDidLoad() + if let prompt = self.prompt { + self.promptLabel.text = prompt + } + } + + public override func didReceiveMemoryWarning() { + super.didReceiveMemoryWarning() + // Dispose of any resources that can be recreated. + } + + public override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) + startCamera() + } + + func startCamera() { + let status = AVCaptureDevice.authorizationStatus(for: .video) + switch status { + case .authorized: + self.startScan() + case .notDetermined: + AVCaptureDevice.requestAccess(for: .video) { granted in + if granted { + self.startScan() + } else { + self.showCameraAccessDenied() + } + } + case .denied: + self.showCameraAccessDenied() + case .restricted: + self.showCameraAccessRestricted() + @unknown default: + fatalError() + } + } + + public override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + self.stopCamera() + } + + @IBAction func restartQRCodeScan(_ segue: UIStoryboardSegue) { + + } + + func showCameraAccessDenied() { + DispatchQueue.main.async { + self.performSegue(withIdentifier: "denied", sender: nil) + } + } + + func showCameraAccessRestricted() { + DispatchQueue.main.async { + self.performSegue(withIdentifier: "restricted", sender: nil) + } + } + + private func startScan() { + self.barcodeScanQueue.async { + self.captureSession = AVCaptureSession() + guard let camera = AVCaptureDevice.default(.builtInWideAngleCamera, for: .video, position: .back) else { + return + } + guard let videoInput = try? AVCaptureDeviceInput(device: camera) else { + return + } + do { + try camera.lockForConfiguration() + if camera.isAutoFocusRangeRestrictionSupported { + camera.autoFocusRangeRestriction = .near + } + if camera.isFocusModeSupported(AVCaptureDevice.FocusMode.continuousAutoFocus) { + camera.focusMode = .continuousAutoFocus + } else if camera.isFocusModeSupported(AVCaptureDevice.FocusMode.autoFocus) { + camera.focusMode = .autoFocus + } + if camera.isFocusPointOfInterestSupported { + camera.focusPointOfInterest = CGPoint(x: 0.5, y: 0.5) + } + camera.unlockForConfiguration() + } catch { + + } + if self.captureSession.canAddInput(videoInput) { + self.captureSession.addInput(videoInput) + } + let barcodeOutput = AVCaptureMetadataOutput() + barcodeOutput.setMetadataObjectsDelegate(self, queue: self.barcodeScanQueue) + if self.captureSession.canAddOutput(barcodeOutput) { + self.captureSession.addOutput(barcodeOutput) + if barcodeOutput.availableMetadataObjectTypes.contains(where: { (val) -> Bool in return val == AVMetadataObject.ObjectType.qr }) { + barcodeOutput.metadataObjectTypes = [.qr] + } + } + self.captureSession.startRunning() + DispatchQueue.main.async { + let previewLayer = AVCaptureVideoPreviewLayer(session: self.captureSession) + previewLayer.videoGravity = AVLayerVideoGravity.resizeAspectFill + previewLayer.frame = self.cameraView.bounds + if previewLayer.connection != nil && previewLayer.connection!.isVideoOrientationSupported { + previewLayer.connection!.videoOrientation = self.avCaptureVideoOrientation + } + self.cameraView.layer.masksToBounds = true + while let sub = self.cameraView.layer.sublayers?.first { + sub.removeFromSuperlayer() + } + self.cameraView.layer.addSublayer(previewLayer) + } + } + } + + func stopCamera() { + self.barcodeScanQueue.async { + if self.captureSession != nil { + self.captureSession.stopRunning() + self.captureSession = nil + } + } + } + + public func metadataOutput(_ output: AVCaptureMetadataOutput, didOutput metadataObjects: [AVMetadataObject], from connection: AVCaptureConnection) { + if let codeValue = (metadataObjects.first(where: { $0 is AVMetadataMachineReadableCodeObject && $0.type == AVMetadataObject.ObjectType.qr }) as? AVMetadataMachineReadableCodeObject)?.stringValue { + self.stopCamera() + DispatchQueue.main.async { + self.delegate?.qrCodeScanViewController(self, didScanQRCode: codeValue) + self.delegate = nil + } + } + } +} + +public protocol QRCodeScanViewControllerDelegate: class { + func qrCodeScanViewController(_ viewController: QRCodeScanViewController, didScanQRCode value: String) +} diff --git a/Pods/QR-Code-Scanner-iOS/README.md b/Pods/QR-Code-Scanner-iOS/README.md new file mode 100644 index 0000000..76b1e03 --- /dev/null +++ b/Pods/QR-Code-Scanner-iOS/README.md @@ -0,0 +1,54 @@ +# QR Code Scanner for iOS + +Scans QR codes using the device's camera and returns a string value. + +## Installation + +1. Install [CocoaPods](https://cocoapods.org). +2. Add the following dependency in your **Podspec** file: + + ~~~ruby + pod 'QR-Code-Scanner-iOS', '~> 1.0' + ~~~ +3. Run `pod install`. + +## Usage + +~~~swift +import UIKit +import QRCodeScanner + +class MyViewController: UIViewController, QRCodeScanViewControllerDelegate { + + /// Start the QR code scan + func scanQRCode() { + + // Create an instance of QRCodeScanViewController + let viewController = QRCodeScanViewController.create() + + // Set itself as delegate + viewController.delegate = self + + // Present the view controller + self.present(viewController, animated: true) + } + + // MARK: QRCodeScanViewControllerDelegate + + /// Called when the camera scans a QR code + /// - Parameters: + /// - viewController: View controller that scanned the QR code + /// - value: String encoded in the QR code + func qrCodeScanViewController(_ viewController: QRCodeScanViewController, didScanQRCode value: String) { + + // Dismiss the view controller + viewController.dismiss(animated: true) { + + // Show an alert with the scanned value + let alert = UIAlertController(title: "Scanned value", message: value, preferredStyle: .alert) + alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil)) + self.present(alert, animated: true) + } + } +} +~~~ \ No newline at end of file diff --git a/Pods/SwiftProtobuf/LICENSE.txt b/Pods/SwiftProtobuf/LICENSE.txt new file mode 100644 index 0000000..4b3ed03 --- /dev/null +++ b/Pods/SwiftProtobuf/LICENSE.txt @@ -0,0 +1,211 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + + +## Runtime Library Exception to the Apache 2.0 License: ## + + + As an exception, if you use this Software to compile your source code and + portions of this Software are embedded into the binary product as a result, + you may redistribute such product without providing attribution as would + otherwise be required by Sections 4(a), 4(b) and 4(d) of the License. diff --git a/Pods/SwiftProtobuf/README.md b/Pods/SwiftProtobuf/README.md new file mode 100644 index 0000000..9956ee0 --- /dev/null +++ b/Pods/SwiftProtobuf/README.md @@ -0,0 +1,303 @@ +Swift logo + +# Swift Protobuf + +**Welcome to Swift Protobuf!** + +[Apple's Swift programming language](https://swift.org/) is a perfect +complement to [Google's Protocol +Buffer](https://developers.google.com/protocol-buffers/) ("protobuf") serialization +technology. +They both emphasize high performance and programmer safety. + +This project provides both the command-line program that adds Swift +code generation to Google's `protoc` and the runtime library that is +necessary for using the generated code. +After using the protoc plugin to generate Swift code from your .proto +files, you will need to add this library to your project. + +[![Build and Test](https://github.com/apple/swift-protobuf/workflows/Build%20and%20Test/badge.svg)](https://github.com/apple/swift-protobuf/actions?query=workflow%3A%22Build+and+Test%22) +[![Check Upstream Protos](https://github.com/apple/swift-protobuf/workflows/Check%20Upstream%20Proto%20Files/badge.svg)](https://github.com/apple/swift-protobuf/actions?query=workflow%3A%22Check+Upstream+Proto+Files%22) +[![Run Conformance Tests](https://github.com/apple/swift-protobuf/workflows/Run%20Conformance%20Tests/badge.svg)](https://github.com/apple/swift-protobuf/actions?query=workflow%3A%22Run+Conformance+Tests%22) + +# Features of SwiftProtobuf + +SwiftProtobuf offers many advantages over alternative serialization +systems: + +* Safety: The protobuf code-generation system avoids the + errors that are common with hand-built serialization code. +* Correctness: SwiftProtobuf passes both its own extensive + test suite and Google's full conformance test for protobuf + correctness. +* Schema-driven: Defining your data structures in a separate + `.proto` schema file clearly documents your communications + conventions. +* Idiomatic: SwiftProtobuf takes full advantage of the Swift language. + In particular, all generated types provide full Swift copy-on-write + value semantics. +* Efficient binary serialization: The `.serializedData()` + method returns a `Data` with a compact binary form of your data. + You can deserialize the data using the `init(serializedData:)` + initializer. +* Standard JSON serialization: The `.jsonUTF8Data()` method returns a JSON + form of your data that can be parsed with the `init(jsonUTF8Data:)` + initializer. +* Hashable, Equatable: The generated struct can be put into a + `Set<>` or `Dictionary<>`. +* Performant: The binary and JSON serializers have been + extensively optimized. +* Extensible: You can add your own Swift extensions to any + of the generated types. + +Best of all, you can take the same `.proto` file and generate +Java, C++, Python, or Objective-C for use on other platforms. The +generated code for those languages will use the exact same +serialization and deserialization conventions as SwiftProtobuf, making +it easy to exchange serialized data in binary or JSON forms, with no +additional effort on your part. + +# Documentation + +More information is available in the associated documentation: + + * [Google's protobuf documentation](https://developers.google.com/protocol-buffers/) + provides general information about protocol buffers, the protoc compiler, + and how to use protocol buffers with C++, Java, and other languages. + * [PLUGIN.md](Documentation/PLUGIN.md) documents the `protoc-gen-swift` + plugin that adds Swift support to the `protoc` program + * [API.md](Documentation/API.md) documents how to use the generated code. + This is recommended reading for anyone using SwiftProtobuf in their + project. + * [cocoadocs.org](http://cocoadocs.org/docsets/SwiftProtobuf/) has the generated + API documentation + * [INTERNALS.md](Documentation/INTERNALS.md) documents the internal structure + of the generated code and the library. This + should only be needed by folks interested in working on SwiftProtobuf + itself. + * [STYLE_GUIDELINES.md](Documentation/STYLE_GUIDELINES.md) documents the style + guidelines we have adopted in our codebase if you are interested in + contributing + +# Getting Started + +If you've worked with Protocol Buffers before, adding Swift support is very +simple: you just need to build the `protoc-gen-swift` program and copy it into +your PATH. +The `protoc` program will find and use it automatically, allowing you +to build Swift sources for your proto files. +You will also, of course, need to add the SwiftProtobuf runtime library to +your project as explained below. + +## System Requirements + +To use Swift with Protocol buffers, you'll need: + +* A Swift 4.2 or later compiler (Xcode 10.0 or later). Support is included +for the Swift Package Manager; or using the included Xcode project. The Swift +protobuf project is being developed and tested against the latest release +version of Swift available from [Swift.org](https://swift.org) + +* Google's protoc compiler. The Swift protoc plugin is being actively +developed and tested against the latest protobuf sources. +The SwiftProtobuf tests need a version of protoc which supports the +`swift_prefix` option (introduced in protoc 3.2.0). +It may work with earlier versions of protoc. +You can get recent versions from +[Google's github repository](https://github.com/protocolbuffers/protobuf). + +## Building and Installing the Code Generator Plugin + +To translate `.proto` files into Swift, you will need both Google's +protoc compiler and the SwiftProtobuf code generator plugin. + +Building the plugin should be simple on any supported Swift platform: + +``` +$ git clone https://github.com/apple/swift-protobuf.git +$ cd swift-protobuf +``` + +Pick what released version of SwiftProtobuf you are going to use. You can get +a list of tags with: + +``` +$ git tag -l +``` + +Once you pick the version you will use, set your local state to match, and +build the protoc plugin: + +``` +$ git checkout tags/[tag_name] +$ swift build -c release +``` + +This will create a binary called `protoc-gen-swift` in the `.build/release` +directory. + +To install, just copy this one executable into a directory that is +part of your `PATH` environment variable. + +NOTE: The Swift runtime support is now included with macOS. If you are +using old Xcode versions or are on older system versions, you might need +to use also use `--static-swift-stdlib` with `swift build`. + +### Alternatively install via Homebrew + +If you prefer using [Homebrew](https://brew.sh): + +``` +$ brew install swift-protobuf +``` + +This will install `protoc` compiler and Swift code generator plugin. + +## Converting .proto files into Swift + +To generate Swift output for your .proto files, you run the `protoc` command as +usual, using the `--swift_out=` option: + +``` +$ protoc --swift_out=. my.proto +``` + +The `protoc` program will automatically look for `protoc-gen-swift` in your +`PATH` and use it. + +Each `.proto` input file will get translated to a corresponding `.pb.swift` +file in the output directory. + +More information about building and using `protoc-gen-swift` can be found +in the [detailed Plugin documentation](Documentation/PLUGIN.md). + +## Adding the SwiftProtobuf library to your project... + +To use the generated code, you need to include the `SwiftProtobuf` library +module in your project. How you do this will vary depending on how +you're building your project. Note that in all cases, we strongly recommend +that you use the version of the SwiftProtobuf library that corresponds to +the version of `protoc-gen-swift` you used to generate the code. + +### ...using `swift build` + +After copying the `.pb.swift` files into your project, you will need to add the +[SwiftProtobuf library](https://github.com/apple/swift-protobuf) to your +project to support the generated code. +If you are using the Swift Package Manager, add a dependency to your +`Package.swift` file and import the `SwiftProtobuf` library into the desired +targets. Adjust the `"1.6.0"` here to match the `[tag_name]` you used to build +the plugin above: + +```swift +dependencies: [ + .package(name: "SwiftProtobuf", url: "https://github.com/apple/swift-protobuf.git", from: "1.6.0"), +], +targets: [ + .target(name: "MyTarget", dependencies: ["SwiftProtobuf"]), +] +``` + +### ...using Xcode + +If you are using Xcode, then you should: + +* Add the `.pb.swift` source files generated from your protos directly to your + project +* Add the appropriate `SwiftProtobuf_` target from the Xcode project + in this package to your project. + +### ...using CocoaPods + +If you're using CocoaPods, add this to your `Podfile` adjusting the `:tag` to +match the `[tag_name]` you used to build the plugin above: + +```ruby +pod 'SwiftProtobuf', '~> 1.0' +``` + +And run `pod install`. + +NOTE: CocoaPods 1.7 or newer is required. + +### ...using Carthage + +If you're using Carthage, add this to your `Cartfile` but adjust the tag to match the `[tag_name]` you used to build the plugin above: + +```ruby +github "apple/swift-protobuf" ~> 1.0 +``` + +Run `carthage update` and drag `SwiftProtobuf.framework` into your Xcode.project. + +# Quick Start + +Once you have installed the code generator, used it to +generate Swift code from your `.proto` file, and +added the SwiftProtobuf library to your project, you can +just use the generated types as you would any other Swift +struct. + +For example, you might start with the following very simple +proto file: +```protobuf +syntax = "proto3"; + +message BookInfo { + int64 id = 1; + string title = 2; + string author = 3; +} +``` + +Then generate Swift code using: +``` +$ protoc --swift_out=. DataModel.proto +``` + +The generated code will expose a Swift property for +each of the proto fields as well as a selection +of serialization and deserialization capabilities: +```swift +// Create a BookInfo object and populate it: +var info = BookInfo() +info.id = 1734 +info.title = "Really Interesting Book" +info.author = "Jane Smith" + +// As above, but generating a read-only value: +let info2 = BookInfo.with { + $0.id = 1735 + $0.title = "Even More Interesting" + $0.author = "Jane Q. Smith" + } + +// Serialize to binary protobuf format: +let binaryData: Data = try info.serializedData() + +// Deserialize a received Data object from `binaryData` +let decodedInfo = try BookInfo(serializedData: binaryData) + +// Serialize to JSON format as a Data object +let jsonData: Data = try info.jsonUTF8Data() + +// Deserialize from JSON format from `jsonData` +let receivedFromJSON = try BookInfo(jsonUTF8Data: jsonData) +``` + +You can find more information in the detailed +[API Documentation](Documentation/API.md). + +## Report any issues + +If you run into problems, please send us a detailed report. +At a minimum, please include: + +* The specific operating system and version (for example, "macOS 10.12.1" or + "Ubuntu 16.10") +* The version of Swift you have installed (from `swift --version`) +* The version of the protoc compiler you are working with from + `protoc --version` +* The specific version of this source code (you can use `git log -1` to get the + latest commit ID) +* Any local changes you may have diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/AnyMessageStorage.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/AnyMessageStorage.swift new file mode 100644 index 0000000..d8ff999 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/AnyMessageStorage.swift @@ -0,0 +1,476 @@ +// Sources/SwiftProtobuf/AnyMessageStorage.swift - Custom stroage for Any WKT +// +// Copyright (c) 2014 - 2017 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Hand written storage class for Google_Protobuf_Any to support on demand +/// transforms between the formats. +/// +// ----------------------------------------------------------------------------- + +import Foundation + +#if !swift(>=4.2) +private let i_2166136261 = Int(bitPattern: 2166136261) +private let i_16777619 = Int(16777619) +#endif + +fileprivate func serializeAnyJSON( + for message: Message, + typeURL: String, + options: JSONEncodingOptions +) throws -> String { + var visitor = try JSONEncodingVisitor(type: type(of: message), options: options) + visitor.startObject(message: message) + visitor.encodeField(name: "@type", stringValue: typeURL) + if let m = message as? _CustomJSONCodable { + let value = try m.encodedJSONString(options: options) + visitor.encodeField(name: "value", jsonText: value) + } else { + try message.traverse(visitor: &visitor) + } + visitor.endObject() + return visitor.stringResult +} + +fileprivate func emitVerboseTextForm(visitor: inout TextFormatEncodingVisitor, message: Message, typeURL: String) { + let url: String + if typeURL.isEmpty { + url = buildTypeURL(forMessage: message, typePrefix: defaultAnyTypeURLPrefix) + } else { + url = typeURL + } + visitor.visitAnyVerbose(value: message, typeURL: url) +} + +fileprivate func asJSONObject(body: Data) -> Data { + let asciiOpenCurlyBracket = UInt8(ascii: "{") + let asciiCloseCurlyBracket = UInt8(ascii: "}") + var result = Data([asciiOpenCurlyBracket]) + result.append(body) + result.append(asciiCloseCurlyBracket) + return result +} + +fileprivate func unpack(contentJSON: Data, + extensions: ExtensionMap, + options: JSONDecodingOptions, + as messageType: Message.Type) throws -> Message { + guard messageType is _CustomJSONCodable.Type else { + let contentJSONAsObject = asJSONObject(body: contentJSON) + return try messageType.init(jsonUTF8Data: contentJSONAsObject, extensions: extensions, options: options) + } + + var value = String() + try contentJSON.withUnsafeBytes { (body: UnsafeRawBufferPointer) in + if body.count > 0 { + var scanner = JSONScanner(source: body, options: options, extensions: extensions) + let key = try scanner.nextQuotedString() + if key != "value" { + // The only thing within a WKT should be "value". + throw AnyUnpackError.malformedWellKnownTypeJSON + } + try scanner.skipRequiredColon() // Can't fail + value = try scanner.skip() + if !scanner.complete { + // If that wasn't the end, then there was another key, + // and WKTs should only have the one. + throw AnyUnpackError.malformedWellKnownTypeJSON + } + } + } + return try messageType.init(jsonString: value, extensions: extensions, options: options) +} + +internal class AnyMessageStorage { + // The two properties generated Google_Protobuf_Any will reference. + var _typeURL = String() + var _value: Data { + // Remapped to the internal `state`. + get { + switch state { + case .binary(let value): + return value + case .message(let message): + do { + return try message.serializedData(partial: true) + } catch { + return Data() + } + case .contentJSON(let contentJSON, let options): + guard let messageType = Google_Protobuf_Any.messageType(forTypeURL: _typeURL) else { + return Data() + } + do { + let m = try unpack(contentJSON: contentJSON, + extensions: SimpleExtensionMap(), + options: options, + as: messageType) + return try m.serializedData(partial: true) + } catch { + return Data() + } + } + } + set { + state = .binary(newValue) + } + } + + enum InternalState { + // a serialized binary + // Note: Unlike contentJSON below, binary does not bother to capture the + // decoding options. This is because the actual binary format is the binary + // blob, i.e. - when decoding from binary, the spec doesn't include decoding + // the binary blob, it is pass through. Instead there is a public api for + // unpacking that takes new options when a developer decides to decode it. + case binary(Data) + // a message + case message(Message) + // parsed JSON with the @type removed and the decoding options. + case contentJSON(Data, JSONDecodingOptions) + } + var state: InternalState = .binary(Data()) + + static let defaultInstance = AnyMessageStorage() + + private init() {} + + init(copying source: AnyMessageStorage) { + _typeURL = source._typeURL + state = source.state + } + + func isA(_ type: M.Type) -> Bool { + if _typeURL.isEmpty { + return false + } + let encodedType = typeName(fromURL: _typeURL) + return encodedType == M.protoMessageName + } + + // This is only ever called with the expectation that target will be fully + // replaced during the unpacking and never as a merge. + func unpackTo( + target: inout M, + extensions: ExtensionMap?, + options: BinaryDecodingOptions + ) throws { + guard isA(M.self) else { + throw AnyUnpackError.typeMismatch + } + + switch state { + case .binary(let data): + target = try M(serializedData: data, extensions: extensions, partial: true, options: options) + + case .message(let msg): + if let message = msg as? M { + // Already right type, copy it over. + target = message + } else { + // Different type, serialize and parse. + let data = try msg.serializedData(partial: true) + target = try M(serializedData: data, extensions: extensions, partial: true) + } + + case .contentJSON(let contentJSON, let options): + target = try unpack(contentJSON: contentJSON, + extensions: extensions ?? SimpleExtensionMap(), + options: options, + as: M.self) as! M + } + } + + // Called before the message is traversed to do any error preflights. + // Since traverse() will use _value, this is our chance to throw + // when _value can't. + func preTraverse() throws { + switch state { + case .binary: + // Nothing to be checked. + break + + case .message: + // When set from a developer provided message, partial support + // is done. Any message that comes in from another format isn't + // checked, and transcoding the isInitialized requirement is + // never inserted. + break + + case .contentJSON(let contentJSON, let options): + // contentJSON requires we have the type available for decoding + guard let messageType = Google_Protobuf_Any.messageType(forTypeURL: _typeURL) else { + throw BinaryEncodingError.anyTranscodeFailure + } + do { + // Decodes the full JSON and then discard the result. + // The regular traversal will decode this again by querying the + // `value` field, but that has no way to fail. As a result, + // we need this to accurately handle decode errors. + _ = try unpack(contentJSON: contentJSON, + extensions: SimpleExtensionMap(), + options: options, + as: messageType) + } catch { + throw BinaryEncodingError.anyTranscodeFailure + } + } + } +} + +/// Custom handling for Text format. +extension AnyMessageStorage { + func decodeTextFormat(typeURL url: String, decoder: inout TextFormatDecoder) throws { + // Decoding the verbose form requires knowing the type. + _typeURL = url + guard let messageType = Google_Protobuf_Any.messageType(forTypeURL: url) else { + // The type wasn't registered, can't parse it. + throw TextFormatDecodingError.malformedText + } + let terminator = try decoder.scanner.skipObjectStart() + var subDecoder = try TextFormatDecoder(messageType: messageType, scanner: decoder.scanner, terminator: terminator) + if messageType == Google_Protobuf_Any.self { + var any = Google_Protobuf_Any() + try any.decodeTextFormat(decoder: &subDecoder) + state = .message(any) + } else { + var m = messageType.init() + try m.decodeMessage(decoder: &subDecoder) + state = .message(m) + } + decoder.scanner = subDecoder.scanner + if try decoder.nextFieldNumber() != nil { + // Verbose any can never have additional keys. + throw TextFormatDecodingError.malformedText + } + } + + // Specialized traverse for writing out a Text form of the Any. + // This prefers the more-legible "verbose" format if it can + // use it, otherwise will fall back to simpler forms. + internal func textTraverse(visitor: inout TextFormatEncodingVisitor) { + switch state { + case .binary(let valueData): + if let messageType = Google_Protobuf_Any.messageType(forTypeURL: _typeURL) { + // If we can decode it, we can write the readable verbose form: + do { + let m = try messageType.init(serializedData: valueData, partial: true) + emitVerboseTextForm(visitor: &visitor, message: m, typeURL: _typeURL) + return + } catch { + // Fall through to just print the type and raw binary data + } + } + if !_typeURL.isEmpty { + try! visitor.visitSingularStringField(value: _typeURL, fieldNumber: 1) + } + if !valueData.isEmpty { + try! visitor.visitSingularBytesField(value: valueData, fieldNumber: 2) + } + + case .message(let msg): + emitVerboseTextForm(visitor: &visitor, message: msg, typeURL: _typeURL) + + case .contentJSON(let contentJSON, let options): + // If we can decode it, we can write the readable verbose form: + if let messageType = Google_Protobuf_Any.messageType(forTypeURL: _typeURL) { + do { + let m = try unpack(contentJSON: contentJSON, + extensions: SimpleExtensionMap(), + options: options, + as: messageType) + emitVerboseTextForm(visitor: &visitor, message: m, typeURL: _typeURL) + return + } catch { + // Fall through to just print the raw JSON data + } + } + if !_typeURL.isEmpty { + try! visitor.visitSingularStringField(value: _typeURL, fieldNumber: 1) + } + // Build a readable form of the JSON: + let contentJSONAsObject = asJSONObject(body: contentJSON) + visitor.visitAnyJSONDataField(value: contentJSONAsObject) + } + } +} + +/// The obvious goal for Hashable/Equatable conformance would be for +/// hash and equality to behave as if we always decoded the inner +/// object and hashed or compared that. Unfortunately, Any typically +/// stores serialized contents and we don't always have the ability to +/// deserialize it. Since none of our supported serializations are +/// fully deterministic, we can't even ensure that equality will +/// behave this way when the Any contents are in the same +/// serialization. +/// +/// As a result, we can only really perform a "best effort" equality +/// test. Of course, regardless of the above, we must guarantee that +/// hashValue is compatible with equality. +extension AnyMessageStorage { +#if swift(>=4.2) + // Can't use _valueData for a few reasons: + // 1. Since decode is done on demand, two objects could be equal + // but created differently (one from JSON, one for Message, etc.), + // and the hash values have to be equal even if we don't have data + // yet. + // 2. map<> serialization order is undefined. At the time of writing + // the Swift, Objective-C, and Go runtimes all tend to have random + // orders, so the messages could be identical, but in binary form + // they could differ. + public func hash(into hasher: inout Hasher) { + if !_typeURL.isEmpty { + hasher.combine(_typeURL) + } + } +#else // swift(>=4.2) + var hashValue: Int { + var hash: Int = i_2166136261 + if !_typeURL.isEmpty { + hash = (hash &* i_16777619) ^ _typeURL.hashValue + } + return hash + } +#endif // swift(>=4.2) + + func isEqualTo(other: AnyMessageStorage) -> Bool { + if (_typeURL != other._typeURL) { + return false + } + + // Since the library does lazy Any decode, equality is a very hard problem. + // It things exactly match, that's pretty easy, otherwise, one ends up having + // to error on saying they aren't equal. + // + // The best option would be to have Message forms and compare those, as that + // removes issues like map<> serialization order, some other protocol buffer + // implementation details/bugs around serialized form order, etc.; but that + // would also greatly slow down equality tests. + // + // Do our best to compare what is present have... + + // If both have messages, check if they are the same. + if case .message(let myMsg) = state, case .message(let otherMsg) = other.state, type(of: myMsg) == type(of: otherMsg) { + // Since the messages are known to be same type, we can claim both equal and + // not equal based on the equality comparison. + return myMsg.isEqualTo(message: otherMsg) + } + + // If both have serialized data, and they exactly match; the messages are equal. + // Because there could be map in the message, the fact that the data isn't the + // same doesn't always mean the messages aren't equal. Likewise, the binary could + // have been created by a library that doesn't order the fields, or the binary was + // created using the appending ability in of the binary format. + if case .binary(let myValue) = state, case .binary(let otherValue) = other.state, myValue == otherValue { + return true + } + + // If both have contentJSON, and they exactly match; the messages are equal. + // Because there could be map in the message (or the JSON could just be in a different + // order), the fact that the JSON isn't the same doesn't always mean the messages + // aren't equal. + if case .contentJSON(let myJSON, _) = state, + case .contentJSON(let otherJSON, _) = other.state, + myJSON == otherJSON { + return true + } + + // Out of options. To do more compares, the states conversions would have to be + // done to do comparisions; and since equality can be used somewhat removed from + // a developer (if they put protos in a Set, use them as keys to a Dictionary, etc), + // the conversion cost might be to high for those uses. Give up and say they aren't equal. + return false + } +} + +// _CustomJSONCodable support for Google_Protobuf_Any +extension AnyMessageStorage { + // Override the traversal-based JSON encoding + // This builds an Any JSON representation from one of: + // * The message we were initialized with, + // * The JSON fields we last deserialized, or + // * The protobuf field we were deserialized from. + // The last case requires locating the type, deserializing + // into an object, then reserializing back to JSON. + func encodedJSONString(options: JSONEncodingOptions) throws -> String { + switch state { + case .binary(let valueData): + // Transcode by decoding the binary data to a message object + // and then recode back into JSON. + guard let messageType = Google_Protobuf_Any.messageType(forTypeURL: _typeURL) else { + // If we don't have the type available, we can't decode the + // binary value, so we're stuck. (The Google spec does not + // provide a way to just package the binary value for someone + // else to decode later.) + throw JSONEncodingError.anyTranscodeFailure + } + let m = try messageType.init(serializedData: valueData, partial: true) + return try serializeAnyJSON(for: m, typeURL: _typeURL, options: options) + + case .message(let msg): + // We should have been initialized with a typeURL, but + // ensure it wasn't cleared. + let url = !_typeURL.isEmpty ? _typeURL : buildTypeURL(forMessage: msg, typePrefix: defaultAnyTypeURLPrefix) + return try serializeAnyJSON(for: msg, typeURL: url, options: options) + + case .contentJSON(let contentJSON, _): + var jsonEncoder = JSONEncoder() + jsonEncoder.startObject() + jsonEncoder.startField(name: "@type") + jsonEncoder.putStringValue(value: _typeURL) + if !contentJSON.isEmpty { + jsonEncoder.append(staticText: ",") + // NOTE: This doesn't really take `options` into account since it is + // just reflecting out what was taken in originally. + jsonEncoder.append(utf8Data: contentJSON) + } + jsonEncoder.endObject() + return jsonEncoder.stringResult + } + } + + // TODO: If the type is well-known or has already been registered, + // we should consider decoding eagerly. Eager decoding would + // catch certain errors earlier (good) but would probably be + // a performance hit if the Any contents were never accessed (bad). + // Of course, we can't always decode eagerly (we don't always have the + // message type available), so the deferred logic here is still needed. + func decodeJSON(from decoder: inout JSONDecoder) throws { + try decoder.scanner.skipRequiredObjectStart() + // Reset state + _typeURL = String() + state = .binary(Data()) + if decoder.scanner.skipOptionalObjectEnd() { + return + } + + var jsonEncoder = JSONEncoder() + while true { + let key = try decoder.scanner.nextQuotedString() + try decoder.scanner.skipRequiredColon() + if key == "@type" { + _typeURL = try decoder.scanner.nextQuotedString() + } else { + jsonEncoder.startField(name: key) + let keyValueJSON = try decoder.scanner.skip() + jsonEncoder.append(text: keyValueJSON) + } + if decoder.scanner.skipOptionalObjectEnd() { + // Capture the options, but set the messageDepthLimit to be what + // was left right now, as that is the limit when the JSON is finally + // parsed. + var updatedOptions = decoder.options + updatedOptions.messageDepthLimit = decoder.scanner.recursionBudget + state = .contentJSON(jsonEncoder.dataResult, updatedOptions) + return + } + try decoder.scanner.skipRequiredComma() + } + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/AnyUnpackError.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/AnyUnpackError.swift new file mode 100644 index 0000000..29fb0d0 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/AnyUnpackError.swift @@ -0,0 +1,37 @@ +// Sources/SwiftProtobuf/AnyUnpackError.swift - Any Unpacking Errors +// +// Copyright (c) 2014 - 2017 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Errors that can be throw when unpacking a Google_Protobuf_Any. +/// +// ----------------------------------------------------------------------------- + +/// Describes errors that can occur when unpacking an `Google_Protobuf_Any` +/// message. +/// +/// `Google_Protobuf_Any` messages can be decoded from protobuf binary, text +/// format, or JSON. The contents are not parsed immediately; the raw data is +/// held in the `Google_Protobuf_Any` message until you `unpack()` it into a +/// message. At this time, any error can occur that might have occurred from a +/// regular decoding operation. There are also other errors that can occur due +/// to problems with the `Any` value's structure. +public enum AnyUnpackError: Error { + /// The `type_url` field in the `Google_Protobuf_Any` message did not match + /// the message type provided to the `unpack()` method. + case typeMismatch + + /// Well-known types being decoded from JSON must have only two fields: the + /// `@type` field and a `value` field containing the specialized JSON coding + /// of the well-known type. + case malformedWellKnownTypeJSON + + /// The `Google_Protobuf_Any` message was malformed in some other way not + /// covered by the other error cases. + case malformedAnyField +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/BinaryDecoder.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/BinaryDecoder.swift new file mode 100644 index 0000000..cf2ef42 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/BinaryDecoder.swift @@ -0,0 +1,1493 @@ +// Sources/SwiftProtobuf/BinaryDecoder.swift - Binary decoding +// +// Copyright (c) 2014 - 2016 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Protobuf binary format decoding engine. +/// +/// This provides the Decoder interface that interacts directly +/// with the generated code. +/// +// ----------------------------------------------------------------------------- + +import Foundation + +internal struct BinaryDecoder: Decoder { + // Current position + private var p : UnsafeRawPointer + // Remaining bytes in input. + private var available : Int + // Position of start of field currently being parsed + private var fieldStartP : UnsafeRawPointer + // Position of end of field currently being parsed, nil if we don't know. + private var fieldEndP : UnsafeRawPointer? + // Whether or not the field value has actually been parsed + private var consumed = true + // Wire format for last-examined field + internal var fieldWireFormat = WireFormat.varint + // Field number for last-parsed field tag + private var fieldNumber: Int = 0 + // Collection of extension fields for this decode + private var extensions: ExtensionMap? + // The current group number. See decodeFullGroup(group:fieldNumber:) for how + // this is used. + private var groupFieldNumber: Int? + // The options for decoding. + private var options: BinaryDecodingOptions + + private var recursionBudget: Int + + // Collects the unknown data found while decoding a message. + private var unknownData: Data? + // Custom data to use as the unknown data while parsing a field. Used only by + // packed repeated enums; see below + private var unknownOverride: Data? + + private var complete: Bool {return available == 0} + + internal init( + forReadingFrom pointer: UnsafeRawPointer, + count: Int, + options: BinaryDecodingOptions, + extensions: ExtensionMap? = nil + ) { + // Assuming baseAddress is not nil. + p = pointer + available = count + fieldStartP = p + self.extensions = extensions + self.options = options + recursionBudget = options.messageDepthLimit + } + + internal init( + forReadingFrom pointer: UnsafeRawPointer, + count: Int, + parent: BinaryDecoder + ) { + self.init(forReadingFrom: pointer, + count: count, + options: parent.options, + extensions: parent.extensions) + recursionBudget = parent.recursionBudget + } + + private mutating func incrementRecursionDepth() throws { + recursionBudget -= 1 + if recursionBudget < 0 { + throw BinaryDecodingError.messageDepthLimit + } + } + + private mutating func decrementRecursionDepth() { + recursionBudget += 1 + // This should never happen, if it does, something is probably corrupting memory, and + // simply throwing doesn't make much sense. + if recursionBudget > options.messageDepthLimit { + fatalError("Somehow BinaryDecoding unwound more objects than it started") + } + } + + internal mutating func handleConflictingOneOf() throws { + /// Protobuf simply allows conflicting oneof values to overwrite + } + + /// Return the next field number or nil if there are no more fields. + internal mutating func nextFieldNumber() throws -> Int? { + // Since this is called for every field, I've taken some pains + // to optimize it, including unrolling a tweaked version of + // the varint parser. + if fieldNumber > 0 { + if let override = unknownOverride { + assert(!options.discardUnknownFields) + assert(fieldWireFormat != .startGroup && fieldWireFormat != .endGroup) + if unknownData == nil { + unknownData = override + } else { + unknownData!.append(override) + } + unknownOverride = nil + } else if !consumed { + if options.discardUnknownFields { + try skip() + } else { + let u = try getRawField() + if unknownData == nil { + unknownData = u + } else { + unknownData!.append(u) + } + } + } + } + + // Quit if end of input + if available == 0 { + return nil + } + + // Get the next field number + fieldStartP = p + fieldEndP = nil + let start = p + let c0 = start[0] + if let wireFormat = WireFormat(rawValue: c0 & 7) { + fieldWireFormat = wireFormat + } else { + throw BinaryDecodingError.malformedProtobuf + } + if (c0 & 0x80) == 0 { + p += 1 + available -= 1 + fieldNumber = Int(c0) >> 3 + } else { + fieldNumber = Int(c0 & 0x7f) >> 3 + if available < 2 { + throw BinaryDecodingError.malformedProtobuf + } + let c1 = start[1] + if (c1 & 0x80) == 0 { + p += 2 + available -= 2 + fieldNumber |= Int(c1) << 4 + } else { + fieldNumber |= Int(c1 & 0x7f) << 4 + if available < 3 { + throw BinaryDecodingError.malformedProtobuf + } + let c2 = start[2] + fieldNumber |= Int(c2 & 0x7f) << 11 + if (c2 & 0x80) == 0 { + p += 3 + available -= 3 + } else { + if available < 4 { + throw BinaryDecodingError.malformedProtobuf + } + let c3 = start[3] + fieldNumber |= Int(c3 & 0x7f) << 18 + if (c3 & 0x80) == 0 { + p += 4 + available -= 4 + } else { + if available < 5 { + throw BinaryDecodingError.malformedProtobuf + } + let c4 = start[4] + if c4 > 15 { + throw BinaryDecodingError.malformedProtobuf + } + fieldNumber |= Int(c4 & 0x7f) << 25 + p += 5 + available -= 5 + } + } + } + } + if fieldNumber != 0 { + consumed = false + + if fieldWireFormat == .endGroup { + if groupFieldNumber == fieldNumber { + // Reached the end of the current group, single the + // end of the message. + return nil + } else { + // .endGroup when not in a group or for a different + // group is an invalid binary. + throw BinaryDecodingError.malformedProtobuf + } + } + return fieldNumber + } + throw BinaryDecodingError.malformedProtobuf + } + + internal mutating func decodeSingularFloatField(value: inout Float) throws { + guard fieldWireFormat == WireFormat.fixed32 else { + return + } + try decodeFourByteNumber(value: &value) + consumed = true + } + + internal mutating func decodeSingularFloatField(value: inout Float?) throws { + guard fieldWireFormat == WireFormat.fixed32 else { + return + } + value = try decodeFloat() + consumed = true + } + + internal mutating func decodeRepeatedFloatField(value: inout [Float]) throws { + switch fieldWireFormat { + case WireFormat.fixed32: + let i = try decodeFloat() + value.append(i) + consumed = true + case WireFormat.lengthDelimited: + let bodyBytes = try decodeVarint() + if bodyBytes > 0 { + let itemSize = UInt64(MemoryLayout.size) + let itemCount = bodyBytes / itemSize + if bodyBytes % itemSize != 0 || itemCount > UInt64(Int.max) { + throw BinaryDecodingError.truncated + } + value.reserveCapacity(value.count + Int(truncatingIfNeeded: itemCount)) + for _ in 1...itemCount { + value.append(try decodeFloat()) + } + } + consumed = true + default: + return + } + } + + internal mutating func decodeSingularDoubleField(value: inout Double) throws { + guard fieldWireFormat == WireFormat.fixed64 else { + return + } + value = try decodeDouble() + consumed = true + } + + internal mutating func decodeSingularDoubleField(value: inout Double?) throws { + guard fieldWireFormat == WireFormat.fixed64 else { + return + } + value = try decodeDouble() + consumed = true + } + + internal mutating func decodeRepeatedDoubleField(value: inout [Double]) throws { + switch fieldWireFormat { + case WireFormat.fixed64: + let i = try decodeDouble() + value.append(i) + consumed = true + case WireFormat.lengthDelimited: + let bodyBytes = try decodeVarint() + if bodyBytes > 0 { + let itemSize = UInt64(MemoryLayout.size) + let itemCount = bodyBytes / itemSize + if bodyBytes % itemSize != 0 || itemCount > UInt64(Int.max) { + throw BinaryDecodingError.truncated + } + value.reserveCapacity(value.count + Int(truncatingIfNeeded: itemCount)) + for _ in 1...itemCount { + let i = try decodeDouble() + value.append(i) + } + } + consumed = true + default: + return + } + } + + internal mutating func decodeSingularInt32Field(value: inout Int32) throws { + guard fieldWireFormat == WireFormat.varint else { + return + } + let varint = try decodeVarint() + value = Int32(truncatingIfNeeded: varint) + consumed = true + } + + internal mutating func decodeSingularInt32Field(value: inout Int32?) throws { + guard fieldWireFormat == WireFormat.varint else { + return + } + let varint = try decodeVarint() + value = Int32(truncatingIfNeeded: varint) + consumed = true + } + + internal mutating func decodeRepeatedInt32Field(value: inout [Int32]) throws { + switch fieldWireFormat { + case WireFormat.varint: + let varint = try decodeVarint() + value.append(Int32(truncatingIfNeeded: varint)) + consumed = true + case WireFormat.lengthDelimited: + var n: Int = 0 + let p = try getFieldBodyBytes(count: &n) + let ints = Varint.countVarintsInBuffer(start: p, count: n) + value.reserveCapacity(value.count + ints) + var decoder = BinaryDecoder(forReadingFrom: p, count: n, parent: self) + while !decoder.complete { + let varint = try decoder.decodeVarint() + value.append(Int32(truncatingIfNeeded: varint)) + } + consumed = true + default: + return + } + } + + internal mutating func decodeSingularInt64Field(value: inout Int64) throws { + guard fieldWireFormat == WireFormat.varint else { + return + } + let v = try decodeVarint() + value = Int64(bitPattern: v) + consumed = true + } + + internal mutating func decodeSingularInt64Field(value: inout Int64?) throws { + guard fieldWireFormat == WireFormat.varint else { + return + } + let varint = try decodeVarint() + value = Int64(bitPattern: varint) + consumed = true + } + + internal mutating func decodeRepeatedInt64Field(value: inout [Int64]) throws { + switch fieldWireFormat { + case WireFormat.varint: + let varint = try decodeVarint() + value.append(Int64(bitPattern: varint)) + consumed = true + case WireFormat.lengthDelimited: + var n: Int = 0 + let p = try getFieldBodyBytes(count: &n) + let ints = Varint.countVarintsInBuffer(start: p, count: n) + value.reserveCapacity(value.count + ints) + var decoder = BinaryDecoder(forReadingFrom: p, count: n, parent: self) + while !decoder.complete { + let varint = try decoder.decodeVarint() + value.append(Int64(bitPattern: varint)) + } + consumed = true + default: + return + } + } + + internal mutating func decodeSingularUInt32Field(value: inout UInt32) throws { + guard fieldWireFormat == WireFormat.varint else { + return + } + let varint = try decodeVarint() + value = UInt32(truncatingIfNeeded: varint) + consumed = true + } + + internal mutating func decodeSingularUInt32Field(value: inout UInt32?) throws { + guard fieldWireFormat == WireFormat.varint else { + return + } + let varint = try decodeVarint() + value = UInt32(truncatingIfNeeded: varint) + consumed = true + } + + internal mutating func decodeRepeatedUInt32Field(value: inout [UInt32]) throws { + switch fieldWireFormat { + case WireFormat.varint: + let varint = try decodeVarint() + value.append(UInt32(truncatingIfNeeded: varint)) + consumed = true + case WireFormat.lengthDelimited: + var n: Int = 0 + let p = try getFieldBodyBytes(count: &n) + let ints = Varint.countVarintsInBuffer(start: p, count: n) + value.reserveCapacity(value.count + ints) + var decoder = BinaryDecoder(forReadingFrom: p, count: n, parent: self) + while !decoder.complete { + let t = try decoder.decodeVarint() + value.append(UInt32(truncatingIfNeeded: t)) + } + consumed = true + default: + return + } + } + + internal mutating func decodeSingularUInt64Field(value: inout UInt64) throws { + guard fieldWireFormat == WireFormat.varint else { + return + } + value = try decodeVarint() + consumed = true + } + + internal mutating func decodeSingularUInt64Field(value: inout UInt64?) throws { + guard fieldWireFormat == WireFormat.varint else { + return + } + value = try decodeVarint() + consumed = true + } + + internal mutating func decodeRepeatedUInt64Field(value: inout [UInt64]) throws { + switch fieldWireFormat { + case WireFormat.varint: + let varint = try decodeVarint() + value.append(varint) + consumed = true + case WireFormat.lengthDelimited: + var n: Int = 0 + let p = try getFieldBodyBytes(count: &n) + let ints = Varint.countVarintsInBuffer(start: p, count: n) + value.reserveCapacity(value.count + ints) + var decoder = BinaryDecoder(forReadingFrom: p, count: n, parent: self) + while !decoder.complete { + let t = try decoder.decodeVarint() + value.append(t) + } + consumed = true + default: + return + } + } + + internal mutating func decodeSingularSInt32Field(value: inout Int32) throws { + guard fieldWireFormat == WireFormat.varint else { + return + } + let varint = try decodeVarint() + let t = UInt32(truncatingIfNeeded: varint) + value = ZigZag.decoded(t) + consumed = true + } + + internal mutating func decodeSingularSInt32Field(value: inout Int32?) throws { + guard fieldWireFormat == WireFormat.varint else { + return + } + let varint = try decodeVarint() + let t = UInt32(truncatingIfNeeded: varint) + value = ZigZag.decoded(t) + consumed = true + } + + internal mutating func decodeRepeatedSInt32Field(value: inout [Int32]) throws { + switch fieldWireFormat { + case WireFormat.varint: + let varint = try decodeVarint() + let t = UInt32(truncatingIfNeeded: varint) + value.append(ZigZag.decoded(t)) + consumed = true + case WireFormat.lengthDelimited: + var n: Int = 0 + let p = try getFieldBodyBytes(count: &n) + let ints = Varint.countVarintsInBuffer(start: p, count: n) + value.reserveCapacity(value.count + ints) + var decoder = BinaryDecoder(forReadingFrom: p, count: n, parent: self) + while !decoder.complete { + let varint = try decoder.decodeVarint() + let t = UInt32(truncatingIfNeeded: varint) + value.append(ZigZag.decoded(t)) + } + consumed = true + default: + return + } + } + + internal mutating func decodeSingularSInt64Field(value: inout Int64) throws { + guard fieldWireFormat == WireFormat.varint else { + return + } + let varint = try decodeVarint() + value = ZigZag.decoded(varint) + consumed = true + } + + internal mutating func decodeSingularSInt64Field(value: inout Int64?) throws { + guard fieldWireFormat == WireFormat.varint else { + return + } + let varint = try decodeVarint() + value = ZigZag.decoded(varint) + consumed = true + } + + internal mutating func decodeRepeatedSInt64Field(value: inout [Int64]) throws { + switch fieldWireFormat { + case WireFormat.varint: + let varint = try decodeVarint() + value.append(ZigZag.decoded(varint)) + consumed = true + case WireFormat.lengthDelimited: + var n: Int = 0 + let p = try getFieldBodyBytes(count: &n) + let ints = Varint.countVarintsInBuffer(start: p, count: n) + value.reserveCapacity(value.count + ints) + var decoder = BinaryDecoder(forReadingFrom: p, count: n, parent: self) + while !decoder.complete { + let varint = try decoder.decodeVarint() + value.append(ZigZag.decoded(varint)) + } + consumed = true + default: + return + } + } + + internal mutating func decodeSingularFixed32Field(value: inout UInt32) throws { + guard fieldWireFormat == WireFormat.fixed32 else { + return + } + var i: UInt32 = 0 + try decodeFourByteNumber(value: &i) + value = UInt32(littleEndian: i) + consumed = true + } + + internal mutating func decodeSingularFixed32Field(value: inout UInt32?) throws { + guard fieldWireFormat == WireFormat.fixed32 else { + return + } + var i: UInt32 = 0 + try decodeFourByteNumber(value: &i) + value = UInt32(littleEndian: i) + consumed = true + } + + internal mutating func decodeRepeatedFixed32Field(value: inout [UInt32]) throws { + switch fieldWireFormat { + case WireFormat.fixed32: + var i: UInt32 = 0 + try decodeFourByteNumber(value: &i) + value.append(UInt32(littleEndian: i)) + consumed = true + case WireFormat.lengthDelimited: + var n: Int = 0 + let p = try getFieldBodyBytes(count: &n) + value.reserveCapacity(value.count + n / MemoryLayout.size) + var decoder = BinaryDecoder(forReadingFrom: p, count: n, parent: self) + var i: UInt32 = 0 + while !decoder.complete { + try decoder.decodeFourByteNumber(value: &i) + value.append(UInt32(littleEndian: i)) + } + consumed = true + default: + return + } + } + + internal mutating func decodeSingularFixed64Field(value: inout UInt64) throws { + guard fieldWireFormat == WireFormat.fixed64 else { + return + } + var i: UInt64 = 0 + try decodeEightByteNumber(value: &i) + value = UInt64(littleEndian: i) + consumed = true + } + + internal mutating func decodeSingularFixed64Field(value: inout UInt64?) throws { + guard fieldWireFormat == WireFormat.fixed64 else { + return + } + var i: UInt64 = 0 + try decodeEightByteNumber(value: &i) + value = UInt64(littleEndian: i) + consumed = true + } + + internal mutating func decodeRepeatedFixed64Field(value: inout [UInt64]) throws { + switch fieldWireFormat { + case WireFormat.fixed64: + var i: UInt64 = 0 + try decodeEightByteNumber(value: &i) + value.append(UInt64(littleEndian: i)) + consumed = true + case WireFormat.lengthDelimited: + var n: Int = 0 + let p = try getFieldBodyBytes(count: &n) + value.reserveCapacity(value.count + n / MemoryLayout.size) + var decoder = BinaryDecoder(forReadingFrom: p, count: n, parent: self) + var i: UInt64 = 0 + while !decoder.complete { + try decoder.decodeEightByteNumber(value: &i) + value.append(UInt64(littleEndian: i)) + } + consumed = true + default: + return + } + } + + internal mutating func decodeSingularSFixed32Field(value: inout Int32) throws { + guard fieldWireFormat == WireFormat.fixed32 else { + return + } + var i: Int32 = 0 + try decodeFourByteNumber(value: &i) + value = Int32(littleEndian: i) + consumed = true + } + + internal mutating func decodeSingularSFixed32Field(value: inout Int32?) throws { + guard fieldWireFormat == WireFormat.fixed32 else { + return + } + var i: Int32 = 0 + try decodeFourByteNumber(value: &i) + value = Int32(littleEndian: i) + consumed = true + } + + internal mutating func decodeRepeatedSFixed32Field(value: inout [Int32]) throws { + switch fieldWireFormat { + case WireFormat.fixed32: + var i: Int32 = 0 + try decodeFourByteNumber(value: &i) + value.append(Int32(littleEndian: i)) + consumed = true + case WireFormat.lengthDelimited: + var n: Int = 0 + let p = try getFieldBodyBytes(count: &n) + value.reserveCapacity(value.count + n / MemoryLayout.size) + var decoder = BinaryDecoder(forReadingFrom: p, count: n, parent: self) + var i: Int32 = 0 + while !decoder.complete { + try decoder.decodeFourByteNumber(value: &i) + value.append(Int32(littleEndian: i)) + } + consumed = true + default: + return + } + } + + internal mutating func decodeSingularSFixed64Field(value: inout Int64) throws { + guard fieldWireFormat == WireFormat.fixed64 else { + return + } + var i: Int64 = 0 + try decodeEightByteNumber(value: &i) + value = Int64(littleEndian: i) + consumed = true + } + + internal mutating func decodeSingularSFixed64Field(value: inout Int64?) throws { + guard fieldWireFormat == WireFormat.fixed64 else { + return + } + var i: Int64 = 0 + try decodeEightByteNumber(value: &i) + value = Int64(littleEndian: i) + consumed = true + } + + internal mutating func decodeRepeatedSFixed64Field(value: inout [Int64]) throws { + switch fieldWireFormat { + case WireFormat.fixed64: + var i: Int64 = 0 + try decodeEightByteNumber(value: &i) + value.append(Int64(littleEndian: i)) + consumed = true + case WireFormat.lengthDelimited: + var n: Int = 0 + let p = try getFieldBodyBytes(count: &n) + value.reserveCapacity(value.count + n / MemoryLayout.size) + var decoder = BinaryDecoder(forReadingFrom: p, count: n, parent: self) + var i: Int64 = 0 + while !decoder.complete { + try decoder.decodeEightByteNumber(value: &i) + value.append(Int64(littleEndian: i)) + } + consumed = true + default: + return + } + } + + internal mutating func decodeSingularBoolField(value: inout Bool) throws { + guard fieldWireFormat == WireFormat.varint else { + return + } + value = try decodeVarint() != 0 + consumed = true + } + + internal mutating func decodeSingularBoolField(value: inout Bool?) throws { + guard fieldWireFormat == WireFormat.varint else { + return + } + value = try decodeVarint() != 0 + consumed = true + } + + internal mutating func decodeRepeatedBoolField(value: inout [Bool]) throws { + switch fieldWireFormat { + case WireFormat.varint: + let varint = try decodeVarint() + value.append(varint != 0) + consumed = true + case WireFormat.lengthDelimited: + var n: Int = 0 + let p = try getFieldBodyBytes(count: &n) + let ints = Varint.countVarintsInBuffer(start: p, count: n) + value.reserveCapacity(value.count + ints) + var decoder = BinaryDecoder(forReadingFrom: p, count: n, parent: self) + while !decoder.complete { + let t = try decoder.decodeVarint() + value.append(t != 0) + } + consumed = true + default: + return + } + } + + internal mutating func decodeSingularStringField(value: inout String) throws { + guard fieldWireFormat == WireFormat.lengthDelimited else { + return + } + var n: Int = 0 + let p = try getFieldBodyBytes(count: &n) + if let s = utf8ToString(bytes: p, count: n) { + value = s + consumed = true + } else { + throw BinaryDecodingError.invalidUTF8 + } + } + + internal mutating func decodeSingularStringField(value: inout String?) throws { + guard fieldWireFormat == WireFormat.lengthDelimited else { + return + } + var n: Int = 0 + let p = try getFieldBodyBytes(count: &n) + if let s = utf8ToString(bytes: p, count: n) { + value = s + consumed = true + } else { + throw BinaryDecodingError.invalidUTF8 + } + } + + internal mutating func decodeRepeatedStringField(value: inout [String]) throws { + switch fieldWireFormat { + case WireFormat.lengthDelimited: + var n: Int = 0 + let p = try getFieldBodyBytes(count: &n) + if let s = utf8ToString(bytes: p, count: n) { + value.append(s) + consumed = true + } else { + throw BinaryDecodingError.invalidUTF8 + } + default: + return + } + } + + internal mutating func decodeSingularBytesField(value: inout Data) throws { + guard fieldWireFormat == WireFormat.lengthDelimited else { + return + } + var n: Int = 0 + let p = try getFieldBodyBytes(count: &n) + value = Data(bytes: p, count: n) + consumed = true + } + + internal mutating func decodeSingularBytesField(value: inout Data?) throws { + guard fieldWireFormat == WireFormat.lengthDelimited else { + return + } + var n: Int = 0 + let p = try getFieldBodyBytes(count: &n) + value = Data(bytes: p, count: n) + consumed = true + } + + internal mutating func decodeRepeatedBytesField(value: inout [Data]) throws { + switch fieldWireFormat { + case WireFormat.lengthDelimited: + var n: Int = 0 + let p = try getFieldBodyBytes(count: &n) + value.append(Data(bytes: p, count: n)) + consumed = true + default: + return + } + } + + internal mutating func decodeSingularEnumField(value: inout E?) throws where E.RawValue == Int { + guard fieldWireFormat == WireFormat.varint else { + return + } + let varint = try decodeVarint() + if let v = E(rawValue: Int(Int32(truncatingIfNeeded: varint))) { + value = v + consumed = true + } + } + + internal mutating func decodeSingularEnumField(value: inout E) throws where E.RawValue == Int { + guard fieldWireFormat == WireFormat.varint else { + return + } + let varint = try decodeVarint() + if let v = E(rawValue: Int(Int32(truncatingIfNeeded: varint))) { + value = v + consumed = true + } + } + + internal mutating func decodeRepeatedEnumField(value: inout [E]) throws where E.RawValue == Int { + switch fieldWireFormat { + case WireFormat.varint: + let varint = try decodeVarint() + if let v = E(rawValue: Int(Int32(truncatingIfNeeded: varint))) { + value.append(v) + consumed = true + } + case WireFormat.lengthDelimited: + var n: Int = 0 + var extras: [Int32]? + let p = try getFieldBodyBytes(count: &n) + let ints = Varint.countVarintsInBuffer(start: p, count: n) + value.reserveCapacity(value.count + ints) + var subdecoder = BinaryDecoder(forReadingFrom: p, count: n, parent: self) + while !subdecoder.complete { + let u64 = try subdecoder.decodeVarint() + let i32 = Int32(truncatingIfNeeded: u64) + if let v = E(rawValue: Int(i32)) { + value.append(v) + } else if !options.discardUnknownFields { + if extras == nil { + extras = [] + } + extras!.append(i32) + } + } + if let extras = extras { + let fieldTag = FieldTag(fieldNumber: fieldNumber, wireFormat: .lengthDelimited) + let bodySize = extras.reduce(0) { $0 + Varint.encodedSize(of: Int64($1)) } + let fieldSize = Varint.encodedSize(of: fieldTag.rawValue) + Varint.encodedSize(of: Int64(bodySize)) + bodySize + var field = Data(count: fieldSize) + field.withUnsafeMutableBytes { (body: UnsafeMutableRawBufferPointer) in + if let baseAddress = body.baseAddress, body.count > 0 { + var encoder = BinaryEncoder(forWritingInto: baseAddress) + encoder.startField(tag: fieldTag) + encoder.putVarInt(value: Int64(bodySize)) + for v in extras { + encoder.putVarInt(value: Int64(v)) + } + } + } + unknownOverride = field + } + consumed = true + default: + return + } + } + + internal mutating func decodeSingularMessageField(value: inout M?) throws { + guard fieldWireFormat == WireFormat.lengthDelimited else { + return + } + var count: Int = 0 + let p = try getFieldBodyBytes(count: &count) + if value == nil { + value = M() + } + var subDecoder = BinaryDecoder(forReadingFrom: p, count: count, parent: self) + try subDecoder.decodeFullMessage(message: &value!) + consumed = true + } + + internal mutating func decodeRepeatedMessageField(value: inout [M]) throws { + guard fieldWireFormat == WireFormat.lengthDelimited else { + return + } + var count: Int = 0 + let p = try getFieldBodyBytes(count: &count) + var newValue = M() + var subDecoder = BinaryDecoder(forReadingFrom: p, count: count, parent: self) + try subDecoder.decodeFullMessage(message: &newValue) + value.append(newValue) + consumed = true + } + + internal mutating func decodeFullMessage(message: inout M) throws { + try incrementRecursionDepth() + try message.decodeMessage(decoder: &self) + decrementRecursionDepth() + guard complete else { + throw BinaryDecodingError.trailingGarbage + } + if let unknownData = unknownData { + message.unknownFields.append(protobufData: unknownData) + } + } + + internal mutating func decodeSingularGroupField(value: inout G?) throws { + var group = value ?? G() + if try decodeFullGroup(group: &group, fieldNumber: fieldNumber) { + value = group + consumed = true + } + } + + internal mutating func decodeRepeatedGroupField(value: inout [G]) throws { + var group = G() + if try decodeFullGroup(group: &group, fieldNumber: fieldNumber) { + value.append(group) + consumed = true + } + } + + private mutating func decodeFullGroup(group: inout G, fieldNumber: Int) throws -> Bool { + guard fieldWireFormat == WireFormat.startGroup else { + return false + } + assert(unknownData == nil) + + try incrementRecursionDepth() + + // This works by making a clone of the current decoder state and + // setting `groupFieldNumber` to signal `nextFieldNumber()` to watch + // for that as a marker for having reached the end of a group/message. + // Groups within groups works because this effectively makes a stack + // of decoders, each one looking for their ending tag. + + var subDecoder = self + subDecoder.groupFieldNumber = fieldNumber + // startGroup was read, so current tag/data is done (otherwise the + // startTag will end up in the unknowns of the first thing decoded). + subDecoder.consumed = true + try group.decodeMessage(decoder: &subDecoder) + guard subDecoder.fieldNumber == fieldNumber && subDecoder.fieldWireFormat == .endGroup else { + throw BinaryDecodingError.truncated + } + if let groupUnknowns = subDecoder.unknownData { + group.unknownFields.append(protobufData: groupUnknowns) + } + // Advance over what was parsed. + consume(length: available - subDecoder.available) + assert(recursionBudget == subDecoder.recursionBudget) + decrementRecursionDepth() + return true + } + + internal mutating func decodeMapField(fieldType: _ProtobufMap.Type, value: inout _ProtobufMap.BaseType) throws { + guard fieldWireFormat == WireFormat.lengthDelimited else { + return + } + var k: KeyType.BaseType? + var v: ValueType.BaseType? + var count: Int = 0 + let p = try getFieldBodyBytes(count: &count) + var subdecoder = BinaryDecoder(forReadingFrom: p, count: count, parent: self) + while let tag = try subdecoder.getTag() { + if tag.wireFormat == .endGroup { + throw BinaryDecodingError.malformedProtobuf + } + let fieldNumber = tag.fieldNumber + switch fieldNumber { + case 1: + try KeyType.decodeSingular(value: &k, from: &subdecoder) + case 2: + try ValueType.decodeSingular(value: &v, from: &subdecoder) + default: // Skip any other fields within the map entry object + try subdecoder.skip() + } + } + if !subdecoder.complete { + throw BinaryDecodingError.trailingGarbage + } + // A map<> definition can't provide a default value for the keys/values, + // so it is safe to use the proto3 default to get the right + // integer/string/bytes. The one catch is a proto2 enum (which can be the + // value) can have a non zero value, but that case is the next + // custom decodeMapField<>() method and handles it. + value[k ?? KeyType.proto3DefaultValue] = v ?? ValueType.proto3DefaultValue + consumed = true + } + + internal mutating func decodeMapField(fieldType: _ProtobufEnumMap.Type, value: inout _ProtobufEnumMap.BaseType) throws where ValueType.RawValue == Int { + guard fieldWireFormat == WireFormat.lengthDelimited else { + return + } + var k: KeyType.BaseType? + var v: ValueType? + var count: Int = 0 + let p = try getFieldBodyBytes(count: &count) + var subdecoder = BinaryDecoder(forReadingFrom: p, count: count, parent: self) + while let tag = try subdecoder.getTag() { + if tag.wireFormat == .endGroup { + throw BinaryDecodingError.malformedProtobuf + } + let fieldNumber = tag.fieldNumber + switch fieldNumber { + case 1: // Keys are basic types + try KeyType.decodeSingular(value: &k, from: &subdecoder) + case 2: // Value is an Enum type + try subdecoder.decodeSingularEnumField(value: &v) + if v == nil && tag.wireFormat == .varint { + // Enum decode fail and wire format was varint, so this had to + // have been a proto2 unknown enum value. This whole map entry + // into the parent message's unknown fields. If the wire format + // was wrong, treat it like an unknown field and drop it with + // the map entry. + return + } + default: // Skip any other fields within the map entry object + try subdecoder.skip() + } + } + if !subdecoder.complete { + throw BinaryDecodingError.trailingGarbage + } + // A map<> definition can't provide a default value for the keys, so it + // is safe to use the proto3 default to get the right integer/string/bytes. + value[k ?? KeyType.proto3DefaultValue] = v ?? ValueType() + consumed = true + } + + internal mutating func decodeMapField(fieldType: _ProtobufMessageMap.Type, value: inout _ProtobufMessageMap.BaseType) throws { + guard fieldWireFormat == WireFormat.lengthDelimited else { + return + } + var k: KeyType.BaseType? + var v: ValueType? + var count: Int = 0 + let p = try getFieldBodyBytes(count: &count) + var subdecoder = BinaryDecoder(forReadingFrom: p, count: count, parent: self) + while let tag = try subdecoder.getTag() { + if tag.wireFormat == .endGroup { + throw BinaryDecodingError.malformedProtobuf + } + let fieldNumber = tag.fieldNumber + switch fieldNumber { + case 1: // Keys are basic types + try KeyType.decodeSingular(value: &k, from: &subdecoder) + case 2: // Value is a message type + try subdecoder.decodeSingularMessageField(value: &v) + default: // Skip any other fields within the map entry object + try subdecoder.skip() + } + } + if !subdecoder.complete { + throw BinaryDecodingError.trailingGarbage + } + // A map<> definition can't provide a default value for the keys, so it + // is safe to use the proto3 default to get the right integer/string/bytes. + value[k ?? KeyType.proto3DefaultValue] = v ?? ValueType() + consumed = true + } + + internal mutating func decodeExtensionField( + values: inout ExtensionFieldValueSet, + messageType: Message.Type, + fieldNumber: Int + ) throws { + if let ext = extensions?[messageType, fieldNumber] { + try decodeExtensionField(values: &values, + messageType: messageType, + fieldNumber: fieldNumber, + messageExtension: ext) + } + } + + /// Helper to reuse between Extension decoding and MessageSet Extension decoding. + private mutating func decodeExtensionField( + values: inout ExtensionFieldValueSet, + messageType: Message.Type, + fieldNumber: Int, + messageExtension ext: AnyMessageExtension + ) throws { + assert(!consumed) + assert(fieldNumber == ext.fieldNumber) + var fieldValue = values[fieldNumber] + // Message/Group extensions both will call back into the matching + // decode methods, so the recursion depth will be tracked there. + if fieldValue != nil { + try fieldValue!.decodeExtensionField(decoder: &self) + } else { + fieldValue = try ext._protobuf_newField(decoder: &self) + } + if consumed { + if fieldValue != nil { + values[fieldNumber] = fieldValue + } else { + // Really things should never get here, if the decoder says + // the bytes were consumed, then there should have been a + // field that consumed them (existing or created). This + // specific error result is to allow this to be more detectable. + throw BinaryDecodingError.internalExtensionError + } + } + } + + internal mutating func decodeExtensionFieldsAsMessageSet( + values: inout ExtensionFieldValueSet, + messageType: Message.Type + ) throws { + // Spin looking for the Item group, everything else will end up in unknown fields. + while let fieldNumber = try self.nextFieldNumber() { + guard fieldNumber == WireFormat.MessageSet.FieldNumbers.item && + fieldWireFormat == WireFormat.startGroup else { + continue + } + + // This is similiar to decodeFullGroup + + try incrementRecursionDepth() + var subDecoder = self + subDecoder.groupFieldNumber = fieldNumber + subDecoder.consumed = true + + let itemResult = try subDecoder.decodeMessageSetItem(values: &values, + messageType: messageType) + switch itemResult { + case .success: + // Advance over what was parsed. + consume(length: available - subDecoder.available) + consumed = true + case .handleAsUnknown: + // Nothing to do. + break + + case .malformed: + throw BinaryDecodingError.malformedProtobuf + } + + assert(recursionBudget == subDecoder.recursionBudget) + decrementRecursionDepth() + } + } + + private enum DecodeMessageSetItemResult { + case success + case handleAsUnknown + case malformed + } + + private mutating func decodeMessageSetItem( + values: inout ExtensionFieldValueSet, + messageType: Message.Type + ) throws -> DecodeMessageSetItemResult { + // This is loosely based on the C++: + // ExtensionSet::ParseMessageSetItem() + // WireFormat::ParseAndMergeMessageSetItem() + // (yes, there have two versions that are almost the same) + + var msgExtension: AnyMessageExtension? + var fieldData: Data? + + // In this loop, if wire types are wrong, things don't decode, + // just bail instead of letting things go into unknown fields. + // Wrongly formed MessageSets don't seem don't have real + // spelled out behaviors. + while let fieldNumber = try self.nextFieldNumber() { + switch fieldNumber { + case WireFormat.MessageSet.FieldNumbers.typeId: + var extensionFieldNumber: Int32 = 0 + try decodeSingularInt32Field(value: &extensionFieldNumber) + if extensionFieldNumber == 0 { return .malformed } + guard let ext = extensions?[messageType, Int(extensionFieldNumber)] else { + return .handleAsUnknown // Unknown extension. + } + msgExtension = ext + + // If there already was fieldData, decode it. + if let data = fieldData { + var wasDecoded = false + try data.withUnsafeBytes { (body: UnsafeRawBufferPointer) in + if let baseAddress = body.baseAddress, body.count > 0 { + var extDecoder = BinaryDecoder(forReadingFrom: baseAddress, + count: body.count, + parent: self) + // Prime the decode to be correct. + extDecoder.consumed = false + extDecoder.fieldWireFormat = .lengthDelimited + try extDecoder.decodeExtensionField(values: &values, + messageType: messageType, + fieldNumber: fieldNumber, + messageExtension: ext) + wasDecoded = extDecoder.consumed + } + } + if !wasDecoded { + return .malformed + } + fieldData = nil + } + + case WireFormat.MessageSet.FieldNumbers.message: + if let ext = msgExtension { + assert(consumed == false) + try decodeExtensionField(values: &values, + messageType: messageType, + fieldNumber: ext.fieldNumber, + messageExtension: ext) + if !consumed { + return .malformed + } + } else { + // The C++ references ends up appending the blocks together as length + // delimited blocks, but the parsing will only use the first block. + // So just capture a block, and then skip any others that happen to + // be found. + if fieldData == nil { + var d: Data? + try decodeSingularBytesField(value: &d) + guard let data = d else { return .malformed } + // Save it as length delimited + let payloadSize = Varint.encodedSize(of: Int64(data.count)) + data.count + var payload = Data(count: payloadSize) + payload.withUnsafeMutableBytes { (body: UnsafeMutableRawBufferPointer) in + if let baseAddress = body.baseAddress, body.count > 0 { + var encoder = BinaryEncoder(forWritingInto: baseAddress) + encoder.putBytesValue(value: data) + } + } + fieldData = payload + } else { + guard fieldWireFormat == .lengthDelimited else { return .malformed } + try skip() + consumed = true + } + } + + default: + // Skip everything else + try skip() + consumed = true + } + } + + return .success + } + + // + // Private building blocks for the parsing above. + // + // Having these be private gives the compiler maximum latitude for + // inlining. + // + + /// Private: Advance the current position. + private mutating func consume(length: Int) { + available -= length + p += length + } + + /// Private: Skip the body for the given tag. If the given tag is + /// a group, it parses up through the corresponding group end. + private mutating func skipOver(tag: FieldTag) throws { + switch tag.wireFormat { + case .varint: + if available < 1 { + throw BinaryDecodingError.truncated + } + var c = p.load(fromByteOffset: 0, as: UInt8.self) + while (c & 0x80) != 0 { + p += 1 + available -= 1 + if available < 1 { + throw BinaryDecodingError.truncated + } + c = p.load(fromByteOffset: 0, as: UInt8.self) + } + p += 1 + available -= 1 + case .fixed64: + if available < 8 { + throw BinaryDecodingError.truncated + } + p += 8 + available -= 8 + case .lengthDelimited: + let n = try decodeVarint() + if n <= UInt64(available) { + p += Int(n) + available -= Int(n) + } else { + throw BinaryDecodingError.truncated + } + case .startGroup: + try incrementRecursionDepth() + while true { + if let innerTag = try getTagWithoutUpdatingFieldStart() { + if innerTag.wireFormat == .endGroup { + if innerTag.fieldNumber == tag.fieldNumber { + decrementRecursionDepth() + break + } else { + // .endGroup for a something other than the current + // group is an invalid binary. + throw BinaryDecodingError.malformedProtobuf + } + } else { + try skipOver(tag: innerTag) + } + } else { + throw BinaryDecodingError.truncated + } + } + case .endGroup: + throw BinaryDecodingError.malformedProtobuf + case .fixed32: + if available < 4 { + throw BinaryDecodingError.truncated + } + p += 4 + available -= 4 + } + } + + /// Private: Skip to the end of the current field. + /// + /// Assumes that fieldStartP was bookmarked by a previous + /// call to getTagType(). + /// + /// On exit, fieldStartP points to the first byte of the tag, fieldEndP points + /// to the first byte after the field contents, and p == fieldEndP. + private mutating func skip() throws { + if let end = fieldEndP { + p = end + } else { + // Rewind to start of current field. + available += p - fieldStartP + p = fieldStartP + guard let tag = try getTagWithoutUpdatingFieldStart() else { + throw BinaryDecodingError.truncated + } + try skipOver(tag: tag) + fieldEndP = p + } + } + + /// Private: Parse the next raw varint from the input. + private mutating func decodeVarint() throws -> UInt64 { + if available < 1 { + throw BinaryDecodingError.truncated + } + var start = p + var length = available + var c = start.load(fromByteOffset: 0, as: UInt8.self) + start += 1 + length -= 1 + if c & 0x80 == 0 { + p = start + available = length + return UInt64(c) + } + var value = UInt64(c & 0x7f) + var shift = UInt64(7) + while true { + if length < 1 || shift > 63 { + throw BinaryDecodingError.malformedProtobuf + } + c = start.load(fromByteOffset: 0, as: UInt8.self) + start += 1 + length -= 1 + value |= UInt64(c & 0x7f) << shift + if c & 0x80 == 0 { + p = start + available = length + return value + } + shift += 7 + } + } + + /// Private: Get the tag that starts a new field. + /// This also bookmarks the start of field for a possible skip(). + internal mutating func getTag() throws -> FieldTag? { + fieldStartP = p + fieldEndP = nil + return try getTagWithoutUpdatingFieldStart() + } + + /// Private: Parse and validate the next tag without + /// bookmarking the start of the field. This is used within + /// skip() to skip over fields within a group. + private mutating func getTagWithoutUpdatingFieldStart() throws -> FieldTag? { + if available < 1 { + return nil + } + let t = try decodeVarint() + if t < UInt64(UInt32.max) { + guard let tag = FieldTag(rawValue: UInt32(truncatingIfNeeded: t)) else { + throw BinaryDecodingError.malformedProtobuf + } + fieldWireFormat = tag.wireFormat + fieldNumber = tag.fieldNumber + return tag + } else { + throw BinaryDecodingError.malformedProtobuf + } + } + + /// Private: Return a Data containing the entirety of + /// the current field, including tag. + private mutating func getRawField() throws -> Data { + try skip() + return Data(bytes: fieldStartP, count: fieldEndP! - fieldStartP) + } + + /// Private: decode a fixed-length four-byte number. This generic + /// helper handles all four-byte number types. + private mutating func decodeFourByteNumber(value: inout T) throws { + guard available >= 4 else {throw BinaryDecodingError.truncated} + withUnsafeMutableBytes(of: &value) { dest -> Void in + dest.copyMemory(from: UnsafeRawBufferPointer(start: p, count: 4)) + } + consume(length: 4) + } + + /// Private: decode a fixed-length eight-byte number. This generic + /// helper handles all eight-byte number types. + private mutating func decodeEightByteNumber(value: inout T) throws { + guard available >= 8 else {throw BinaryDecodingError.truncated} + withUnsafeMutableBytes(of: &value) { dest -> Void in + dest.copyMemory(from: UnsafeRawBufferPointer(start: p, count: 8)) + } + consume(length: 8) + } + + private mutating func decodeFloat() throws -> Float { + var littleEndianBytes: UInt32 = 0 + try decodeFourByteNumber(value: &littleEndianBytes) + var nativeEndianBytes = UInt32(littleEndian: littleEndianBytes) + var float: Float = 0 + let n = MemoryLayout.size + memcpy(&float, &nativeEndianBytes, n) + return float + } + + private mutating func decodeDouble() throws -> Double { + var littleEndianBytes: UInt64 = 0 + try decodeEightByteNumber(value: &littleEndianBytes) + var nativeEndianBytes = UInt64(littleEndian: littleEndianBytes) + var double: Double = 0 + let n = MemoryLayout.size + memcpy(&double, &nativeEndianBytes, n) + return double + } + + /// Private: Get the start and length for the body of + // a length-delimited field. + private mutating func getFieldBodyBytes(count: inout Int) throws -> UnsafeRawPointer { + let length = try decodeVarint() + if length <= UInt64(available) { + count = Int(length) + let body = p + consume(length: count) + return body + } + throw BinaryDecodingError.truncated + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/BinaryDecodingError.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/BinaryDecodingError.swift new file mode 100644 index 0000000..6c6d34f --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/BinaryDecodingError.swift @@ -0,0 +1,44 @@ +// Sources/SwiftProtobuf/BinaryDecodingError.swift - Protobuf binary decoding errors +// +// Copyright (c) 2014 - 2017 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Protobuf binary format decoding errors +/// +// ----------------------------------------------------------------------------- + +/// Describes errors that can occur when decoding a message from binary format. +public enum BinaryDecodingError: Error { + /// Extraneous data remained after decoding should have been complete. + case trailingGarbage + + /// The decoder unexpectedly reached the end of the data before it was + /// expected. + case truncated + + /// A string field was not encoded as valid UTF-8. + case invalidUTF8 + + /// The binary data was malformed in some way, such as an invalid wire format + /// or field tag. + case malformedProtobuf + + /// The definition of the message or one of its nested messages has required + /// fields but the binary data did not include values for them. You must pass + /// `partial: true` during decoding if you wish to explicitly ignore missing + /// required fields. + case missingRequiredFields + + /// An internal error happened while decoding. If this is ever encountered, + /// please file an issue with SwiftProtobuf with as much details as possible + /// for what happened (proto definitions, bytes being decoded (if possible)). + case internalExtensionError + + /// Reached the nesting limit for messages within messages while decoding. + case messageDepthLimit +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/BinaryDecodingOptions.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/BinaryDecodingOptions.swift new file mode 100644 index 0000000..63eefa8 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/BinaryDecodingOptions.swift @@ -0,0 +1,39 @@ +// Sources/SwiftProtobuf/BinaryDecodingOptions.swift - Binary decoding options +// +// Copyright (c) 2014 - 2017 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Binary decoding options +/// +// ----------------------------------------------------------------------------- + +/// Options for JSONDecoding. +public struct BinaryDecodingOptions { + /// The maximum nesting of message with messages. The default is 100. + /// + /// To prevent corrupt or malicious messages from causing stack overflows, + /// this controls how deep messages can be nested within other messages + /// while parsing. + public var messageDepthLimit: Int = 100 + + /// Discard unknown fields while parsing. The default is false, so parsering + /// does not discard unknown fields. + /// + /// The Protobuf binary format allows unknown fields to be still parsed + /// so the schema can be expanded without requiring all readers to be updated. + /// This works in part by haivng any unknown fields preserved so they can + /// be relayed on without loss. For a while the proto3 syntax definition + /// called for unknown fields to be dropped, but that lead to problems in + /// some case. The default is to follow the spec and keep them, but setting + /// this option to `true` allows a developer to strip them during a parse + /// in case they have a specific need to drop the unknown fields from the + /// object graph being created. + public var discardUnknownFields: Bool = false + + public init() {} +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/BinaryDelimited.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/BinaryDelimited.swift new file mode 100644 index 0000000..c24a7bd --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/BinaryDelimited.swift @@ -0,0 +1,232 @@ +// Sources/SwiftProtobuf/BinaryDelimited.swift - Delimited support +// +// Copyright (c) 2014 - 2017 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Helpers to read/write message with a length prefix. +/// +// ----------------------------------------------------------------------------- + +import Foundation + +/// Helper methods for reading/writing messages with a length prefix. +public enum BinaryDelimited { + /// Additional errors for delimited message handing. + public enum Error: Swift.Error { + /// If a read/write to the stream fails, but the stream's `streamError` is nil, + /// this error will be throw instead since the stream didn't provide anything + /// more specific. A common cause for this can be failing to open the stream + /// before trying to read/write to it. + case unknownStreamError + + /// While reading/writing to the stream, less than the expected bytes was + /// read/written. + case truncated + } + + /// Serialize a single size-delimited message from the given stream. Delimited + /// format allows a single file or stream to contain multiple messages, + /// whereas normally writing multiple non-delimited messages to the same + /// stream would cause them to be merged. A delimited message is a varint + /// encoding the message size followed by a message of exactly that size. + /// + /// - Parameters: + /// - message: The message to be written. + /// - to: The `OutputStream` to write the message to. The stream is + /// is assumed to be ready to be written to. + /// - partial: If `false` (the default), this method will check + /// `Message.isInitialized` before encoding to verify that all required + /// fields are present. If any are missing, this method throws + /// `BinaryEncodingError.missingRequiredFields`. + /// - Throws: `BinaryEncodingError` if encoding fails, throws + /// `BinaryDelimited.Error` for some writing errors, or the + /// underlying `OutputStream.streamError` for a stream error. + public static func serialize( + message: Message, + to stream: OutputStream, + partial: Bool = false + ) throws { + // TODO: Revisit to avoid the extra buffering when encoding is streamed in general. + let serialized = try message.serializedData(partial: partial) + let totalSize = Varint.encodedSize(of: UInt64(serialized.count)) + serialized.count + var data = Data(count: totalSize) + data.withUnsafeMutableBytes { (body: UnsafeMutableRawBufferPointer) in + if let baseAddress = body.baseAddress, body.count > 0 { + var encoder = BinaryEncoder(forWritingInto: baseAddress) + encoder.putBytesValue(value: serialized) + } + } + + var written: Int = 0 + data.withUnsafeBytes { (body: UnsafeRawBufferPointer) in + if let baseAddress = body.baseAddress, body.count > 0 { + // This assumingMemoryBound is technically unsafe, but without SR-11078 + // (https://bugs.swift.org/browse/SR-11087) we don't have another option. + // It should be "safe enough". + let pointer = baseAddress.assumingMemoryBound(to: UInt8.self) + written = stream.write(pointer, maxLength: totalSize) + } + } + + if written != totalSize { + if written == -1 { + if let streamError = stream.streamError { + throw streamError + } + throw BinaryDelimited.Error.unknownStreamError + } + throw BinaryDelimited.Error.truncated + } + } + + /// Reads a single size-delimited message from the given stream. Delimited + /// format allows a single file or stream to contain multiple messages, + /// whereas normally parsing consumes the entire input. A delimited message + /// is a varint encoding the message size followed by a message of exactly + /// exactly that size. + /// + /// - Parameters: + /// - messageType: The type of message to read. + /// - from: The `InputStream` to read the data from. The stream is assumed + /// to be ready to read from. + /// - extensions: An `ExtensionMap` used to look up and decode any + /// extensions in this message or messages nested within this message's + /// fields. + /// - partial: If `false` (the default), this method will check + /// `Message.isInitialized` before encoding to verify that all required + /// fields are present. If any are missing, this method throws + /// `BinaryEncodingError.missingRequiredFields`. + /// - options: The BinaryDecodingOptions to use. + /// - Returns: The message read. + /// - Throws: `BinaryDecodingError` if decoding fails, throws + /// `BinaryDelimited.Error` for some reading errors, and the + /// underlying InputStream.streamError for a stream error. + public static func parse( + messageType: M.Type, + from stream: InputStream, + extensions: ExtensionMap? = nil, + partial: Bool = false, + options: BinaryDecodingOptions = BinaryDecodingOptions() + ) throws -> M { + var message = M() + try merge(into: &message, + from: stream, + extensions: extensions, + partial: partial, + options: options) + return message + } + + /// Updates the message by reading a single size-delimited message from + /// the given stream. Delimited format allows a single file or stream to + /// contain multiple messages, whereas normally parsing consumes the entire + /// input. A delimited message is a varint encoding the message size + /// followed by a message of exactly that size. + /// + /// - Note: If this method throws an error, the message may still have been + /// partially mutated by the binary data that was decoded before the error + /// occurred. + /// + /// - Parameters: + /// - mergingTo: The message to merge the data into. + /// - from: The `InputStream` to read the data from. The stream is assumed + /// to be ready to read from. + /// - extensions: An `ExtensionMap` used to look up and decode any + /// extensions in this message or messages nested within this message's + /// fields. + /// - partial: If `false` (the default), this method will check + /// `Message.isInitialized` before encoding to verify that all required + /// fields are present. If any are missing, this method throws + /// `BinaryEncodingError.missingRequiredFields`. + /// - options: The BinaryDecodingOptions to use. + /// - Throws: `BinaryDecodingError` if decoding fails, throws + /// `BinaryDelimited.Error` for some reading errors, and the + /// underlying InputStream.streamError for a stream error. + public static func merge( + into message: inout M, + from stream: InputStream, + extensions: ExtensionMap? = nil, + partial: Bool = false, + options: BinaryDecodingOptions = BinaryDecodingOptions() + ) throws { + let length = try Int(decodeVarint(stream)) + if length == 0 { + // The message was all defaults, nothing to actually read. + return + } + + var data = Data(count: length) + var bytesRead: Int = 0 + data.withUnsafeMutableBytes { (body: UnsafeMutableRawBufferPointer) in + if let baseAddress = body.baseAddress, body.count > 0 { + // This assumingMemoryBound is technically unsafe, but without SR-11078 + // (https://bugs.swift.org/browse/SR-11087) we don't have another option. + // It should be "safe enough". + let pointer = baseAddress.assumingMemoryBound(to: UInt8.self) + bytesRead = stream.read(pointer, maxLength: length) + } + } + + if bytesRead != length { + if bytesRead == -1 { + if let streamError = stream.streamError { + throw streamError + } + throw BinaryDelimited.Error.unknownStreamError + } + throw BinaryDelimited.Error.truncated + } + + try message.merge(serializedData: data, + extensions: extensions, + partial: partial, + options: options) + } +} + +// TODO: This should go away when encoding/decoding are more stream based +// as that should provide a more direct way to do this. This is basically +// a rewrite of BinaryDecoder.decodeVarint(). +internal func decodeVarint(_ stream: InputStream) throws -> UInt64 { + + // Buffer to reuse within nextByte. + let readBuffer = UnsafeMutablePointer.allocate(capacity: 1) + #if swift(>=4.1) + defer { readBuffer.deallocate() } + #else + defer { readBuffer.deallocate(capacity: 1) } + #endif + + func nextByte() throws -> UInt8 { + let bytesRead = stream.read(readBuffer, maxLength: 1) + if bytesRead != 1 { + if bytesRead == -1 { + if let streamError = stream.streamError { + throw streamError + } + throw BinaryDelimited.Error.unknownStreamError + } + throw BinaryDelimited.Error.truncated + } + return readBuffer[0] + } + + var value: UInt64 = 0 + var shift: UInt64 = 0 + while true { + let c = try nextByte() + value |= UInt64(c & 0x7f) << shift + if c & 0x80 == 0 { + return value + } + shift += 7 + if shift > 63 { + throw BinaryDecodingError.malformedProtobuf + } + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/BinaryEncoder.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/BinaryEncoder.swift new file mode 100644 index 0000000..6a82084 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/BinaryEncoder.swift @@ -0,0 +1,155 @@ +// Sources/SwiftProtobuf/BinaryEncoder.swift - Binary encoding support +// +// Copyright (c) 2014 - 2016 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Core support for protobuf binary encoding. Note that this is built +/// on the general traversal machinery. +/// +// ----------------------------------------------------------------------------- + +import Foundation + +/* + * Encoder for Binary Protocol Buffer format + */ +internal struct BinaryEncoder { + private var pointer: UnsafeMutableRawPointer + + init(forWritingInto pointer: UnsafeMutableRawPointer) { + self.pointer = pointer + } + + private mutating func append(_ byte: UInt8) { + pointer.storeBytes(of: byte, as: UInt8.self) + pointer = pointer.advanced(by: 1) + } + + private mutating func append(contentsOf data: Data) { + data.withUnsafeBytes { dataPointer in + if let baseAddress = dataPointer.baseAddress, dataPointer.count > 0 { + pointer.copyMemory(from: baseAddress, byteCount: dataPointer.count) + pointer = pointer.advanced(by: dataPointer.count) + } + } + } + + @discardableResult + private mutating func append(contentsOf bufferPointer: UnsafeRawBufferPointer) -> Int { + let count = bufferPointer.count + if let baseAddress = bufferPointer.baseAddress, count > 0 { + memcpy(pointer, baseAddress, count) + } + pointer = pointer.advanced(by: count) + return count + } + + func distance(pointer: UnsafeMutableRawPointer) -> Int { + return pointer.distance(to: self.pointer) + } + + mutating func appendUnknown(data: Data) { + append(contentsOf: data) + } + + mutating func startField(fieldNumber: Int, wireFormat: WireFormat) { + startField(tag: FieldTag(fieldNumber: fieldNumber, wireFormat: wireFormat)) + } + + mutating func startField(tag: FieldTag) { + putVarInt(value: UInt64(tag.rawValue)) + } + + mutating func putVarInt(value: UInt64) { + var v = value + while v > 127 { + append(UInt8(v & 0x7f | 0x80)) + v >>= 7 + } + append(UInt8(v)) + } + + mutating func putVarInt(value: Int64) { + putVarInt(value: UInt64(bitPattern: value)) + } + + mutating func putVarInt(value: Int) { + putVarInt(value: Int64(value)) + } + + mutating func putZigZagVarInt(value: Int64) { + let coded = ZigZag.encoded(value) + putVarInt(value: coded) + } + + mutating func putBoolValue(value: Bool) { + append(value ? 1 : 0) + } + + mutating func putFixedUInt64(value: UInt64) { + var v = value.littleEndian + let n = MemoryLayout.size + memcpy(pointer, &v, n) + pointer = pointer.advanced(by: n) + } + + mutating func putFixedUInt32(value: UInt32) { + var v = value.littleEndian + let n = MemoryLayout.size + memcpy(pointer, &v, n) + pointer = pointer.advanced(by: n) + } + + mutating func putFloatValue(value: Float) { + let n = MemoryLayout.size + var v = value + var nativeBytes: UInt32 = 0 + memcpy(&nativeBytes, &v, n) + var littleEndianBytes = nativeBytes.littleEndian + memcpy(pointer, &littleEndianBytes, n) + pointer = pointer.advanced(by: n) + } + + mutating func putDoubleValue(value: Double) { + let n = MemoryLayout.size + var v = value + var nativeBytes: UInt64 = 0 + memcpy(&nativeBytes, &v, n) + var littleEndianBytes = nativeBytes.littleEndian + memcpy(pointer, &littleEndianBytes, n) + pointer = pointer.advanced(by: n) + } + + // Write a string field, including the leading index/tag value. + mutating func putStringValue(value: String) { + let utf8 = value.utf8 + #if swift(>=5.0) + // If the String does not support an internal representation in a form + // of contiguous storage, body is not called and nil is returned. + let isAvailable = utf8.withContiguousStorageIfAvailable { (body: UnsafeBufferPointer) -> Int in + putVarInt(value: body.count) + return append(contentsOf: UnsafeRawBufferPointer(body)) + } + #else + let isAvailable: Int? = nil + #endif + if isAvailable == nil { + let count = utf8.count + putVarInt(value: count) + for b in utf8 { + pointer.storeBytes(of: b, as: UInt8.self) + pointer = pointer.advanced(by: 1) + } + } + } + + mutating func putBytesValue(value: Data) { + putVarInt(value: value.count) + append(contentsOf: value) + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/BinaryEncodingError.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/BinaryEncodingError.swift new file mode 100644 index 0000000..584d823 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/BinaryEncodingError.swift @@ -0,0 +1,27 @@ +// Sources/SwiftProtobuf/BinaryEncodingError.swift - Error constants +// +// Copyright (c) 2014 - 2016 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Enum constants that identify the particular error. +/// +// ----------------------------------------------------------------------------- + +/// Describes errors that can occur when decoding a message from binary format. +public enum BinaryEncodingError: Error { + /// `Any` fields that were decoded from JSON cannot be re-encoded to binary + /// unless the object they hold is a well-known type or a type registered via + /// `Google_Protobuf_Any.register()`. + case anyTranscodeFailure + + /// The definition of the message or one of its nested messages has required + /// fields but the message being encoded did not include values for them. You + /// must pass `partial: true` during encoding if you wish to explicitly ignore + /// missing required fields. + case missingRequiredFields +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/BinaryEncodingSizeVisitor.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/BinaryEncodingSizeVisitor.swift new file mode 100644 index 0000000..e43adaf --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/BinaryEncodingSizeVisitor.swift @@ -0,0 +1,473 @@ +// Sources/SwiftProtobuf/BinaryEncodingSizeVisitor.swift - Binary size calculation support +// +// Copyright (c) 2014 - 2016 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Visitor used during binary encoding that precalcuates the size of a +/// serialized message. +/// +// ----------------------------------------------------------------------------- + +import Foundation + +/// Visitor that calculates the binary-encoded size of a message so that a +/// properly sized `Data` or `UInt8` array can be pre-allocated before +/// serialization. +internal struct BinaryEncodingSizeVisitor: Visitor { + + /// Accumulates the required size of the message during traversal. + var serializedSize: Int = 0 + + init() {} + + mutating func visitUnknown(bytes: Data) throws { + serializedSize += bytes.count + } + + mutating func visitSingularFloatField(value: Float, fieldNumber: Int) throws { + let tagSize = FieldTag(fieldNumber: fieldNumber, wireFormat: .fixed32).encodedSize + serializedSize += tagSize + MemoryLayout.size + } + + mutating func visitSingularDoubleField(value: Double, fieldNumber: Int) throws { + let tagSize = FieldTag(fieldNumber: fieldNumber, wireFormat: .fixed64).encodedSize + serializedSize += tagSize + MemoryLayout.size + } + + mutating func visitSingularInt32Field(value: Int32, fieldNumber: Int) throws { + try visitSingularInt64Field(value: Int64(value), fieldNumber: fieldNumber) + } + + mutating func visitSingularInt64Field(value: Int64, fieldNumber: Int) throws { + let tagSize = FieldTag(fieldNumber: fieldNumber, wireFormat: .varint).encodedSize + serializedSize += tagSize + Varint.encodedSize(of: value) + } + + mutating func visitSingularUInt32Field(value: UInt32, fieldNumber: Int) throws { + try visitSingularUInt64Field(value: UInt64(value), fieldNumber: fieldNumber) + } + + mutating func visitSingularUInt64Field(value: UInt64, fieldNumber: Int) throws { + let tagSize = FieldTag(fieldNumber: fieldNumber, wireFormat: .varint).encodedSize + serializedSize += tagSize + Varint.encodedSize(of: value) + } + + mutating func visitSingularSInt32Field(value: Int32, fieldNumber: Int) throws { + let tagSize = FieldTag(fieldNumber: fieldNumber, wireFormat: .varint).encodedSize + serializedSize += tagSize + Varint.encodedSize(of: ZigZag.encoded(value)) + } + + mutating func visitSingularSInt64Field(value: Int64, fieldNumber: Int) throws { + let tagSize = FieldTag(fieldNumber: fieldNumber, wireFormat: .varint).encodedSize + serializedSize += tagSize + Varint.encodedSize(of: ZigZag.encoded(value)) + } + + mutating func visitSingularFixed32Field(value: UInt32, fieldNumber: Int) throws { + let tagSize = FieldTag(fieldNumber: fieldNumber, wireFormat: .fixed32).encodedSize + serializedSize += tagSize + MemoryLayout.size + } + + mutating func visitSingularFixed64Field(value: UInt64, fieldNumber: Int) throws { + let tagSize = FieldTag(fieldNumber: fieldNumber, wireFormat: .fixed64).encodedSize + serializedSize += tagSize + MemoryLayout.size + } + + mutating func visitSingularSFixed32Field(value: Int32, fieldNumber: Int) throws { + let tagSize = FieldTag(fieldNumber: fieldNumber, wireFormat: .fixed32).encodedSize + serializedSize += tagSize + MemoryLayout.size + } + + mutating func visitSingularSFixed64Field(value: Int64, fieldNumber: Int) throws { + let tagSize = FieldTag(fieldNumber: fieldNumber, wireFormat: .fixed64).encodedSize + serializedSize += tagSize + MemoryLayout.size + } + + mutating func visitSingularBoolField(value: Bool, fieldNumber: Int) throws { + let tagSize = FieldTag(fieldNumber: fieldNumber, wireFormat: .varint).encodedSize + serializedSize += tagSize + 1 + } + + mutating func visitSingularStringField(value: String, fieldNumber: Int) throws { + let tagSize = FieldTag(fieldNumber: fieldNumber, wireFormat: .lengthDelimited).encodedSize + let count = value.utf8.count + serializedSize += tagSize + Varint.encodedSize(of: Int64(count)) + count + } + + mutating func visitSingularBytesField(value: Data, fieldNumber: Int) throws { + let tagSize = FieldTag(fieldNumber: fieldNumber, wireFormat: .lengthDelimited).encodedSize + let count = value.count + serializedSize += tagSize + Varint.encodedSize(of: Int64(count)) + count + } + + // The default impls for visitRepeated*Field would work, but by implementing + // these directly, the calculation for the tag overhead can be optimized and + // the fixed width fields can be simple multiplication. + + mutating func visitRepeatedFloatField(value: [Float], fieldNumber: Int) throws { + assert(!value.isEmpty) + let tagSize = FieldTag(fieldNumber: fieldNumber, wireFormat: .fixed32).encodedSize + serializedSize += tagSize * value.count + MemoryLayout.size * value.count + } + + mutating func visitRepeatedDoubleField(value: [Double], fieldNumber: Int) throws { + assert(!value.isEmpty) + let tagSize = FieldTag(fieldNumber: fieldNumber, wireFormat: .fixed64).encodedSize + serializedSize += tagSize * value.count + MemoryLayout.size * value.count + } + + mutating func visitRepeatedInt32Field(value: [Int32], fieldNumber: Int) throws { + assert(!value.isEmpty) + let tagSize = FieldTag(fieldNumber: fieldNumber, wireFormat: .varint).encodedSize + let dataSize = value.reduce(0) { $0 + Varint.encodedSize(of: $1) } + serializedSize += tagSize * value.count + dataSize + } + + mutating func visitRepeatedInt64Field(value: [Int64], fieldNumber: Int) throws { + assert(!value.isEmpty) + let tagSize = FieldTag(fieldNumber: fieldNumber, wireFormat: .varint).encodedSize + let dataSize = value.reduce(0) { $0 + Varint.encodedSize(of: $1) } + serializedSize += tagSize * value.count + dataSize + } + + mutating func visitRepeatedUInt32Field(value: [UInt32], fieldNumber: Int) throws { + assert(!value.isEmpty) + let tagSize = FieldTag(fieldNumber: fieldNumber, wireFormat: .varint).encodedSize + let dataSize = value.reduce(0) { $0 + Varint.encodedSize(of: $1) } + serializedSize += tagSize * value.count + dataSize + } + + mutating func visitRepeatedUInt64Field(value: [UInt64], fieldNumber: Int) throws { + assert(!value.isEmpty) + let tagSize = FieldTag(fieldNumber: fieldNumber, wireFormat: .varint).encodedSize + let dataSize = value.reduce(0) { $0 + Varint.encodedSize(of: $1) } + serializedSize += tagSize * value.count + dataSize + } + + mutating func visitRepeatedSInt32Field(value: [Int32], fieldNumber: Int) throws { + assert(!value.isEmpty) + let tagSize = FieldTag(fieldNumber: fieldNumber, wireFormat: .varint).encodedSize + let dataSize = value.reduce(0) { $0 + Varint.encodedSize(of: ZigZag.encoded($1)) } + serializedSize += tagSize * value.count + dataSize + } + + mutating func visitRepeatedSInt64Field(value: [Int64], fieldNumber: Int) throws { + assert(!value.isEmpty) + let tagSize = FieldTag(fieldNumber: fieldNumber, wireFormat: .varint).encodedSize + let dataSize = value.reduce(0) { $0 + Varint.encodedSize(of: ZigZag.encoded($1)) } + serializedSize += tagSize * value.count + dataSize + } + + mutating func visitRepeatedFixed32Field(value: [UInt32], fieldNumber: Int) throws { + assert(!value.isEmpty) + let tagSize = FieldTag(fieldNumber: fieldNumber, wireFormat: .fixed32).encodedSize + serializedSize += tagSize * value.count + MemoryLayout.size * value.count + } + + mutating func visitRepeatedFixed64Field(value: [UInt64], fieldNumber: Int) throws { + assert(!value.isEmpty) + let tagSize = FieldTag(fieldNumber: fieldNumber, wireFormat: .fixed64).encodedSize + serializedSize += tagSize * value.count + MemoryLayout.size * value.count + } + + mutating func visitRepeatedSFixed32Field(value: [Int32], fieldNumber: Int) throws { + assert(!value.isEmpty) + let tagSize = FieldTag(fieldNumber: fieldNumber, wireFormat: .fixed32).encodedSize + serializedSize += tagSize * value.count + MemoryLayout.size * value.count + } + + mutating func visitRepeatedSFixed64Field(value: [Int64], fieldNumber: Int) throws { + assert(!value.isEmpty) + let tagSize = FieldTag(fieldNumber: fieldNumber, wireFormat: .fixed64).encodedSize + serializedSize += tagSize * value.count + MemoryLayout.size * value.count + } + + mutating func visitRepeatedBoolField(value: [Bool], fieldNumber: Int) throws { + assert(!value.isEmpty) + let tagSize = FieldTag(fieldNumber: fieldNumber, wireFormat: .varint).encodedSize + serializedSize += tagSize * value.count + 1 * value.count + } + + mutating func visitRepeatedStringField(value: [String], fieldNumber: Int) throws { + assert(!value.isEmpty) + let tagSize = FieldTag(fieldNumber: fieldNumber, wireFormat: .lengthDelimited).encodedSize + let dataSize = value.reduce(0) { + let count = $1.utf8.count + return $0 + Varint.encodedSize(of: Int64(count)) + count + } + serializedSize += tagSize * value.count + dataSize + } + + mutating func visitRepeatedBytesField(value: [Data], fieldNumber: Int) throws { + assert(!value.isEmpty) + let tagSize = FieldTag(fieldNumber: fieldNumber, wireFormat: .lengthDelimited).encodedSize + let dataSize = value.reduce(0) { + let count = $1.count + return $0 + Varint.encodedSize(of: Int64(count)) + count + } + serializedSize += tagSize * value.count + dataSize + } + + // Packed field handling. + + mutating func visitPackedFloatField(value: [Float], fieldNumber: Int) throws { + assert(!value.isEmpty) + let tagSize = FieldTag(fieldNumber: fieldNumber, wireFormat: .lengthDelimited).encodedSize + let dataSize = value.count * MemoryLayout.size + serializedSize += tagSize + Varint.encodedSize(of: Int64(dataSize)) + dataSize + } + + mutating func visitPackedDoubleField(value: [Double], fieldNumber: Int) throws { + assert(!value.isEmpty) + let tagSize = FieldTag(fieldNumber: fieldNumber, wireFormat: .lengthDelimited).encodedSize + let dataSize = value.count * MemoryLayout.size + serializedSize += tagSize + Varint.encodedSize(of: Int64(dataSize)) + dataSize + } + + mutating func visitPackedInt32Field(value: [Int32], fieldNumber: Int) throws { + assert(!value.isEmpty) + let tagSize = FieldTag(fieldNumber: fieldNumber, wireFormat: .lengthDelimited).encodedSize + let dataSize = value.reduce(0) { $0 + Varint.encodedSize(of: $1) } + serializedSize += + tagSize + Varint.encodedSize(of: Int64(dataSize)) + dataSize + } + + mutating func visitPackedInt64Field(value: [Int64], fieldNumber: Int) throws { + assert(!value.isEmpty) + let tagSize = FieldTag(fieldNumber: fieldNumber, wireFormat: .lengthDelimited).encodedSize + let dataSize = value.reduce(0) { $0 + Varint.encodedSize(of: $1) } + serializedSize += + tagSize + Varint.encodedSize(of: Int64(dataSize)) + dataSize + } + + mutating func visitPackedSInt32Field(value: [Int32], fieldNumber: Int) throws { + assert(!value.isEmpty) + let tagSize = FieldTag(fieldNumber: fieldNumber, wireFormat: .lengthDelimited).encodedSize + let dataSize = value.reduce(0) { $0 + Varint.encodedSize(of: ZigZag.encoded($1)) } + serializedSize += + tagSize + Varint.encodedSize(of: Int64(dataSize)) + dataSize + } + + mutating func visitPackedSInt64Field(value: [Int64], fieldNumber: Int) throws { + assert(!value.isEmpty) + let tagSize = FieldTag(fieldNumber: fieldNumber, wireFormat: .lengthDelimited).encodedSize + let dataSize = value.reduce(0) { $0 + Varint.encodedSize(of: ZigZag.encoded($1)) } + serializedSize += + tagSize + Varint.encodedSize(of: Int64(dataSize)) + dataSize + } + + mutating func visitPackedUInt32Field(value: [UInt32], fieldNumber: Int) throws { + assert(!value.isEmpty) + let tagSize = FieldTag(fieldNumber: fieldNumber, wireFormat: .lengthDelimited).encodedSize + let dataSize = value.reduce(0) { $0 + Varint.encodedSize(of: $1) } + serializedSize += + tagSize + Varint.encodedSize(of: Int64(dataSize)) + dataSize + } + + mutating func visitPackedUInt64Field(value: [UInt64], fieldNumber: Int) throws { + assert(!value.isEmpty) + let tagSize = FieldTag(fieldNumber: fieldNumber, wireFormat: .lengthDelimited).encodedSize + let dataSize = value.reduce(0) { $0 + Varint.encodedSize(of: $1) } + serializedSize += + tagSize + Varint.encodedSize(of: Int64(dataSize)) + dataSize + } + + mutating func visitPackedFixed32Field(value: [UInt32], fieldNumber: Int) throws { + assert(!value.isEmpty) + let tagSize = FieldTag(fieldNumber: fieldNumber, wireFormat: .lengthDelimited).encodedSize + let dataSize = value.count * MemoryLayout.size + serializedSize += tagSize + Varint.encodedSize(of: Int64(dataSize)) + dataSize + } + + mutating func visitPackedFixed64Field(value: [UInt64], fieldNumber: Int) throws { + assert(!value.isEmpty) + let tagSize = FieldTag(fieldNumber: fieldNumber, wireFormat: .lengthDelimited).encodedSize + let dataSize = value.count * MemoryLayout.size + serializedSize += tagSize + Varint.encodedSize(of: Int64(dataSize)) + dataSize + } + + mutating func visitPackedSFixed32Field(value: [Int32], fieldNumber: Int) throws { + assert(!value.isEmpty) + let tagSize = FieldTag(fieldNumber: fieldNumber, wireFormat: .lengthDelimited).encodedSize + let dataSize = value.count * MemoryLayout.size + serializedSize += tagSize + Varint.encodedSize(of: Int64(dataSize)) + dataSize + } + + mutating func visitPackedSFixed64Field(value: [Int64], fieldNumber: Int) throws { + assert(!value.isEmpty) + let tagSize = FieldTag(fieldNumber: fieldNumber, wireFormat: .lengthDelimited).encodedSize + let dataSize = value.count * MemoryLayout.size + serializedSize += tagSize + Varint.encodedSize(of: Int64(dataSize)) + dataSize + } + + mutating func visitPackedBoolField(value: [Bool], fieldNumber: Int) throws { + assert(!value.isEmpty) + let tagSize = FieldTag(fieldNumber: fieldNumber, wireFormat: .lengthDelimited).encodedSize + let dataSize = value.count + serializedSize += tagSize + Varint.encodedSize(of: Int64(dataSize)) + dataSize + } + + mutating func visitSingularEnumField(value: E, + fieldNumber: Int) throws { + let tagSize = FieldTag(fieldNumber: fieldNumber, + wireFormat: .varint).encodedSize + serializedSize += tagSize + let dataSize = Varint.encodedSize(of: Int32(truncatingIfNeeded: value.rawValue)) + serializedSize += dataSize + } + + mutating func visitRepeatedEnumField(value: [E], + fieldNumber: Int) throws { + assert(!value.isEmpty) + let tagSize = FieldTag(fieldNumber: fieldNumber, + wireFormat: .varint).encodedSize + serializedSize += value.count * tagSize + let dataSize = value.reduce(0) { + $0 + Varint.encodedSize(of: Int32(truncatingIfNeeded: $1.rawValue)) + } + serializedSize += dataSize + } + + mutating func visitPackedEnumField(value: [E], + fieldNumber: Int) throws { + assert(!value.isEmpty) + let tagSize = FieldTag(fieldNumber: fieldNumber, + wireFormat: .varint).encodedSize + serializedSize += tagSize + let dataSize = value.reduce(0) { + $0 + Varint.encodedSize(of: Int32(truncatingIfNeeded: $1.rawValue)) + } + serializedSize += Varint.encodedSize(of: Int64(dataSize)) + dataSize + } + + mutating func visitSingularMessageField(value: M, + fieldNumber: Int) throws { + let tagSize = FieldTag(fieldNumber: fieldNumber, + wireFormat: .lengthDelimited).encodedSize + let messageSize = try value.serializedDataSize() + serializedSize += + tagSize + Varint.encodedSize(of: UInt64(messageSize)) + messageSize + } + + mutating func visitRepeatedMessageField(value: [M], + fieldNumber: Int) throws { + assert(!value.isEmpty) + let tagSize = FieldTag(fieldNumber: fieldNumber, + wireFormat: .lengthDelimited).encodedSize + serializedSize += value.count * tagSize + let dataSize = try value.reduce(0) { + let messageSize = try $1.serializedDataSize() + return $0 + Varint.encodedSize(of: UInt64(messageSize)) + messageSize + } + serializedSize += dataSize + } + + mutating func visitSingularGroupField(value: G, fieldNumber: Int) throws { + // The wire format doesn't matter here because the encoded size of the + // integer won't change based on the low three bits. + let tagSize = FieldTag(fieldNumber: fieldNumber, + wireFormat: .startGroup).encodedSize + serializedSize += 2 * tagSize + try value.traverse(visitor: &self) + } + + mutating func visitRepeatedGroupField(value: [G], + fieldNumber: Int) throws { + assert(!value.isEmpty) + let tagSize = FieldTag(fieldNumber: fieldNumber, + wireFormat: .startGroup).encodedSize + serializedSize += 2 * value.count * tagSize + for v in value { + try v.traverse(visitor: &self) + } + } + + mutating func visitMapField( + fieldType: _ProtobufMap.Type, + value: _ProtobufMap.BaseType, + fieldNumber: Int + ) throws { + let tagSize = FieldTag(fieldNumber: fieldNumber, + wireFormat: .lengthDelimited).encodedSize + for (k,v) in value { + var sizer = BinaryEncodingSizeVisitor() + try KeyType.visitSingular(value: k, fieldNumber: 1, with: &sizer) + try ValueType.visitSingular(value: v, fieldNumber: 2, with: &sizer) + let entrySize = sizer.serializedSize + serializedSize += Varint.encodedSize(of: Int64(entrySize)) + entrySize + } + serializedSize += value.count * tagSize + } + + mutating func visitMapField( + fieldType: _ProtobufEnumMap.Type, + value: _ProtobufEnumMap.BaseType, + fieldNumber: Int + ) throws where ValueType.RawValue == Int { + let tagSize = FieldTag(fieldNumber: fieldNumber, + wireFormat: .lengthDelimited).encodedSize + for (k,v) in value { + var sizer = BinaryEncodingSizeVisitor() + try KeyType.visitSingular(value: k, fieldNumber: 1, with: &sizer) + try sizer.visitSingularEnumField(value: v, fieldNumber: 2) + let entrySize = sizer.serializedSize + serializedSize += Varint.encodedSize(of: Int64(entrySize)) + entrySize + } + serializedSize += value.count * tagSize + } + + mutating func visitMapField( + fieldType: _ProtobufMessageMap.Type, + value: _ProtobufMessageMap.BaseType, + fieldNumber: Int + ) throws { + let tagSize = FieldTag(fieldNumber: fieldNumber, + wireFormat: .lengthDelimited).encodedSize + for (k,v) in value { + var sizer = BinaryEncodingSizeVisitor() + try KeyType.visitSingular(value: k, fieldNumber: 1, with: &sizer) + try sizer.visitSingularMessageField(value: v, fieldNumber: 2) + let entrySize = sizer.serializedSize + serializedSize += Varint.encodedSize(of: Int64(entrySize)) + entrySize + } + serializedSize += value.count * tagSize + } + + mutating func visitExtensionFieldsAsMessageSet( + fields: ExtensionFieldValueSet, + start: Int, + end: Int + ) throws { + var sizer = BinaryEncodingMessageSetSizeVisitor() + try fields.traverse(visitor: &sizer, start: start, end: end) + serializedSize += sizer.serializedSize + } +} + +extension BinaryEncodingSizeVisitor { + + // Helper Visitor to compute the sizes when writing out the extensions as MessageSets. + internal struct BinaryEncodingMessageSetSizeVisitor: SelectiveVisitor { + var serializedSize: Int = 0 + + init() {} + + mutating func visitSingularMessageField(value: M, fieldNumber: Int) throws { + var groupSize = WireFormat.MessageSet.itemTagsEncodedSize + + groupSize += Varint.encodedSize(of: Int32(fieldNumber)) + + let messageSize = try value.serializedDataSize() + groupSize += Varint.encodedSize(of: UInt64(messageSize)) + messageSize + + serializedSize += groupSize + } + + // SelectiveVisitor handles the rest. + } + +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/BinaryEncodingVisitor.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/BinaryEncodingVisitor.swift new file mode 100644 index 0000000..5cd1706 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/BinaryEncodingVisitor.swift @@ -0,0 +1,355 @@ +// Sources/SwiftProtobuf/BinaryEncodingVisitor.swift - Binary encoding support +// +// Copyright (c) 2014 - 2016 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Core support for protobuf binary encoding. Note that this is built +/// on the general traversal machinery. +/// +// ----------------------------------------------------------------------------- + +import Foundation + +/// Visitor that encodes a message graph in the protobuf binary wire format. +internal struct BinaryEncodingVisitor: Visitor { + + var encoder: BinaryEncoder + + /// Creates a new visitor that writes the binary-coded message into the memory + /// at the given pointer. + /// + /// - Precondition: `pointer` must point to an allocated block of memory that + /// is large enough to hold the entire encoded message. For performance + /// reasons, the encoder does not make any attempts to verify this. + init(forWritingInto pointer: UnsafeMutableRawPointer) { + encoder = BinaryEncoder(forWritingInto: pointer) + } + + init(encoder: BinaryEncoder) { + self.encoder = encoder + } + + mutating func visitUnknown(bytes: Data) throws { + encoder.appendUnknown(data: bytes) + } + + mutating func visitSingularFloatField(value: Float, fieldNumber: Int) throws { + encoder.startField(fieldNumber: fieldNumber, wireFormat: .fixed32) + encoder.putFloatValue(value: value) + } + + mutating func visitSingularDoubleField(value: Double, fieldNumber: Int) throws { + encoder.startField(fieldNumber: fieldNumber, wireFormat: .fixed64) + encoder.putDoubleValue(value: value) + } + + mutating func visitSingularInt64Field(value: Int64, fieldNumber: Int) throws { + try visitSingularUInt64Field(value: UInt64(bitPattern: value), fieldNumber: fieldNumber) + } + + mutating func visitSingularUInt64Field(value: UInt64, fieldNumber: Int) throws { + encoder.startField(fieldNumber: fieldNumber, wireFormat: .varint) + encoder.putVarInt(value: value) + } + + mutating func visitSingularSInt32Field(value: Int32, fieldNumber: Int) throws { + try visitSingularSInt64Field(value: Int64(value), fieldNumber: fieldNumber) + } + + mutating func visitSingularSInt64Field(value: Int64, fieldNumber: Int) throws { + try visitSingularUInt64Field(value: ZigZag.encoded(value), fieldNumber: fieldNumber) + } + + mutating func visitSingularFixed32Field(value: UInt32, fieldNumber: Int) throws { + encoder.startField(fieldNumber: fieldNumber, wireFormat: .fixed32) + encoder.putFixedUInt32(value: value) + } + + mutating func visitSingularFixed64Field(value: UInt64, fieldNumber: Int) throws { + encoder.startField(fieldNumber: fieldNumber, wireFormat: .fixed64) + encoder.putFixedUInt64(value: value) + } + + mutating func visitSingularSFixed32Field(value: Int32, fieldNumber: Int) throws { + try visitSingularFixed32Field(value: UInt32(bitPattern: value), fieldNumber: fieldNumber) + } + + mutating func visitSingularSFixed64Field(value: Int64, fieldNumber: Int) throws { + try visitSingularFixed64Field(value: UInt64(bitPattern: value), fieldNumber: fieldNumber) + } + + mutating func visitSingularBoolField(value: Bool, fieldNumber: Int) throws { + try visitSingularUInt64Field(value: value ? 1 : 0, fieldNumber: fieldNumber) + } + + mutating func visitSingularStringField(value: String, fieldNumber: Int) throws { + encoder.startField(fieldNumber: fieldNumber, wireFormat: .lengthDelimited) + encoder.putStringValue(value: value) + } + + mutating func visitSingularBytesField(value: Data, fieldNumber: Int) throws { + encoder.startField(fieldNumber: fieldNumber, wireFormat: .lengthDelimited) + encoder.putBytesValue(value: value) + } + + mutating func visitSingularEnumField(value: E, + fieldNumber: Int) throws { + try visitSingularUInt64Field(value: UInt64(bitPattern: Int64(value.rawValue)), + fieldNumber: fieldNumber) + } + + mutating func visitSingularMessageField(value: M, + fieldNumber: Int) throws { + encoder.startField(fieldNumber: fieldNumber, wireFormat: .lengthDelimited) + let length = try value.serializedDataSize() + encoder.putVarInt(value: length) + try value.traverse(visitor: &self) + } + + mutating func visitSingularGroupField(value: G, fieldNumber: Int) throws { + encoder.startField(fieldNumber: fieldNumber, wireFormat: .startGroup) + try value.traverse(visitor: &self) + encoder.startField(fieldNumber: fieldNumber, wireFormat: .endGroup) + } + + // Repeated fields are handled by the default implementations in Visitor.swift + + + // Packed Fields + + mutating func visitPackedFloatField(value: [Float], fieldNumber: Int) throws { + assert(!value.isEmpty) + encoder.startField(fieldNumber: fieldNumber, wireFormat: .lengthDelimited) + encoder.putVarInt(value: value.count * MemoryLayout.size) + for v in value { + encoder.putFloatValue(value: v) + } + } + + mutating func visitPackedDoubleField(value: [Double], fieldNumber: Int) throws { + assert(!value.isEmpty) + encoder.startField(fieldNumber: fieldNumber, wireFormat: .lengthDelimited) + encoder.putVarInt(value: value.count * MemoryLayout.size) + for v in value { + encoder.putDoubleValue(value: v) + } + } + + mutating func visitPackedInt32Field(value: [Int32], fieldNumber: Int) throws { + assert(!value.isEmpty) + encoder.startField(fieldNumber: fieldNumber, wireFormat: .lengthDelimited) + let packedSize = value.reduce(0) { $0 + Varint.encodedSize(of: $1) } + encoder.putVarInt(value: packedSize) + for v in value { + encoder.putVarInt(value: Int64(v)) + } + } + + mutating func visitPackedInt64Field(value: [Int64], fieldNumber: Int) throws { + assert(!value.isEmpty) + encoder.startField(fieldNumber: fieldNumber, wireFormat: .lengthDelimited) + let packedSize = value.reduce(0) { $0 + Varint.encodedSize(of: $1) } + encoder.putVarInt(value: packedSize) + for v in value { + encoder.putVarInt(value: v) + } + } + + mutating func visitPackedSInt32Field(value: [Int32], fieldNumber: Int) throws { + assert(!value.isEmpty) + encoder.startField(fieldNumber: fieldNumber, wireFormat: .lengthDelimited) + let packedSize = value.reduce(0) { $0 + Varint.encodedSize(of: ZigZag.encoded($1)) } + encoder.putVarInt(value: packedSize) + for v in value { + encoder.putZigZagVarInt(value: Int64(v)) + } + } + + mutating func visitPackedSInt64Field(value: [Int64], fieldNumber: Int) throws { + assert(!value.isEmpty) + encoder.startField(fieldNumber: fieldNumber, wireFormat: .lengthDelimited) + let packedSize = value.reduce(0) { $0 + Varint.encodedSize(of: ZigZag.encoded($1)) } + encoder.putVarInt(value: packedSize) + for v in value { + encoder.putZigZagVarInt(value: v) + } + } + + mutating func visitPackedUInt32Field(value: [UInt32], fieldNumber: Int) throws { + assert(!value.isEmpty) + encoder.startField(fieldNumber: fieldNumber, wireFormat: .lengthDelimited) + let packedSize = value.reduce(0) { $0 + Varint.encodedSize(of: $1) } + encoder.putVarInt(value: packedSize) + for v in value { + encoder.putVarInt(value: UInt64(v)) + } + } + + mutating func visitPackedUInt64Field(value: [UInt64], fieldNumber: Int) throws { + assert(!value.isEmpty) + encoder.startField(fieldNumber: fieldNumber, wireFormat: .lengthDelimited) + let packedSize = value.reduce(0) { $0 + Varint.encodedSize(of: $1) } + encoder.putVarInt(value: packedSize) + for v in value { + encoder.putVarInt(value: v) + } + } + + mutating func visitPackedFixed32Field(value: [UInt32], fieldNumber: Int) throws { + assert(!value.isEmpty) + encoder.startField(fieldNumber: fieldNumber, wireFormat: .lengthDelimited) + encoder.putVarInt(value: value.count * MemoryLayout.size) + for v in value { + encoder.putFixedUInt32(value: v) + } + } + + mutating func visitPackedFixed64Field(value: [UInt64], fieldNumber: Int) throws { + assert(!value.isEmpty) + encoder.startField(fieldNumber: fieldNumber, wireFormat: .lengthDelimited) + encoder.putVarInt(value: value.count * MemoryLayout.size) + for v in value { + encoder.putFixedUInt64(value: v) + } + } + + mutating func visitPackedSFixed32Field(value: [Int32], fieldNumber: Int) throws { + assert(!value.isEmpty) + encoder.startField(fieldNumber: fieldNumber, wireFormat: .lengthDelimited) + encoder.putVarInt(value: value.count * MemoryLayout.size) + for v in value { + encoder.putFixedUInt32(value: UInt32(bitPattern: v)) + } + } + + mutating func visitPackedSFixed64Field(value: [Int64], fieldNumber: Int) throws { + assert(!value.isEmpty) + encoder.startField(fieldNumber: fieldNumber, wireFormat: .lengthDelimited) + encoder.putVarInt(value: value.count * MemoryLayout.size) + for v in value { + encoder.putFixedUInt64(value: UInt64(bitPattern: v)) + } + } + + mutating func visitPackedBoolField(value: [Bool], fieldNumber: Int) throws { + assert(!value.isEmpty) + encoder.startField(fieldNumber: fieldNumber, wireFormat: .lengthDelimited) + encoder.putVarInt(value: value.count) + for v in value { + encoder.putVarInt(value: v ? 1 : 0) + } + } + + mutating func visitPackedEnumField(value: [E], fieldNumber: Int) throws { + assert(!value.isEmpty) + encoder.startField(fieldNumber: fieldNumber, wireFormat: .lengthDelimited) + let packedSize = value.reduce(0) { + $0 + Varint.encodedSize(of: Int32(truncatingIfNeeded: $1.rawValue)) + } + encoder.putVarInt(value: packedSize) + for v in value { + encoder.putVarInt(value: v.rawValue) + } + } + + mutating func visitMapField( + fieldType: _ProtobufMap.Type, + value: _ProtobufMap.BaseType, + fieldNumber: Int + ) throws { + for (k,v) in value { + encoder.startField(fieldNumber: fieldNumber, wireFormat: .lengthDelimited) + var sizer = BinaryEncodingSizeVisitor() + try KeyType.visitSingular(value: k, fieldNumber: 1, with: &sizer) + try ValueType.visitSingular(value: v, fieldNumber: 2, with: &sizer) + let entrySize = sizer.serializedSize + encoder.putVarInt(value: entrySize) + try KeyType.visitSingular(value: k, fieldNumber: 1, with: &self) + try ValueType.visitSingular(value: v, fieldNumber: 2, with: &self) + } + } + + mutating func visitMapField( + fieldType: _ProtobufEnumMap.Type, + value: _ProtobufEnumMap.BaseType, + fieldNumber: Int + ) throws where ValueType.RawValue == Int { + for (k,v) in value { + encoder.startField(fieldNumber: fieldNumber, wireFormat: .lengthDelimited) + var sizer = BinaryEncodingSizeVisitor() + try KeyType.visitSingular(value: k, fieldNumber: 1, with: &sizer) + try sizer.visitSingularEnumField(value: v, fieldNumber: 2) + let entrySize = sizer.serializedSize + encoder.putVarInt(value: entrySize) + try KeyType.visitSingular(value: k, fieldNumber: 1, with: &self) + try visitSingularEnumField(value: v, fieldNumber: 2) + } + } + + mutating func visitMapField( + fieldType: _ProtobufMessageMap.Type, + value: _ProtobufMessageMap.BaseType, + fieldNumber: Int + ) throws { + for (k,v) in value { + encoder.startField(fieldNumber: fieldNumber, wireFormat: .lengthDelimited) + var sizer = BinaryEncodingSizeVisitor() + try KeyType.visitSingular(value: k, fieldNumber: 1, with: &sizer) + try sizer.visitSingularMessageField(value: v, fieldNumber: 2) + let entrySize = sizer.serializedSize + encoder.putVarInt(value: entrySize) + try KeyType.visitSingular(value: k, fieldNumber: 1, with: &self) + try visitSingularMessageField(value: v, fieldNumber: 2) + } + } + + mutating func visitExtensionFieldsAsMessageSet( + fields: ExtensionFieldValueSet, + start: Int, + end: Int + ) throws { + var subVisitor = BinaryEncodingMessageSetVisitor(encoder: encoder) + try fields.traverse(visitor: &subVisitor, start: start, end: end) + encoder = subVisitor.encoder + } +} + +extension BinaryEncodingVisitor { + + // Helper Visitor to when writing out the extensions as MessageSets. + internal struct BinaryEncodingMessageSetVisitor: SelectiveVisitor { + var encoder: BinaryEncoder + + init(encoder: BinaryEncoder) { + self.encoder = encoder + } + + mutating func visitSingularMessageField(value: M, fieldNumber: Int) throws { + encoder.putVarInt(value: Int64(WireFormat.MessageSet.Tags.itemStart.rawValue)) + + encoder.putVarInt(value: Int64(WireFormat.MessageSet.Tags.typeId.rawValue)) + encoder.putVarInt(value: fieldNumber) + + encoder.putVarInt(value: Int64(WireFormat.MessageSet.Tags.message.rawValue)) + + // Use a normal BinaryEncodingVisitor so any message fields end up in the + // normal wire format (instead of MessageSet format). + let length = try value.serializedDataSize() + encoder.putVarInt(value: length) + // Create the sub encoder after writing the length. + var subVisitor = BinaryEncodingVisitor(encoder: encoder) + try value.traverse(visitor: &subVisitor) + encoder = subVisitor.encoder + + encoder.putVarInt(value: Int64(WireFormat.MessageSet.Tags.itemEnd.rawValue)) + } + + // SelectiveVisitor handles the rest. + } + +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/CustomJSONCodable.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/CustomJSONCodable.swift new file mode 100644 index 0000000..64689cb --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/CustomJSONCodable.swift @@ -0,0 +1,36 @@ +// Sources/SwiftProtobuf/CustomJSONCodable.swift - Custom JSON support for WKTs +// +// Copyright (c) 2014 - 2017 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Custom protocol for the WKTs to support their custom JSON encodings. +/// +// ----------------------------------------------------------------------------- + +/// Allows WKTs to provide their custom JSON encodings. +internal protocol _CustomJSONCodable { + func encodedJSONString(options: JSONEncodingOptions) throws -> String + mutating func decodeJSON(from: inout JSONDecoder) throws + + /// Called when the JSON `null` literal is encountered in a position where + /// a message of the conforming type is expected. The message type can then + /// handle the `null` value differently, if needed; for example, + /// `Google_Protobuf_Value` returns a special instance whose `kind` is set to + /// `.nullValue(.nullValue)`. + /// + /// The default behavior is to return `nil`, which indicates that `null` + /// should be treated as the absence of a message. + static func decodedFromJSONNull() throws -> Self? +} + +extension _CustomJSONCodable { + internal static func decodedFromJSONNull() -> Self? { + // Return nil by default. Concrete types can provide custom logic. + return nil + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Data+Extensions.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Data+Extensions.swift new file mode 100644 index 0000000..35c4309 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Data+Extensions.swift @@ -0,0 +1,34 @@ +// Sources/SwiftProtobuf/Data+Extensions.swift - Extension exposing new Data API +// +// Copyright (c) 2014 - 2019 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Extension exposing new Data API to Swift versions < 5.0. +/// +// ----------------------------------------------------------------------------- + +import Foundation + +#if !swift(>=5.0) +internal extension Data { + @usableFromInline + func withUnsafeBytes(_ body: (UnsafeRawBufferPointer) throws -> T) rethrows -> T { + let c = count + return try withUnsafeBytes { (p: UnsafePointer) throws -> T in + try body(UnsafeRawBufferPointer(start: p, count: c)) + } + } + + mutating func withUnsafeMutableBytes(_ body: (UnsafeMutableRawBufferPointer) throws -> T) rethrows -> T { + let c = count + return try withUnsafeMutableBytes { (p: UnsafeMutablePointer) throws -> T in + try body(UnsafeMutableRawBufferPointer(start: p, count: c)) + } + } +} +#endif diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Decoder.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Decoder.swift new file mode 100644 index 0000000..01a8ed8 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Decoder.swift @@ -0,0 +1,150 @@ +// Sources/SwiftProtobuf/Decoder.swift - Basic field setting +// +// Copyright (c) 2014 - 2016 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// In this way, the generated code only knows about schema +/// information; the decoder logic knows how to decode particular +/// wire types based on that information. +/// +// ----------------------------------------------------------------------------- + +import Foundation + +/// This is the abstract protocol used by the generated code +/// to deserialize data. +/// +/// The generated code looks roughly like this: +/// +/// ``` +/// while fieldNumber = try decoder.nextFieldNumber() { +/// switch fieldNumber { +/// case 1: decoder.decodeRepeatedInt32Field(value: &_field) +/// ... etc ... +/// } +/// ``` +/// +/// For performance, this is mostly broken out into a separate method +/// for singular/repeated fields of every supported type. Note that +/// we don't distinguish "packed" here, since all existing decoders +/// treat "packed" the same as "repeated" at this level. (That is, +/// even when the serializer distinguishes packed and non-packed +/// forms, the deserializer always accepts both.) +/// +/// Generics come into play at only a few points: `Enum`s and `Message`s +/// use a generic type to locate the correct initializer. Maps and +/// extensions use generics to avoid the method explosion of having to +/// support a separate method for every map and extension type. Maps +/// do distinguish `Enum`-valued and `Message`-valued maps to avoid +/// polluting the generated `Enum` and `Message` types with all of the +/// necessary generic methods to support this. +public protocol Decoder { + /// Called by a `oneof` when it already has a value and is being asked to + /// accept a new value. Some formats require `oneof` decoding to fail in this + /// case. + mutating func handleConflictingOneOf() throws + + /// Returns the next field number, or nil when the end of the input is + /// reached. + /// + /// For JSON and text format, the decoder translates the field name to a + /// number at this point, based on information it obtained from the message + /// when it was initialized. + mutating func nextFieldNumber() throws -> Int? + + // Primitive field decoders + mutating func decodeSingularFloatField(value: inout Float) throws + mutating func decodeSingularFloatField(value: inout Float?) throws + mutating func decodeRepeatedFloatField(value: inout [Float]) throws + mutating func decodeSingularDoubleField(value: inout Double) throws + mutating func decodeSingularDoubleField(value: inout Double?) throws + mutating func decodeRepeatedDoubleField(value: inout [Double]) throws + mutating func decodeSingularInt32Field(value: inout Int32) throws + mutating func decodeSingularInt32Field(value: inout Int32?) throws + mutating func decodeRepeatedInt32Field(value: inout [Int32]) throws + mutating func decodeSingularInt64Field(value: inout Int64) throws + mutating func decodeSingularInt64Field(value: inout Int64?) throws + mutating func decodeRepeatedInt64Field(value: inout [Int64]) throws + mutating func decodeSingularUInt32Field(value: inout UInt32) throws + mutating func decodeSingularUInt32Field(value: inout UInt32?) throws + mutating func decodeRepeatedUInt32Field(value: inout [UInt32]) throws + mutating func decodeSingularUInt64Field(value: inout UInt64) throws + mutating func decodeSingularUInt64Field(value: inout UInt64?) throws + mutating func decodeRepeatedUInt64Field(value: inout [UInt64]) throws + mutating func decodeSingularSInt32Field(value: inout Int32) throws + mutating func decodeSingularSInt32Field(value: inout Int32?) throws + mutating func decodeRepeatedSInt32Field(value: inout [Int32]) throws + mutating func decodeSingularSInt64Field(value: inout Int64) throws + mutating func decodeSingularSInt64Field(value: inout Int64?) throws + mutating func decodeRepeatedSInt64Field(value: inout [Int64]) throws + mutating func decodeSingularFixed32Field(value: inout UInt32) throws + mutating func decodeSingularFixed32Field(value: inout UInt32?) throws + mutating func decodeRepeatedFixed32Field(value: inout [UInt32]) throws + mutating func decodeSingularFixed64Field(value: inout UInt64) throws + mutating func decodeSingularFixed64Field(value: inout UInt64?) throws + mutating func decodeRepeatedFixed64Field(value: inout [UInt64]) throws + mutating func decodeSingularSFixed32Field(value: inout Int32) throws + mutating func decodeSingularSFixed32Field(value: inout Int32?) throws + mutating func decodeRepeatedSFixed32Field(value: inout [Int32]) throws + mutating func decodeSingularSFixed64Field(value: inout Int64) throws + mutating func decodeSingularSFixed64Field(value: inout Int64?) throws + mutating func decodeRepeatedSFixed64Field(value: inout [Int64]) throws + mutating func decodeSingularBoolField(value: inout Bool) throws + mutating func decodeSingularBoolField(value: inout Bool?) throws + mutating func decodeRepeatedBoolField(value: inout [Bool]) throws + mutating func decodeSingularStringField(value: inout String) throws + mutating func decodeSingularStringField(value: inout String?) throws + mutating func decodeRepeatedStringField(value: inout [String]) throws + mutating func decodeSingularBytesField(value: inout Data) throws + mutating func decodeSingularBytesField(value: inout Data?) throws + mutating func decodeRepeatedBytesField(value: inout [Data]) throws + + // Decode Enum fields + mutating func decodeSingularEnumField(value: inout E) throws where E.RawValue == Int + mutating func decodeSingularEnumField(value: inout E?) throws where E.RawValue == Int + mutating func decodeRepeatedEnumField(value: inout [E]) throws where E.RawValue == Int + + // Decode Message fields + mutating func decodeSingularMessageField(value: inout M?) throws + mutating func decodeRepeatedMessageField(value: inout [M]) throws + + // Decode Group fields + mutating func decodeSingularGroupField(value: inout G?) throws + mutating func decodeRepeatedGroupField(value: inout [G]) throws + + // Decode Map fields. + // This is broken into separate methods depending on whether the value + // type is primitive (_ProtobufMap), enum (_ProtobufEnumMap), or message + // (_ProtobufMessageMap) + mutating func decodeMapField(fieldType: _ProtobufMap.Type, value: inout _ProtobufMap.BaseType) throws + mutating func decodeMapField(fieldType: _ProtobufEnumMap.Type, value: inout _ProtobufEnumMap.BaseType) throws where ValueType.RawValue == Int + mutating func decodeMapField(fieldType: _ProtobufMessageMap.Type, value: inout _ProtobufMessageMap.BaseType) throws + + // Decode extension fields + mutating func decodeExtensionField(values: inout ExtensionFieldValueSet, messageType: Message.Type, fieldNumber: Int) throws + + // Run a decode loop decoding the MessageSet format for Extensions. + mutating func decodeExtensionFieldsAsMessageSet(values: inout ExtensionFieldValueSet, + messageType: Message.Type) throws +} + +/// Most Decoders won't care about Extension handing as in MessageSet +/// format, so provide a default implementation simply looping on the +/// fieldNumbers and feeding through to extension decoding. +extension Decoder { + public mutating func decodeExtensionFieldsAsMessageSet( + values: inout ExtensionFieldValueSet, + messageType: Message.Type + ) throws { + while let fieldNumber = try self.nextFieldNumber() { + try self.decodeExtensionField(values: &values, + messageType: messageType, + fieldNumber: fieldNumber) + } + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/DoubleParser.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/DoubleParser.swift new file mode 100644 index 0000000..f94e277 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/DoubleParser.swift @@ -0,0 +1,61 @@ +// Sources/SwiftProtobuf/DoubleParser.swift - Generally useful mathematical functions +// +// Copyright (c) 2014 - 2019 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Numeric parsing helper for float and double strings +/// +// ----------------------------------------------------------------------------- + +import Foundation + +/// Support parsing float/double values from UTF-8 +internal class DoubleParser { + // Temporary buffer so we can null-terminate the UTF-8 string + // before calling the C standard libray to parse it. + // In theory, JSON writers should be able to represent any IEEE Double + // in at most 25 bytes, but many writers will emit more digits than + // necessary, so we size this generously. + private var work = + UnsafeMutableBufferPointer.allocate(capacity: 128) + + deinit { + work.deallocate() + } + + func utf8ToDouble(bytes: UnsafeRawBufferPointer, + start: UnsafeRawBufferPointer.Index, + end: UnsafeRawBufferPointer.Index) -> Double? { + return utf8ToDouble(bytes: UnsafeRawBufferPointer(rebasing: bytes[start.. Double? { + // Reject unreasonably long or short UTF8 number + if work.count <= bytes.count || bytes.count < 1 { + return nil + } + + #if swift(>=4.1) + UnsafeMutableRawBufferPointer(work).copyMemory(from: bytes) + #else + UnsafeMutableRawBufferPointer(work).copyBytes(from: bytes) + #endif + work[bytes.count] = 0 + + // Use C library strtod() to parse it + var e: UnsafeMutablePointer? = work.baseAddress + let d = strtod(work.baseAddress!, &e) + + // Fail if strtod() did not consume everything we expected + // or if strtod() thought the number was out of range. + if e != work.baseAddress! + bytes.count || !d.isFinite { + return nil + } + return d + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Enum.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Enum.swift new file mode 100644 index 0000000..4c8a354 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Enum.swift @@ -0,0 +1,93 @@ +// Sources/SwiftProtobuf/Enum.swift - Enum support +// +// Copyright (c) 2014 - 2016 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Generated enums conform to SwiftProtobuf.Enum +/// +/// See ProtobufTypes and JSONTypes for extension +/// methods to support binary and JSON coding. +/// +// ----------------------------------------------------------------------------- + +/// Generated enum types conform to this protocol. +public protocol Enum: RawRepresentable, Hashable { + /// Creates a new instance of the enum initialized to its default value. + init() + + /// Creates a new instance of the enum from the given raw integer value. + /// + /// For proto2 enums, this initializer will fail if the raw value does not + /// correspond to a valid enum value. For proto3 enums, this initializer never + /// fails; unknown values are created as instances of the `UNRECOGNIZED` case. + /// + /// - Parameter rawValue: The raw integer value from which to create the enum + /// value. + init?(rawValue: Int) + + /// The raw integer value of the enum value. + /// + /// For a recognized enum case, this is the integer value of the case as + /// defined in the .proto file. For `UNRECOGNIZED` cases in proto3, this is + /// the value that was originally decoded. + var rawValue: Int { get } +} + +extension Enum { +#if swift(>=4.2) + public func hash(into hasher: inout Hasher) { + hasher.combine(rawValue) + } +#else // swift(>=4.2) + public var hashValue: Int { + return rawValue + } +#endif // swift(>=4.2) + + /// Internal convenience property representing the name of the enum value (or + /// `nil` if it is an `UNRECOGNIZED` value or doesn't provide names). + /// + /// Since the text format and JSON names are always identical, we don't need + /// to distinguish them. + internal var name: _NameMap.Name? { + guard let nameProviding = Self.self as? _ProtoNameProviding.Type else { + return nil + } + return nameProviding._protobuf_nameMap.names(for: rawValue)?.proto + } + + /// Internal convenience initializer that returns the enum value with the + /// given name, if it provides names. + /// + /// Since the text format and JSON names are always identical, we don't need + /// to distinguish them. + /// + /// - Parameter name: The name of the enum case. + internal init?(name: String) { + guard let nameProviding = Self.self as? _ProtoNameProviding.Type, + let number = nameProviding._protobuf_nameMap.number(forJSONName: name) else { + return nil + } + self.init(rawValue: number) + } + + /// Internal convenience initializer that returns the enum value with the + /// given name, if it provides names. + /// + /// Since the text format and JSON names are always identical, we don't need + /// to distinguish them. + /// + /// - Parameter name: Buffer holding the UTF-8 bytes of the desired name. + internal init?(rawUTF8: UnsafeRawBufferPointer) { + guard let nameProviding = Self.self as? _ProtoNameProviding.Type, + let number = nameProviding._protobuf_nameMap.number(forJSONName: rawUTF8) else { + return nil + } + self.init(rawValue: number) + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/ExtensibleMessage.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/ExtensibleMessage.swift new file mode 100644 index 0000000..cd022f5 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/ExtensibleMessage.swift @@ -0,0 +1,73 @@ +// Sources/SwiftProtobuf/ExtensibleMessage.swift - Extension support +// +// Copyright (c) 2014 - 2016 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Additional capabilities needed by messages that allow extensions. +/// +// ----------------------------------------------------------------------------- + +// Messages that support extensions implement this protocol +public protocol ExtensibleMessage: Message { + var _protobuf_extensionFieldValues: ExtensionFieldValueSet { get set } +} + +extension ExtensibleMessage { + public mutating func setExtensionValue(ext: MessageExtension, value: F.ValueType) { + _protobuf_extensionFieldValues[ext.fieldNumber] = F(protobufExtension: ext, value: value) + } + + public func getExtensionValue(ext: MessageExtension) -> F.ValueType? { + if let fieldValue = _protobuf_extensionFieldValues[ext.fieldNumber] as? F { + return fieldValue.value + } + return nil + } + + public func hasExtensionValue(ext: MessageExtension) -> Bool { + return _protobuf_extensionFieldValues[ext.fieldNumber] is F + } + + public mutating func clearExtensionValue(ext: MessageExtension) { + _protobuf_extensionFieldValues[ext.fieldNumber] = nil + } +} + +// Additional specializations for the different types of repeated fields so +// setting them to an empty array clears them from the map. +extension ExtensibleMessage { + public mutating func setExtensionValue(ext: MessageExtension, Self>, value: [T.BaseType]) { + _protobuf_extensionFieldValues[ext.fieldNumber] = + value.isEmpty ? nil : RepeatedExtensionField(protobufExtension: ext, value: value) + } + + public mutating func setExtensionValue(ext: MessageExtension, Self>, value: [T.BaseType]) { + _protobuf_extensionFieldValues[ext.fieldNumber] = + value.isEmpty ? nil : PackedExtensionField(protobufExtension: ext, value: value) + } + + public mutating func setExtensionValue(ext: MessageExtension, Self>, value: [E]) { + _protobuf_extensionFieldValues[ext.fieldNumber] = + value.isEmpty ? nil : RepeatedEnumExtensionField(protobufExtension: ext, value: value) + } + + public mutating func setExtensionValue(ext: MessageExtension, Self>, value: [E]) { + _protobuf_extensionFieldValues[ext.fieldNumber] = + value.isEmpty ? nil : PackedEnumExtensionField(protobufExtension: ext, value: value) + } + + public mutating func setExtensionValue(ext: MessageExtension, Self>, value: [M]) { + _protobuf_extensionFieldValues[ext.fieldNumber] = + value.isEmpty ? nil : RepeatedMessageExtensionField(protobufExtension: ext, value: value) + } + + public mutating func setExtensionValue(ext: MessageExtension, Self>, value: [M]) { + _protobuf_extensionFieldValues[ext.fieldNumber] = + value.isEmpty ? nil : RepeatedGroupExtensionField(protobufExtension: ext, value: value) + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/ExtensionFieldValueSet.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/ExtensionFieldValueSet.swift new file mode 100644 index 0000000..66343d6 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/ExtensionFieldValueSet.swift @@ -0,0 +1,89 @@ +// Sources/SwiftProtobuf/ExtensionFieldValueSet.swift - Extension support +// +// Copyright (c) 2014 - 2016 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// A collection of extension field values on a particular object. +/// This is only used within messages to manage the values of extension fields; +/// it does not need to be very sophisticated. +/// +// ----------------------------------------------------------------------------- + +public struct ExtensionFieldValueSet: Hashable { + fileprivate var values = [Int : AnyExtensionField]() + + public static func ==(lhs: ExtensionFieldValueSet, + rhs: ExtensionFieldValueSet) -> Bool { + guard lhs.values.count == rhs.values.count else { + return false + } + for (index, l) in lhs.values { + if let r = rhs.values[index] { + if type(of: l) != type(of: r) { + return false + } + if !l.isEqual(other: r) { + return false + } + } else { + return false + } + } + return true + } + + public init() {} + +#if swift(>=4.2) + public func hash(into hasher: inout Hasher) { + // AnyExtensionField is not Hashable, and the Self constraint that would + // add breaks some of the uses of it; so the only choice is to manually + // mix things in. However, one must remember to do things in an order + // independent manner. + var hash = 16777619 + for (fieldNumber, v) in values { + var localHasher = hasher + localHasher.combine(fieldNumber) + v.hash(into: &localHasher) + hash = hash &+ localHasher.finalize() + } + hasher.combine(hash) + } +#else // swift(>=4.2) + public var hashValue: Int { + var hash = 16777619 + for (fieldNumber, v) in values { + // Note: This calculation cannot depend on the order of the items. + hash = hash &+ fieldNumber &+ v.hashValue + } + return hash + } +#endif // swift(>=4.2) + + public func traverse(visitor: inout V, start: Int, end: Int) throws { + let validIndexes = values.keys.filter {$0 >= start && $0 < end} + for i in validIndexes.sorted() { + let value = values[i]! + try value.traverse(visitor: &visitor) + } + } + + public subscript(index: Int) -> AnyExtensionField? { + get { return values[index] } + set { values[index] = newValue } + } + + public var isInitialized: Bool { + for (_, v) in values { + if !v.isInitialized { + return false + } + } + return true + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/ExtensionFields.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/ExtensionFields.swift new file mode 100644 index 0000000..880f3a2 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/ExtensionFields.swift @@ -0,0 +1,708 @@ +// Sources/SwiftProtobuf/ExtensionFields.swift - Extension support +// +// Copyright (c) 2014 - 2016 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Core protocols implemented by generated extensions. +/// +// ----------------------------------------------------------------------------- + +#if !swift(>=4.2) +private let i_2166136261 = Int(bitPattern: 2166136261) +private let i_16777619 = Int(16777619) +#endif + +// +// Type-erased Extension field implementation. +// Note that it has no "self or associated type" references, so can +// be used as a protocol type. (In particular, although it does have +// a hashValue property, it cannot be Hashable.) +// +// This can encode, decode, return a hashValue and test for +// equality with some other extension field; but it's type-sealed +// so you can't actually access the contained value itself. +// +public protocol AnyExtensionField: CustomDebugStringConvertible { +#if swift(>=4.2) + func hash(into hasher: inout Hasher) +#else + var hashValue: Int { get } +#endif + var protobufExtension: AnyMessageExtension { get } + func isEqual(other: AnyExtensionField) -> Bool + + /// Merging field decoding + mutating func decodeExtensionField(decoder: inout T) throws + + /// Fields know their own type, so can dispatch to a visitor + func traverse(visitor: inout V) throws + + /// Check if the field is initialized. + var isInitialized: Bool { get } +} + +extension AnyExtensionField { + // Default implementation for extensions fields. The message types below provide + // custom versions. + public var isInitialized: Bool { return true } +} + +/// +/// The regular ExtensionField type exposes the value directly. +/// +public protocol ExtensionField: AnyExtensionField, Hashable { + associatedtype ValueType + var value: ValueType { get set } + init(protobufExtension: AnyMessageExtension, value: ValueType) + init?(protobufExtension: AnyMessageExtension, decoder: inout D) throws +} + +/// +/// Singular field +/// +public struct OptionalExtensionField: ExtensionField { + public typealias BaseType = T.BaseType + public typealias ValueType = BaseType + public var value: ValueType + public var protobufExtension: AnyMessageExtension + + public static func ==(lhs: OptionalExtensionField, + rhs: OptionalExtensionField) -> Bool { + return lhs.value == rhs.value + } + + public init(protobufExtension: AnyMessageExtension, value: ValueType) { + self.protobufExtension = protobufExtension + self.value = value + } + + public var debugDescription: String { + get { + return String(reflecting: value) + } + } + +#if swift(>=4.2) + public func hash(into hasher: inout Hasher) { + hasher.combine(value) + } +#else // swift(>=4.2) + public var hashValue: Int { + get { return value.hashValue } + } +#endif // swift(>=4.2) + + public func isEqual(other: AnyExtensionField) -> Bool { + let o = other as! OptionalExtensionField + return self == o + } + + public mutating func decodeExtensionField(decoder: inout D) throws { + var v: ValueType? + try T.decodeSingular(value: &v, from: &decoder) + if let v = v { + value = v + } + } + + public init?(protobufExtension: AnyMessageExtension, decoder: inout D) throws { + var v: ValueType? + try T.decodeSingular(value: &v, from: &decoder) + if let v = v { + self.init(protobufExtension: protobufExtension, value: v) + } else { + return nil + } + } + + public func traverse(visitor: inout V) throws { + try T.visitSingular(value: value, fieldNumber: protobufExtension.fieldNumber, with: &visitor) + } +} + +/// +/// Repeated fields +/// +public struct RepeatedExtensionField: ExtensionField { + public typealias BaseType = T.BaseType + public typealias ValueType = [BaseType] + public var value: ValueType + public var protobufExtension: AnyMessageExtension + + public static func ==(lhs: RepeatedExtensionField, + rhs: RepeatedExtensionField) -> Bool { + return lhs.value == rhs.value + } + + public init(protobufExtension: AnyMessageExtension, value: ValueType) { + self.protobufExtension = protobufExtension + self.value = value + } + +#if swift(>=4.2) + public func hash(into hasher: inout Hasher) { + hasher.combine(value) + } +#else // swift(>=4.2) + public var hashValue: Int { + get { + var hash = i_2166136261 + for e in value { + hash = (hash &* i_16777619) ^ e.hashValue + } + return hash + } + } +#endif // swift(>=4.2) + + public func isEqual(other: AnyExtensionField) -> Bool { + let o = other as! RepeatedExtensionField + return self == o + } + + public var debugDescription: String { + return "[" + value.map{String(reflecting: $0)}.joined(separator: ",") + "]" + } + + public mutating func decodeExtensionField(decoder: inout D) throws { + try T.decodeRepeated(value: &value, from: &decoder) + } + + public init?(protobufExtension: AnyMessageExtension, decoder: inout D) throws { + var v: ValueType = [] + try T.decodeRepeated(value: &v, from: &decoder) + self.init(protobufExtension: protobufExtension, value: v) + } + + public func traverse(visitor: inout V) throws { + if value.count > 0 { + try T.visitRepeated(value: value, fieldNumber: protobufExtension.fieldNumber, with: &visitor) + } + } +} + +/// +/// Packed Repeated fields +/// +/// TODO: This is almost (but not quite) identical to RepeatedFields; +/// find a way to collapse the implementations. +/// +public struct PackedExtensionField: ExtensionField { + public typealias BaseType = T.BaseType + public typealias ValueType = [BaseType] + public var value: ValueType + public var protobufExtension: AnyMessageExtension + + public static func ==(lhs: PackedExtensionField, + rhs: PackedExtensionField) -> Bool { + return lhs.value == rhs.value + } + + public init(protobufExtension: AnyMessageExtension, value: ValueType) { + self.protobufExtension = protobufExtension + self.value = value + } + +#if swift(>=4.2) + public func hash(into hasher: inout Hasher) { + hasher.combine(value) + } +#else // swift(>=4.2) + public var hashValue: Int { + get { + var hash = i_2166136261 + for e in value { + hash = (hash &* i_16777619) ^ e.hashValue + } + return hash + } + } +#endif // swift(>=4.2) + + public func isEqual(other: AnyExtensionField) -> Bool { + let o = other as! PackedExtensionField + return self == o + } + + public var debugDescription: String { + return "[" + value.map{String(reflecting: $0)}.joined(separator: ",") + "]" + } + + public mutating func decodeExtensionField(decoder: inout D) throws { + try T.decodeRepeated(value: &value, from: &decoder) + } + + public init?(protobufExtension: AnyMessageExtension, decoder: inout D) throws { + var v: ValueType = [] + try T.decodeRepeated(value: &v, from: &decoder) + self.init(protobufExtension: protobufExtension, value: v) + } + + public func traverse(visitor: inout V) throws { + if value.count > 0 { + try T.visitPacked(value: value, fieldNumber: protobufExtension.fieldNumber, with: &visitor) + } + } +} + +/// +/// Enum extensions +/// +public struct OptionalEnumExtensionField: ExtensionField where E.RawValue == Int { + public typealias BaseType = E + public typealias ValueType = E + public var value: ValueType + public var protobufExtension: AnyMessageExtension + + public static func ==(lhs: OptionalEnumExtensionField, + rhs: OptionalEnumExtensionField) -> Bool { + return lhs.value == rhs.value + } + + public init(protobufExtension: AnyMessageExtension, value: ValueType) { + self.protobufExtension = protobufExtension + self.value = value + } + + public var debugDescription: String { + get { + return String(reflecting: value) + } + } + +#if swift(>=4.2) + public func hash(into hasher: inout Hasher) { + hasher.combine(value) + } +#else // swift(>=4.2) + public var hashValue: Int { + get { return value.hashValue } + } +#endif // swift(>=4.2) + + public func isEqual(other: AnyExtensionField) -> Bool { + let o = other as! OptionalEnumExtensionField + return self == o + } + + public mutating func decodeExtensionField(decoder: inout D) throws { + var v: ValueType? + try decoder.decodeSingularEnumField(value: &v) + if let v = v { + value = v + } + } + + public init?(protobufExtension: AnyMessageExtension, decoder: inout D) throws { + var v: ValueType? + try decoder.decodeSingularEnumField(value: &v) + if let v = v { + self.init(protobufExtension: protobufExtension, value: v) + } else { + return nil + } + } + + public func traverse(visitor: inout V) throws { + try visitor.visitSingularEnumField( + value: value, + fieldNumber: protobufExtension.fieldNumber) + } +} + +/// +/// Repeated Enum fields +/// +public struct RepeatedEnumExtensionField: ExtensionField where E.RawValue == Int { + public typealias BaseType = E + public typealias ValueType = [E] + public var value: ValueType + public var protobufExtension: AnyMessageExtension + + public static func ==(lhs: RepeatedEnumExtensionField, + rhs: RepeatedEnumExtensionField) -> Bool { + return lhs.value == rhs.value + } + + public init(protobufExtension: AnyMessageExtension, value: ValueType) { + self.protobufExtension = protobufExtension + self.value = value + } + +#if swift(>=4.2) + public func hash(into hasher: inout Hasher) { + hasher.combine(value) + } +#else // swift(>=4.2) + public var hashValue: Int { + get { + var hash = i_2166136261 + for e in value { + hash = (hash &* i_16777619) ^ e.hashValue + } + return hash + } + } +#endif // swift(>=4.2) + + public func isEqual(other: AnyExtensionField) -> Bool { + let o = other as! RepeatedEnumExtensionField + return self == o + } + + public var debugDescription: String { + return "[" + value.map{String(reflecting: $0)}.joined(separator: ",") + "]" + } + + public mutating func decodeExtensionField(decoder: inout D) throws { + try decoder.decodeRepeatedEnumField(value: &value) + } + + public init?(protobufExtension: AnyMessageExtension, decoder: inout D) throws { + var v: ValueType = [] + try decoder.decodeRepeatedEnumField(value: &v) + self.init(protobufExtension: protobufExtension, value: v) + } + + public func traverse(visitor: inout V) throws { + if value.count > 0 { + try visitor.visitRepeatedEnumField( + value: value, + fieldNumber: protobufExtension.fieldNumber) + } + } +} + +/// +/// Packed Repeated Enum fields +/// +/// TODO: This is almost (but not quite) identical to RepeatedEnumFields; +/// find a way to collapse the implementations. +/// +public struct PackedEnumExtensionField: ExtensionField where E.RawValue == Int { + public typealias BaseType = E + public typealias ValueType = [E] + public var value: ValueType + public var protobufExtension: AnyMessageExtension + + public static func ==(lhs: PackedEnumExtensionField, + rhs: PackedEnumExtensionField) -> Bool { + return lhs.value == rhs.value + } + + public init(protobufExtension: AnyMessageExtension, value: ValueType) { + self.protobufExtension = protobufExtension + self.value = value + } + +#if swift(>=4.2) + public func hash(into hasher: inout Hasher) { + hasher.combine(value) + } +#else // swift(>=4.2) + public var hashValue: Int { + get { + var hash = i_2166136261 + for e in value { + hash = (hash &* i_16777619) ^ e.hashValue + } + return hash + } + } +#endif // swift(>=4.2) + + public func isEqual(other: AnyExtensionField) -> Bool { + let o = other as! PackedEnumExtensionField + return self == o + } + + public var debugDescription: String { + return "[" + value.map{String(reflecting: $0)}.joined(separator: ",") + "]" + } + + public mutating func decodeExtensionField(decoder: inout D) throws { + try decoder.decodeRepeatedEnumField(value: &value) + } + + public init?(protobufExtension: AnyMessageExtension, decoder: inout D) throws { + var v: ValueType = [] + try decoder.decodeRepeatedEnumField(value: &v) + self.init(protobufExtension: protobufExtension, value: v) + } + + public func traverse(visitor: inout V) throws { + if value.count > 0 { + try visitor.visitPackedEnumField( + value: value, + fieldNumber: protobufExtension.fieldNumber) + } + } +} + +// +// ========== Message ========== +// +public struct OptionalMessageExtensionField: + ExtensionField { + public typealias BaseType = M + public typealias ValueType = BaseType + public var value: ValueType + public var protobufExtension: AnyMessageExtension + + public static func ==(lhs: OptionalMessageExtensionField, + rhs: OptionalMessageExtensionField) -> Bool { + return lhs.value == rhs.value + } + + public init(protobufExtension: AnyMessageExtension, value: ValueType) { + self.protobufExtension = protobufExtension + self.value = value + } + + public var debugDescription: String { + get { + return String(reflecting: value) + } + } + +#if swift(>=4.2) + public func hash(into hasher: inout Hasher) { + value.hash(into: &hasher) + } +#else // swift(>=4.2) + public var hashValue: Int {return value.hashValue} +#endif // swift(>=4.2) + + public func isEqual(other: AnyExtensionField) -> Bool { + let o = other as! OptionalMessageExtensionField + return self == o + } + + public mutating func decodeExtensionField(decoder: inout D) throws { + var v: ValueType? = value + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + self.value = v + } + } + + public init?(protobufExtension: AnyMessageExtension, decoder: inout D) throws { + var v: ValueType? + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + self.init(protobufExtension: protobufExtension, value: v) + } else { + return nil + } + } + + public func traverse(visitor: inout V) throws { + try visitor.visitSingularMessageField( + value: value, fieldNumber: protobufExtension.fieldNumber) + } + + public var isInitialized: Bool { + return value.isInitialized + } +} + +public struct RepeatedMessageExtensionField: + ExtensionField { + public typealias BaseType = M + public typealias ValueType = [BaseType] + public var value: ValueType + public var protobufExtension: AnyMessageExtension + + public static func ==(lhs: RepeatedMessageExtensionField, + rhs: RepeatedMessageExtensionField) -> Bool { + return lhs.value == rhs.value + } + + public init(protobufExtension: AnyMessageExtension, value: ValueType) { + self.protobufExtension = protobufExtension + self.value = value + } + +#if swift(>=4.2) + public func hash(into hasher: inout Hasher) { + for e in value { + e.hash(into: &hasher) + } + } +#else // swift(>=4.2) + public var hashValue: Int { + get { + var hash = i_2166136261 + for e in value { + hash = (hash &* i_16777619) ^ e.hashValue + } + return hash + } + } +#endif // swift(>=4.2) + + public func isEqual(other: AnyExtensionField) -> Bool { + let o = other as! RepeatedMessageExtensionField + return self == o + } + + public var debugDescription: String { + return "[" + value.map{String(reflecting: $0)}.joined(separator: ",") + "]" + } + + public mutating func decodeExtensionField(decoder: inout D) throws { + try decoder.decodeRepeatedMessageField(value: &value) + } + + public init?(protobufExtension: AnyMessageExtension, decoder: inout D) throws { + var v: ValueType = [] + try decoder.decodeRepeatedMessageField(value: &v) + self.init(protobufExtension: protobufExtension, value: v) + } + + public func traverse(visitor: inout V) throws { + if value.count > 0 { + try visitor.visitRepeatedMessageField( + value: value, fieldNumber: protobufExtension.fieldNumber) + } + } + + public var isInitialized: Bool { + return Internal.areAllInitialized(value) + } +} + +// +// ======== Groups within Messages ======== +// +// Protoc internally treats groups the same as messages, but +// they serialize very differently, so we have separate serialization +// handling here... +public struct OptionalGroupExtensionField: + ExtensionField { + public typealias BaseType = G + public typealias ValueType = BaseType + public var value: G + public var protobufExtension: AnyMessageExtension + + public static func ==(lhs: OptionalGroupExtensionField, + rhs: OptionalGroupExtensionField) -> Bool { + return lhs.value == rhs.value + } + + public init(protobufExtension: AnyMessageExtension, value: ValueType) { + self.protobufExtension = protobufExtension + self.value = value + } + +#if swift(>=4.2) + public func hash(into hasher: inout Hasher) { + hasher.combine(value) + } +#else // swift(>=4.2) + public var hashValue: Int {return value.hashValue} +#endif // swift(>=4.2) + + public var debugDescription: String { get {return value.debugDescription} } + + public func isEqual(other: AnyExtensionField) -> Bool { + let o = other as! OptionalGroupExtensionField + return self == o + } + + public mutating func decodeExtensionField(decoder: inout D) throws { + var v: ValueType? = value + try decoder.decodeSingularGroupField(value: &v) + if let v = v { + value = v + } + } + + public init?(protobufExtension: AnyMessageExtension, decoder: inout D) throws { + var v: ValueType? + try decoder.decodeSingularGroupField(value: &v) + if let v = v { + self.init(protobufExtension: protobufExtension, value: v) + } else { + return nil + } + } + + public func traverse(visitor: inout V) throws { + try visitor.visitSingularGroupField( + value: value, fieldNumber: protobufExtension.fieldNumber) + } + + public var isInitialized: Bool { + return value.isInitialized + } +} + +public struct RepeatedGroupExtensionField: + ExtensionField { + public typealias BaseType = G + public typealias ValueType = [BaseType] + public var value: ValueType + public var protobufExtension: AnyMessageExtension + + public static func ==(lhs: RepeatedGroupExtensionField, + rhs: RepeatedGroupExtensionField) -> Bool { + return lhs.value == rhs.value + } + + public init(protobufExtension: AnyMessageExtension, value: ValueType) { + self.protobufExtension = protobufExtension + self.value = value + } + +#if swift(>=4.2) + public func hash(into hasher: inout Hasher) { + hasher.combine(value) + } +#else // swift(>=4.2) + public var hashValue: Int { + get { + var hash = i_2166136261 + for e in value { + hash = (hash &* i_16777619) ^ e.hashValue + } + return hash + } + } +#endif // swift(>=4.2) + + public var debugDescription: String { + return "[" + value.map{$0.debugDescription}.joined(separator: ",") + "]" + } + + public func isEqual(other: AnyExtensionField) -> Bool { + let o = other as! RepeatedGroupExtensionField + return self == o + } + + public mutating func decodeExtensionField(decoder: inout D) throws { + try decoder.decodeRepeatedGroupField(value: &value) + } + + public init?(protobufExtension: AnyMessageExtension, decoder: inout D) throws { + var v: ValueType = [] + try decoder.decodeRepeatedGroupField(value: &v) + self.init(protobufExtension: protobufExtension, value: v) + } + + public func traverse(visitor: inout V) throws { + if value.count > 0 { + try visitor.visitRepeatedGroupField( + value: value, fieldNumber: protobufExtension.fieldNumber) + } + } + + public var isInitialized: Bool { + return Internal.areAllInitialized(value) + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/ExtensionMap.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/ExtensionMap.swift new file mode 100644 index 0000000..b1115d7 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/ExtensionMap.swift @@ -0,0 +1,38 @@ +// Sources/SwiftProtobuf/ExtensionMap.swift - Extension support +// +// Copyright (c) 2014 - 2017 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// A set of extensions that can be passed into deserializers +/// to provide details of the particular extensions that should +/// be recognized. +/// +// ----------------------------------------------------------------------------- + +/// A collection of extension objects. +/// +/// An `ExtensionMap` is used during decoding to look up +/// extension objects corresponding to the serialized data. +/// +/// This is a protocol so that developers can build their own +/// extension handling if they need something more complex than the +/// standard `SimpleExtensionMap` implementation. +public protocol ExtensionMap { + /// Returns the extension object describing an extension or nil + subscript(messageType: Message.Type, fieldNumber: Int) -> AnyMessageExtension? { get } + + /// Returns the field number for a message with a specific field name + /// + /// The field name here matches the format used by the protobuf + /// Text serialization: it typically looks like + /// `package.message.field_name`, where `package` is the package + /// for the proto file and `message` is the name of the message in + /// which the extension was defined. (This is different from the + /// message that is being extended!) + func fieldNumberForProto(messageType: Message.Type, protoFieldName: String) -> Int? +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/FieldTag.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/FieldTag.swift new file mode 100644 index 0000000..139897f --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/FieldTag.swift @@ -0,0 +1,69 @@ +// Sources/SwiftProtobuf/FieldTag.swift - Describes a binary field tag +// +// Copyright (c) 2014 - 2016 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Types related to binary encoded tags (field numbers and wire formats). +/// +// ----------------------------------------------------------------------------- + +/// Encapsulates the number and wire format of a field, which together form the +/// "tag". +/// +/// This type also validates tags in that it will never allow a tag with an +/// improper field number (such as zero) or wire format (such as 6 or 7) to +/// exist. In other words, a `FieldTag`'s properties never need to be tested +/// for validity because they are guaranteed correct at initialization time. +internal struct FieldTag: RawRepresentable { + + typealias RawValue = UInt32 + + /// The raw numeric value of the tag, which contains both the field number and + /// wire format. + let rawValue: UInt32 + + /// The field number component of the tag. + var fieldNumber: Int { + return Int(rawValue >> 3) + } + + /// The wire format component of the tag. + var wireFormat: WireFormat { + // This force-unwrap is safe because there are only two initialization + // paths: one that takes a WireFormat directly (and is guaranteed valid at + // compile-time), or one that takes a raw value but which only lets valid + // wire formats through. + return WireFormat(rawValue: UInt8(rawValue & 7))! + } + + /// A helper property that returns the number of bytes required to + /// varint-encode this tag. + var encodedSize: Int { + return Varint.encodedSize(of: rawValue) + } + + /// Creates a new tag from its raw numeric representation. + /// + /// Note that if the raw value given here is not a valid tag (for example, it + /// has an invalid wire format), this initializer will fail. + init?(rawValue: UInt32) { + // Verify that the field number and wire format are valid and fail if they + // are not. + guard rawValue & ~0x07 != 0, + let _ = WireFormat(rawValue: UInt8(rawValue % 8)) else { + return nil + } + self.rawValue = rawValue + } + + /// Creates a new tag by composing the given field number and wire format. + init(fieldNumber: Int, wireFormat: WireFormat) { + self.rawValue = UInt32(truncatingIfNeeded: fieldNumber) << 3 | + UInt32(wireFormat.rawValue) + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/FieldTypes.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/FieldTypes.swift new file mode 100644 index 0000000..7e76f60 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/FieldTypes.swift @@ -0,0 +1,412 @@ +// Sources/SwiftProtobuf/FieldTypes.swift - Proto data types +// +// Copyright (c) 2014 - 2016 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Serialization/deserialization support for each proto field type. +/// +/// Note that we cannot just extend the standard Int32, etc, types +/// with serialization information since proto language supports +/// distinct types (with different codings) that use the same +/// in-memory representation. For example, proto "sint32" and +/// "sfixed32" both are represented in-memory as Int32. +/// +/// These types are used generically and also passed into +/// various coding/decoding functions to provide type-specific +/// information. +/// +// ----------------------------------------------------------------------------- + +import Foundation + +// Note: The protobuf- and JSON-specific methods here are defined +// in ProtobufTypeAdditions.swift and JSONTypeAdditions.swift +public protocol FieldType { + // The Swift type used to store data for this field. For example, + // proto "sint32" fields use Swift "Int32" type. + associatedtype BaseType: Hashable + + // The default value for this field type before it has been set. + // This is also used, for example, when JSON decodes a "null" + // value for a field. + static var proto3DefaultValue: BaseType { get } + + // Generic reflector methods for looking up the correct + // encoding/decoding for extension fields, map keys, and map + // values. + static func decodeSingular(value: inout BaseType?, from decoder: inout D) throws + static func decodeRepeated(value: inout [BaseType], from decoder: inout D) throws + static func visitSingular(value: BaseType, fieldNumber: Int, with visitor: inout V) throws + static func visitRepeated(value: [BaseType], fieldNumber: Int, with visitor: inout V) throws + static func visitPacked(value: [BaseType], fieldNumber: Int, with visitor: inout V) throws +} + +/// +/// Marker protocol for types that can be used as map keys +/// +public protocol MapKeyType: FieldType { +} + +/// +/// Marker Protocol for types that can be used as map values. +/// +public protocol MapValueType: FieldType { +} + +// +// We have a struct for every basic proto field type which provides +// serialization/deserialization support as static methods. +// + +/// +/// Float traits +/// +public struct ProtobufFloat: FieldType, MapValueType { + public typealias BaseType = Float + public static var proto3DefaultValue: Float {return 0.0} + public static func decodeSingular(value: inout BaseType?, from decoder: inout D) throws { + try decoder.decodeSingularFloatField(value: &value) + } + public static func decodeRepeated(value: inout [BaseType], from decoder: inout D) throws { + try decoder.decodeRepeatedFloatField(value: &value) + } + public static func visitSingular(value: BaseType, fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitSingularFloatField(value: value, fieldNumber: fieldNumber) + } + public static func visitRepeated(value: [BaseType], fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitRepeatedFloatField(value: value, fieldNumber: fieldNumber) + } + public static func visitPacked(value: [BaseType], fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitPackedFloatField(value: value, fieldNumber: fieldNumber) + } +} + +/// +/// Double +/// +public struct ProtobufDouble: FieldType, MapValueType { + public typealias BaseType = Double + public static var proto3DefaultValue: Double {return 0.0} + public static func decodeSingular(value: inout BaseType?, from decoder: inout D) throws { + try decoder.decodeSingularDoubleField(value: &value) + } + public static func decodeRepeated(value: inout [BaseType], from decoder: inout D) throws { + try decoder.decodeRepeatedDoubleField(value: &value) + } + public static func visitSingular(value: BaseType, fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitSingularDoubleField(value: value, fieldNumber: fieldNumber) + } + public static func visitRepeated(value: [BaseType], fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitRepeatedDoubleField(value: value, fieldNumber: fieldNumber) + } + public static func visitPacked(value: [BaseType], fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitPackedDoubleField(value: value, fieldNumber: fieldNumber) + } +} + +/// +/// Int32 +/// +public struct ProtobufInt32: FieldType, MapKeyType, MapValueType { + public typealias BaseType = Int32 + public static var proto3DefaultValue: Int32 {return 0} + public static func decodeSingular(value: inout BaseType?, from decoder: inout D) throws { + try decoder.decodeSingularInt32Field(value: &value) + } + public static func decodeRepeated(value: inout [BaseType], from decoder: inout D) throws { + try decoder.decodeRepeatedInt32Field(value: &value) + } + public static func visitSingular(value: BaseType, fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitSingularInt32Field(value: value, fieldNumber: fieldNumber) + } + public static func visitRepeated(value: [BaseType], fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitRepeatedInt32Field(value: value, fieldNumber: fieldNumber) + } + public static func visitPacked(value: [BaseType], fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitPackedInt32Field(value: value, fieldNumber: fieldNumber) + } +} + +/// +/// Int64 +/// + +public struct ProtobufInt64: FieldType, MapKeyType, MapValueType { + public typealias BaseType = Int64 + public static var proto3DefaultValue: Int64 {return 0} + public static func decodeSingular(value: inout BaseType?, from decoder: inout D) throws { + try decoder.decodeSingularInt64Field(value: &value) + } + public static func decodeRepeated(value: inout [BaseType], from decoder: inout D) throws { + try decoder.decodeRepeatedInt64Field(value: &value) + } + public static func visitSingular(value: BaseType, fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitSingularInt64Field(value: value, fieldNumber: fieldNumber) + } + public static func visitRepeated(value: [BaseType], fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitRepeatedInt64Field(value: value, fieldNumber: fieldNumber) + } + public static func visitPacked(value: [BaseType], fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitPackedInt64Field(value: value, fieldNumber: fieldNumber) + } +} + +/// +/// UInt32 +/// +public struct ProtobufUInt32: FieldType, MapKeyType, MapValueType { + public typealias BaseType = UInt32 + public static var proto3DefaultValue: UInt32 {return 0} + public static func decodeSingular(value: inout BaseType?, from decoder: inout D) throws { + try decoder.decodeSingularUInt32Field(value: &value) + } + public static func decodeRepeated(value: inout [BaseType], from decoder: inout D) throws { + try decoder.decodeRepeatedUInt32Field(value: &value) + } + public static func visitSingular(value: BaseType, fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitSingularUInt32Field(value: value, fieldNumber: fieldNumber) + } + public static func visitRepeated(value: [BaseType], fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitRepeatedUInt32Field(value: value, fieldNumber: fieldNumber) + } + public static func visitPacked(value: [BaseType], fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitPackedUInt32Field(value: value, fieldNumber: fieldNumber) + } +} + +/// +/// UInt64 +/// + +public struct ProtobufUInt64: FieldType, MapKeyType, MapValueType { + public typealias BaseType = UInt64 + public static var proto3DefaultValue: UInt64 {return 0} + public static func decodeSingular(value: inout BaseType?, from decoder: inout D) throws { + try decoder.decodeSingularUInt64Field(value: &value) + } + public static func decodeRepeated(value: inout [BaseType], from decoder: inout D) throws { + try decoder.decodeRepeatedUInt64Field(value: &value) + } + public static func visitSingular(value: BaseType, fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitSingularUInt64Field(value: value, fieldNumber: fieldNumber) + } + public static func visitRepeated(value: [BaseType], fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitRepeatedUInt64Field(value: value, fieldNumber: fieldNumber) + } + public static func visitPacked(value: [BaseType], fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitPackedUInt64Field(value: value, fieldNumber: fieldNumber) + } +} + +/// +/// SInt32 +/// +public struct ProtobufSInt32: FieldType, MapKeyType, MapValueType { + public typealias BaseType = Int32 + public static var proto3DefaultValue: Int32 {return 0} + public static func decodeSingular(value: inout BaseType?, from decoder: inout D) throws { + try decoder.decodeSingularSInt32Field(value: &value) + } + public static func decodeRepeated(value: inout [BaseType], from decoder: inout D) throws { + try decoder.decodeRepeatedSInt32Field(value: &value) + } + public static func visitSingular(value: BaseType, fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitSingularSInt32Field(value: value, fieldNumber: fieldNumber) + } + public static func visitRepeated(value: [BaseType], fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitRepeatedSInt32Field(value: value, fieldNumber: fieldNumber) + } + public static func visitPacked(value: [BaseType], fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitPackedSInt32Field(value: value, fieldNumber: fieldNumber) + } +} + +/// +/// SInt64 +/// + +public struct ProtobufSInt64: FieldType, MapKeyType, MapValueType { + public typealias BaseType = Int64 + public static var proto3DefaultValue: Int64 {return 0} + public static func decodeSingular(value: inout BaseType?, from decoder: inout D) throws { + try decoder.decodeSingularSInt64Field(value: &value) + } + public static func decodeRepeated(value: inout [BaseType], from decoder: inout D) throws { + try decoder.decodeRepeatedSInt64Field(value: &value) + } + public static func visitSingular(value: BaseType, fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitSingularSInt64Field(value: value, fieldNumber: fieldNumber) + } + public static func visitRepeated(value: [BaseType], fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitRepeatedSInt64Field(value: value, fieldNumber: fieldNumber) + } + public static func visitPacked(value: [BaseType], fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitPackedSInt64Field(value: value, fieldNumber: fieldNumber) + } +} + +/// +/// Fixed32 +/// +public struct ProtobufFixed32: FieldType, MapKeyType, MapValueType { + public typealias BaseType = UInt32 + public static var proto3DefaultValue: UInt32 {return 0} + public static func decodeSingular(value: inout BaseType?, from decoder: inout D) throws { + try decoder.decodeSingularFixed32Field(value: &value) + } + public static func decodeRepeated(value: inout [BaseType], from decoder: inout D) throws { + try decoder.decodeRepeatedFixed32Field(value: &value) + } + public static func visitSingular(value: BaseType, fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitSingularFixed32Field(value: value, fieldNumber: fieldNumber) + } + public static func visitRepeated(value: [BaseType], fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitRepeatedFixed32Field(value: value, fieldNumber: fieldNumber) + } + public static func visitPacked(value: [BaseType], fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitPackedFixed32Field(value: value, fieldNumber: fieldNumber) + } +} + +/// +/// Fixed64 +/// +public struct ProtobufFixed64: FieldType, MapKeyType, MapValueType { + public typealias BaseType = UInt64 + public static var proto3DefaultValue: UInt64 {return 0} + public static func decodeSingular(value: inout BaseType?, from decoder: inout D) throws { + try decoder.decodeSingularFixed64Field(value: &value) + } + public static func decodeRepeated(value: inout [BaseType], from decoder: inout D) throws { + try decoder.decodeRepeatedFixed64Field(value: &value) + } + public static func visitSingular(value: BaseType, fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitSingularFixed64Field(value: value, fieldNumber: fieldNumber) + } + public static func visitRepeated(value: [BaseType], fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitRepeatedFixed64Field(value: value, fieldNumber: fieldNumber) + } + public static func visitPacked(value: [BaseType], fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitPackedFixed64Field(value: value, fieldNumber: fieldNumber) + } +} + +/// +/// SFixed32 +/// +public struct ProtobufSFixed32: FieldType, MapKeyType, MapValueType { + public typealias BaseType = Int32 + public static var proto3DefaultValue: Int32 {return 0} + public static func decodeSingular(value: inout BaseType?, from decoder: inout D) throws { + try decoder.decodeSingularSFixed32Field(value: &value) + } + public static func decodeRepeated(value: inout [BaseType], from decoder: inout D) throws { + try decoder.decodeRepeatedSFixed32Field(value: &value) + } + public static func visitSingular(value: BaseType, fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitSingularSFixed32Field(value: value, fieldNumber: fieldNumber) + } + public static func visitRepeated(value: [BaseType], fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitRepeatedSFixed32Field(value: value, fieldNumber: fieldNumber) + } + public static func visitPacked(value: [BaseType], fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitPackedSFixed32Field(value: value, fieldNumber: fieldNumber) + } +} + +/// +/// SFixed64 +/// +public struct ProtobufSFixed64: FieldType, MapKeyType, MapValueType { + public typealias BaseType = Int64 + public static var proto3DefaultValue: Int64 {return 0} + public static func decodeSingular(value: inout BaseType?, from decoder: inout D) throws { + try decoder.decodeSingularSFixed64Field(value: &value) + } + public static func decodeRepeated(value: inout [BaseType], from decoder: inout D) throws { + try decoder.decodeRepeatedSFixed64Field(value: &value) + } + public static func visitSingular(value: BaseType, fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitSingularSFixed64Field(value: value, fieldNumber: fieldNumber) + } + public static func visitRepeated(value: [BaseType], fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitRepeatedSFixed64Field(value: value, fieldNumber: fieldNumber) + } + public static func visitPacked(value: [BaseType], fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitPackedSFixed64Field(value: value, fieldNumber: fieldNumber) + } +} + +/// +/// Bool +/// +public struct ProtobufBool: FieldType, MapKeyType, MapValueType { + public typealias BaseType = Bool + public static var proto3DefaultValue: Bool {return false} + public static func decodeSingular(value: inout BaseType?, from decoder: inout D) throws { + try decoder.decodeSingularBoolField(value: &value) + } + public static func decodeRepeated(value: inout [BaseType], from decoder: inout D) throws { + try decoder.decodeRepeatedBoolField(value: &value) + } + public static func visitSingular(value: BaseType, fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitSingularBoolField(value: value, fieldNumber: fieldNumber) + } + public static func visitRepeated(value: [BaseType], fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitRepeatedBoolField(value: value, fieldNumber: fieldNumber) + } + public static func visitPacked(value: [BaseType], fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitPackedBoolField(value: value, fieldNumber: fieldNumber) + } +} + +/// +/// String +/// +public struct ProtobufString: FieldType, MapKeyType, MapValueType { + public typealias BaseType = String + public static var proto3DefaultValue: String {return String()} + public static func decodeSingular(value: inout BaseType?, from decoder: inout D) throws { + try decoder.decodeSingularStringField(value: &value) + } + public static func decodeRepeated(value: inout [BaseType], from decoder: inout D) throws { + try decoder.decodeRepeatedStringField(value: &value) + } + public static func visitSingular(value: BaseType, fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitSingularStringField(value: value, fieldNumber: fieldNumber) + } + public static func visitRepeated(value: [BaseType], fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitRepeatedStringField(value: value, fieldNumber: fieldNumber) + } + public static func visitPacked(value: [BaseType], fieldNumber: Int, with visitor: inout V) throws { + assert(false) + } +} + +/// +/// Bytes +/// +public struct ProtobufBytes: FieldType, MapValueType { + public typealias BaseType = Data + public static var proto3DefaultValue: Data {return Data()} + public static func decodeSingular(value: inout BaseType?, from decoder: inout D) throws { + try decoder.decodeSingularBytesField(value: &value) + } + public static func decodeRepeated(value: inout [BaseType], from decoder: inout D) throws { + try decoder.decodeRepeatedBytesField(value: &value) + } + public static func visitSingular(value: BaseType, fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitSingularBytesField(value: value, fieldNumber: fieldNumber) + } + public static func visitRepeated(value: [BaseType], fieldNumber: Int, with visitor: inout V) throws { + try visitor.visitRepeatedBytesField(value: value, fieldNumber: fieldNumber) + } + public static func visitPacked(value: [BaseType], fieldNumber: Int, with visitor: inout V) throws { + assert(false) + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Google_Protobuf_Any+Extensions.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Google_Protobuf_Any+Extensions.swift new file mode 100644 index 0000000..90605ad --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Google_Protobuf_Any+Extensions.swift @@ -0,0 +1,143 @@ +// Sources/SwiftProtobuf/Google_Protobuf_Any+Extensions.swift - Well-known Any type +// +// Copyright (c) 2014 - 2017 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Extends the `Google_Protobuf_Any` type with various custom behaviors. +/// +// ----------------------------------------------------------------------------- + +// Explicit import of Foundation is necessary on Linux, +// don't remove unless obsolete on all platforms +import Foundation + +public let defaultAnyTypeURLPrefix: String = "type.googleapis.com" + +extension Google_Protobuf_Any { + /// Initialize an Any object from the provided message. + /// + /// This corresponds to the `pack` operation in the C++ API. + /// + /// Unlike the C++ implementation, the message is not immediately + /// serialized; it is merely stored until the Any object itself + /// needs to be serialized. This design avoids unnecessary + /// decoding/recoding when writing JSON format. + /// + /// - Parameters: + /// - partial: If `false` (the default), this method will check + /// `Message.isInitialized` before encoding to verify that all required + /// fields are present. If any are missing, this method throws + /// `BinaryEncodingError.missingRequiredFields`. + /// - typePrefix: The prefix to be used when building the `type_url`. + /// Defaults to "type.googleapis.com". + /// - Throws: `BinaryEncodingError.missingRequiredFields` if `partial` is + /// false and `message` wasn't fully initialized. + public init( + message: Message, + partial: Bool = false, + typePrefix: String = defaultAnyTypeURLPrefix + ) throws { + if !partial && !message.isInitialized { + throw BinaryEncodingError.missingRequiredFields + } + self.init() + typeURL = buildTypeURL(forMessage:message, typePrefix: typePrefix) + _storage.state = .message(message) + } + + /// Creates a new `Google_Protobuf_Any` by decoding the given string + /// containing a serialized message in Protocol Buffer text format. + /// + /// - Parameters: + /// - textFormatString: The text format string to decode. + /// - extensions: An `ExtensionMap` used to look up and decode any + /// extensions in this message or messages nested within this message's + /// fields. + /// - Throws: an instance of `TextFormatDecodingError` on failure. + public init( + textFormatString: String, + extensions: ExtensionMap? = nil + ) throws { + self.init() + if !textFormatString.isEmpty { + if let data = textFormatString.data(using: String.Encoding.utf8) { + try data.withUnsafeBytes { (body: UnsafeRawBufferPointer) in + if let baseAddress = body.baseAddress, body.count > 0 { + var textDecoder = try TextFormatDecoder( + messageType: Google_Protobuf_Any.self, + utf8Pointer: baseAddress, + count: body.count, + extensions: extensions) + try decodeTextFormat(decoder: &textDecoder) + if !textDecoder.complete { + throw TextFormatDecodingError.trailingGarbage + } + } + } + } + } + } + + /// Returns true if this `Google_Protobuf_Any` message contains the given + /// message type. + /// + /// The check is performed by looking at the passed `Message.Type` and the + /// `typeURL` of this message. + /// + /// - Parameter type: The concrete message type. + /// - Returns: True if the receiver contains the given message type. + public func isA(_ type: M.Type) -> Bool { + return _storage.isA(type) + } + +#if swift(>=4.2) + public func hash(into hasher: inout Hasher) { + _storage.hash(into: &hasher) + } +#else // swift(>=4.2) + public var hashValue: Int { + return _storage.hashValue + } +#endif // swift(>=4.2) +} + +extension Google_Protobuf_Any { + internal func textTraverse(visitor: inout TextFormatEncodingVisitor) { + _storage.textTraverse(visitor: &visitor) + try! unknownFields.traverse(visitor: &visitor) + } +} + +extension Google_Protobuf_Any: _CustomJSONCodable { + // Custom text format decoding support for Any objects. + // (Note: This is not a part of any protocol; it's invoked + // directly from TextFormatDecoder whenever it sees an attempt + // to decode an Any object) + internal mutating func decodeTextFormat( + decoder: inout TextFormatDecoder + ) throws { + // First, check if this uses the "verbose" Any encoding. + // If it does, and we have the type available, we can + // eagerly decode the contained Message object. + if let url = try decoder.scanner.nextOptionalAnyURL() { + try _uniqueStorage().decodeTextFormat(typeURL: url, decoder: &decoder) + } else { + // This is not using the specialized encoding, so we can use the + // standard path to decode the binary value. + try decodeMessage(decoder: &decoder) + } + } + + internal func encodedJSONString(options: JSONEncodingOptions) throws -> String { + return try _storage.encodedJSONString(options: options) + } + + internal mutating func decodeJSON(from decoder: inout JSONDecoder) throws { + try _uniqueStorage().decodeJSON(from: &decoder) + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Google_Protobuf_Any+Registry.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Google_Protobuf_Any+Registry.swift new file mode 100644 index 0000000..1e241d3 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Google_Protobuf_Any+Registry.swift @@ -0,0 +1,135 @@ +// Sources/SwiftProtobuf/Google_Protobuf_Any+Registry.swift - Registry for JSON support +// +// Copyright (c) 2014 - 2017 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Support for registering and looking up Message types. Used +/// in support of Google_Protobuf_Any. +/// +// ----------------------------------------------------------------------------- + +import Foundation +import Dispatch + +// TODO: Should these first four be exposed as methods to go with +// the general registry support? + +internal func buildTypeURL(forMessage message: Message, typePrefix: String) -> String { + var url = typePrefix + let needsSlash = typePrefix.isEmpty || typePrefix.last != "/" + if needsSlash { + url += "/" + } + return url + typeName(fromMessage: message) +} + +internal func typeName(fromMessage message: Message) -> String { + let messageType = type(of: message) + return messageType.protoMessageName +} + +internal func typeName(fromURL s: String) -> String { + var typeStart = s.startIndex + var i = typeStart + while i < s.endIndex { + let c = s[i] + i = s.index(after: i) + if c == "/" { + typeStart = i + } + } + + return String(s[typeStart.. Bool { + let messageTypeName = messageType.protoMessageName + var result: Bool = false + serialQueue.sync { + if let alreadyRegistered = knownTypes[messageTypeName] { + // Success/failure when something was already registered is + // based on if they are registering the same class or trying + // to register a different type + result = alreadyRegistered == messageType + } else { + knownTypes[messageTypeName] = messageType + result = true + } + } + return result + } + + /// Returns the Message.Type expected for the given type URL. + public static func messageType(forTypeURL url: String) -> Message.Type? { + let messageTypeName = typeName(fromURL: url) + return messageType(forMessageName: messageTypeName) + } + + /// Returns the Message.Type expected for the given proto message name. + public static func messageType(forMessageName name: String) -> Message.Type? { + var result: Message.Type? + serialQueue.sync { + result = knownTypes[name] + } + return result + } + +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Google_Protobuf_Duration+Extensions.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Google_Protobuf_Duration+Extensions.swift new file mode 100644 index 0000000..c8b5175 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Google_Protobuf_Duration+Extensions.swift @@ -0,0 +1,234 @@ +// Sources/SwiftProtobuf/Google_Protobuf_Duration+Extensions.swift - Extensions for Duration type +// +// Copyright (c) 2014 - 2016 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Extends the generated Duration struct with various custom behaviors: +/// * JSON coding and decoding +/// * Arithmetic operations +/// +// ----------------------------------------------------------------------------- + +import Foundation + +private let minDurationSeconds: Int64 = -maxDurationSeconds +private let maxDurationSeconds: Int64 = 315576000000 + +private func parseDuration(text: String) throws -> (Int64, Int32) { + var digits = [Character]() + var digitCount = 0 + var total = 0 + var chars = text.makeIterator() + var seconds: Int64? + var nanos: Int32 = 0 + while let c = chars.next() { + switch c { + case "-": + // Only accept '-' as very first character + if total > 0 { + throw JSONDecodingError.malformedDuration + } + digits.append(c) + case "0", "1", "2", "3", "4", "5", "6", "7", "8", "9": + digits.append(c) + digitCount += 1 + case ".": + if let _ = seconds { + throw JSONDecodingError.malformedDuration + } + let digitString = String(digits) + if let s = Int64(digitString), + s >= minDurationSeconds && s <= maxDurationSeconds { + seconds = s + } else { + throw JSONDecodingError.malformedDuration + } + digits.removeAll() + digitCount = 0 + case "s": + if let seconds = seconds { + // Seconds already set, digits holds nanos + while (digitCount < 9) { + digits.append(Character("0")) + digitCount += 1 + } + while digitCount > 9 { + digits.removeLast() + digitCount -= 1 + } + let digitString = String(digits) + if let rawNanos = Int32(digitString) { + if seconds < 0 { + nanos = -rawNanos + } else { + nanos = rawNanos + } + } else { + throw JSONDecodingError.malformedDuration + } + } else { + // No fraction, we just have an integral number of seconds + let digitString = String(digits) + if let s = Int64(digitString), + s >= minDurationSeconds && s <= maxDurationSeconds { + seconds = s + } else { + throw JSONDecodingError.malformedDuration + } + } + // Fail if there are characters after 's' + if chars.next() != nil { + throw JSONDecodingError.malformedDuration + } + return (seconds!, nanos) + default: + throw JSONDecodingError.malformedDuration + } + total += 1 + } + throw JSONDecodingError.malformedDuration +} + +private func formatDuration(seconds: Int64, nanos: Int32) -> String? { + let (seconds, nanos) = normalizeForDuration(seconds: seconds, nanos: nanos) + guard seconds >= minDurationSeconds && seconds <= maxDurationSeconds else { + return nil + } + + if nanos == 0 { + return String(format: "%llds", seconds) + } else if nanos % 1000000 == 0 { + return String(format: "%lld.%03ds", seconds, abs(nanos) / 1000000) + } else if nanos % 1000 == 0 { + return String(format: "%lld.%06ds", seconds, abs(nanos) / 1000) + } else { + return String(format: "%lld.%09ds", seconds, abs(nanos)) + } +} + +extension Google_Protobuf_Duration { + /// Creates a new `Google_Protobuf_Duration` equal to the given number of + /// seconds and nanoseconds. + /// + /// - Parameter seconds: The number of seconds. + /// - Parameter nanos: The number of nanoseconds. + public init(seconds: Int64 = 0, nanos: Int32 = 0) { + self.init() + self.seconds = seconds + self.nanos = nanos + } +} + +extension Google_Protobuf_Duration: _CustomJSONCodable { + mutating func decodeJSON(from decoder: inout JSONDecoder) throws { + let s = try decoder.scanner.nextQuotedString() + (seconds, nanos) = try parseDuration(text: s) + } + func encodedJSONString(options: JSONEncodingOptions) throws -> String { + if let formatted = formatDuration(seconds: seconds, nanos: nanos) { + return "\"\(formatted)\"" + } else { + throw JSONEncodingError.durationRange + } + } +} + +extension Google_Protobuf_Duration: ExpressibleByFloatLiteral { + public typealias FloatLiteralType = Double + + /// Creates a new `Google_Protobuf_Duration` from a floating point literal + /// that is interpreted as a duration in seconds, rounded to the nearest + /// nanosecond. + public init(floatLiteral value: Double) { + let sd = trunc(value) + let nd = round((value - sd) * TimeInterval(nanosPerSecond)) + let (s, n) = normalizeForDuration(seconds: Int64(sd), nanos: Int32(nd)) + self.init(seconds: s, nanos: n) + } +} + +extension Google_Protobuf_Duration { + /// Creates a new `Google_Protobuf_Duration` that is equal to the given + /// `TimeInterval` (measured in seconds), rounded to the nearest nanosecond. + /// + /// - Parameter timeInterval: The `TimeInterval`. + public init(timeInterval: TimeInterval) { + let sd = trunc(timeInterval) + let nd = round((timeInterval - sd) * TimeInterval(nanosPerSecond)) + let (s, n) = normalizeForDuration(seconds: Int64(sd), nanos: Int32(nd)) + self.init(seconds: s, nanos: n) + } + + /// The `TimeInterval` (measured in seconds) equal to this duration. + public var timeInterval: TimeInterval { + return TimeInterval(self.seconds) + + TimeInterval(self.nanos) / TimeInterval(nanosPerSecond) + } +} + +private func normalizeForDuration( + seconds: Int64, + nanos: Int32 +) -> (seconds: Int64, nanos: Int32) { + var s = seconds + var n = nanos + + // If the magnitude of n exceeds a second then + // we need to factor it into s instead. + if n >= nanosPerSecond || n <= -nanosPerSecond { + s += Int64(n / nanosPerSecond) + n = n % nanosPerSecond + } + + // The Duration spec says that when s != 0, s and + // n must have the same sign. + if s > 0 && n < 0 { + n += nanosPerSecond + s -= 1 + } else if s < 0 && n > 0 { + n -= nanosPerSecond + s += 1 + } + + return (seconds: s, nanos: n) +} + +public prefix func - ( + operand: Google_Protobuf_Duration +) -> Google_Protobuf_Duration { + let (s, n) = normalizeForDuration(seconds: -operand.seconds, + nanos: -operand.nanos) + return Google_Protobuf_Duration(seconds: s, nanos: n) +} + +public func + ( + lhs: Google_Protobuf_Duration, + rhs: Google_Protobuf_Duration +) -> Google_Protobuf_Duration { + let (s, n) = normalizeForDuration(seconds: lhs.seconds + rhs.seconds, + nanos: lhs.nanos + rhs.nanos) + return Google_Protobuf_Duration(seconds: s, nanos: n) +} + +public func - ( + lhs: Google_Protobuf_Duration, + rhs: Google_Protobuf_Duration +) -> Google_Protobuf_Duration { + let (s, n) = normalizeForDuration(seconds: lhs.seconds - rhs.seconds, + nanos: lhs.nanos - rhs.nanos) + return Google_Protobuf_Duration(seconds: s, nanos: n) +} + +public func - ( + lhs: Google_Protobuf_Timestamp, + rhs: Google_Protobuf_Timestamp +) -> Google_Protobuf_Duration { + let (s, n) = normalizeForDuration(seconds: lhs.seconds - rhs.seconds, + nanos: lhs.nanos - rhs.nanos) + return Google_Protobuf_Duration(seconds: s, nanos: n) +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Google_Protobuf_FieldMask+Extensions.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Google_Protobuf_FieldMask+Extensions.swift new file mode 100644 index 0000000..6720c94 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Google_Protobuf_FieldMask+Extensions.swift @@ -0,0 +1,163 @@ +// Sources/SwiftProtobuf/Google_Protobuf_FieldMask+Extensions.swift - Fieldmask extensions +// +// Copyright (c) 2014 - 2016 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Extend the generated FieldMask message with customized JSON coding and +/// convenience methods. +/// +// ----------------------------------------------------------------------------- + +// TODO: We should have utilities to apply a fieldmask to an arbitrary +// message, intersect two fieldmasks, etc. + +private func ProtoToJSON(name: String) -> String? { + var jsonPath = String() + var chars = name.makeIterator() + while let c = chars.next() { + switch c { + case "_": + if let toupper = chars.next() { + switch toupper { + case "a"..."z": + jsonPath.append(String(toupper).uppercased()) + default: + return nil + } + } else { + return nil + } + case "A"..."Z": + return nil + default: + jsonPath.append(c) + } + } + return jsonPath +} + +private func JSONToProto(name: String) -> String? { + var path = String() + for c in name { + switch c { + case "_": + return nil + case "A"..."Z": + path.append(Character("_")) + path.append(String(c).lowercased()) + default: + path.append(c) + } + } + return path +} + +private func parseJSONFieldNames(names: String) -> [String]? { + // An empty field mask is the empty string (no paths). + guard !names.isEmpty else { return [] } + var fieldNameCount = 0 + var fieldName = String() + var split = [String]() + for c in names { + switch c { + case ",": + if fieldNameCount == 0 { + return nil + } + if let pbName = JSONToProto(name: fieldName) { + split.append(pbName) + } else { + return nil + } + fieldName = String() + fieldNameCount = 0 + default: + fieldName.append(c) + fieldNameCount += 1 + } + } + if fieldNameCount == 0 { // Last field name can't be empty + return nil + } + if let pbName = JSONToProto(name: fieldName) { + split.append(pbName) + } else { + return nil + } + return split +} + +extension Google_Protobuf_FieldMask { + /// Creates a new `Google_Protobuf_FieldMask` from the given array of paths. + /// + /// The paths should match the names used in the .proto file, which may be + /// different than the corresponding Swift property names. + /// + /// - Parameter protoPaths: The paths from which to create the field mask, + /// defined using the .proto names for the fields. + public init(protoPaths: [String]) { + self.init() + paths = protoPaths + } + + /// Creates a new `Google_Protobuf_FieldMask` from the given paths. + /// + /// The paths should match the names used in the .proto file, which may be + /// different than the corresponding Swift property names. + /// + /// - Parameter protoPaths: The paths from which to create the field mask, + /// defined using the .proto names for the fields. + public init(protoPaths: String...) { + self.init(protoPaths: protoPaths) + } + + /// Creates a new `Google_Protobuf_FieldMask` from the given paths. + /// + /// The paths should match the JSON names of the fields, which may be + /// different than the corresponding Swift property names. + /// + /// - Parameter jsonPaths: The paths from which to create the field mask, + /// defined using the JSON names for the fields. + public init?(jsonPaths: String...) { + // TODO: This should fail if any of the conversions from JSON fails + #if swift(>=4.1) + self.init(protoPaths: jsonPaths.compactMap(JSONToProto)) + #else + self.init(protoPaths: jsonPaths.flatMap(JSONToProto)) + #endif + } + + // It would be nice if to have an initializer that accepted Swift property + // names, but translating between swift and protobuf/json property + // names is not entirely deterministic. +} + +extension Google_Protobuf_FieldMask: _CustomJSONCodable { + mutating func decodeJSON(from decoder: inout JSONDecoder) throws { + let s = try decoder.scanner.nextQuotedString() + if let names = parseJSONFieldNames(names: s) { + paths = names + } else { + throw JSONDecodingError.malformedFieldMask + } + } + + func encodedJSONString(options: JSONEncodingOptions) throws -> String { + // Note: Proto requires alphanumeric field names, so there + // cannot be a ',' or '"' character to mess up this formatting. + var jsonPaths = [String]() + for p in paths { + if let jsonPath = ProtoToJSON(name: p) { + jsonPaths.append(jsonPath) + } else { + throw JSONEncodingError.fieldMaskConversion + } + } + return "\"" + jsonPaths.joined(separator: ",") + "\"" + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Google_Protobuf_ListValue+Extensions.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Google_Protobuf_ListValue+Extensions.swift new file mode 100644 index 0000000..453ea0d --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Google_Protobuf_ListValue+Extensions.swift @@ -0,0 +1,80 @@ +// Sources/SwiftProtobuf/Google_Protobuf_ListValue+Extensions.swift - ListValue extensions +// +// Copyright (c) 2014 - 2017 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// ListValue is a well-known message type that can be used to parse or encode +/// arbitrary JSON arrays without a predefined schema. +/// +// ----------------------------------------------------------------------------- + +extension Google_Protobuf_ListValue: ExpressibleByArrayLiteral { + // TODO: Give this a direct array interface by proxying the interesting + // bits down to values + public typealias Element = Google_Protobuf_Value + + /// Creates a new `Google_Protobuf_ListValue` from an array literal containing + /// `Google_Protobuf_Value` elements. + public init(arrayLiteral elements: Element...) { + self.init(values: elements) + } +} + +extension Google_Protobuf_ListValue: _CustomJSONCodable { + internal func encodedJSONString(options: JSONEncodingOptions) throws -> String { + var jsonEncoder = JSONEncoder() + jsonEncoder.append(text: "[") + var separator: StaticString = "" + for v in values { + jsonEncoder.append(staticText: separator) + try v.serializeJSONValue(to: &jsonEncoder, options: options) + separator = "," + } + jsonEncoder.append(text: "]") + return jsonEncoder.stringResult + } + + internal mutating func decodeJSON(from decoder: inout JSONDecoder) throws { + if decoder.scanner.skipOptionalNull() { + return + } + try decoder.scanner.skipRequiredArrayStart() + if decoder.scanner.skipOptionalArrayEnd() { + return + } + while true { + var v = Google_Protobuf_Value() + try v.decodeJSON(from: &decoder) + values.append(v) + if decoder.scanner.skipOptionalArrayEnd() { + return + } + try decoder.scanner.skipRequiredComma() + } + } +} + +extension Google_Protobuf_ListValue { + /// Creates a new `Google_Protobuf_ListValue` from the given array of + /// `Google_Protobuf_Value` elements. + /// + /// - Parameter values: The list of `Google_Protobuf_Value` messages from + /// which to create the `Google_Protobuf_ListValue`. + public init(values: [Google_Protobuf_Value]) { + self.init() + self.values = values + } + + /// Accesses the `Google_Protobuf_Value` at the specified position. + /// + /// - Parameter index: The position of the element to access. + public subscript(index: Int) -> Google_Protobuf_Value { + get {return values[index]} + set(newValue) {values[index] = newValue} + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Google_Protobuf_NullValue+Extensions.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Google_Protobuf_NullValue+Extensions.swift new file mode 100644 index 0000000..c918a7f --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Google_Protobuf_NullValue+Extensions.swift @@ -0,0 +1,28 @@ +// Sources/SwiftProtobuf/Google_Protobuf_NullValue+Extensions.swift - NullValue extensions +// +// Copyright (c) 2014 - 2020 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// NullValue is a well-known message type that can be used to parse or encode +/// JSON Null values. +/// +// ----------------------------------------------------------------------------- + +extension Google_Protobuf_NullValue: _CustomJSONCodable { + internal func encodedJSONString(options: JSONEncodingOptions) throws -> String { + return "null" + } + internal mutating func decodeJSON(from decoder: inout JSONDecoder) throws { + if decoder.scanner.skipOptionalNull() { + return + } + } + static func decodedFromJSONNull() -> Google_Protobuf_NullValue? { + return .nullValue + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Google_Protobuf_Struct+Extensions.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Google_Protobuf_Struct+Extensions.swift new file mode 100644 index 0000000..1a7c31c --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Google_Protobuf_Struct+Extensions.swift @@ -0,0 +1,85 @@ +// Sources/SwiftProtobuf/Google_Protobuf_Struct+Extensions.swift - Struct extensions +// +// Copyright (c) 2014 - 2017 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Struct is a well-known message type that can be used to parse or encode +/// arbitrary JSON objects without a predefined schema. +/// +// ----------------------------------------------------------------------------- + +extension Google_Protobuf_Struct: ExpressibleByDictionaryLiteral { + public typealias Key = String + public typealias Value = Google_Protobuf_Value + + /// Creates a new `Google_Protobuf_Struct` from a dictionary of string keys to + /// values of type `Google_Protobuf_Value`. + public init(dictionaryLiteral: (String, Google_Protobuf_Value)...) { + self.init() + for (k,v) in dictionaryLiteral { + fields[k] = v + } + } +} + +extension Google_Protobuf_Struct: _CustomJSONCodable { + internal func encodedJSONString(options: JSONEncodingOptions) throws -> String { + var jsonEncoder = JSONEncoder() + jsonEncoder.startObject() + var mapVisitor = JSONMapEncodingVisitor(encoder: jsonEncoder, options: options) + for (k,v) in fields { + try mapVisitor.visitSingularStringField(value: k, fieldNumber: 1) + try mapVisitor.visitSingularMessageField(value: v, fieldNumber: 2) + } + mapVisitor.encoder.endObject() + return mapVisitor.encoder.stringResult + } + + internal mutating func decodeJSON(from decoder: inout JSONDecoder) throws { + try decoder.scanner.skipRequiredObjectStart() + if decoder.scanner.skipOptionalObjectEnd() { + return + } + while true { + let key = try decoder.scanner.nextQuotedString() + try decoder.scanner.skipRequiredColon() + var value = Google_Protobuf_Value() + try value.decodeJSON(from: &decoder) + fields[key] = value + if decoder.scanner.skipOptionalObjectEnd() { + return + } + try decoder.scanner.skipRequiredComma() + } + } +} + +extension Google_Protobuf_Struct { + /// Creates a new `Google_Protobuf_Struct` from a dictionary of string keys to + /// values of type `Google_Protobuf_Value`. + /// + /// - Parameter fields: The dictionary from field names to + /// `Google_Protobuf_Value` messages that should be used to create the + /// `Struct`. + public init(fields: [String: Google_Protobuf_Value]) { + self.init() + self.fields = fields + } + + /// Accesses the `Google_Protobuf_Value` with the given key for reading and + /// writing. + /// + /// This key-based subscript returns the `Value` for the given key if the key + /// is found in the `Struct`, or nil if the key is not found. If you assign + /// nil as the `Value` for the given key, the `Struct` removes that key and + /// its associated `Value`. + public subscript(key: String) -> Google_Protobuf_Value? { + get {return fields[key]} + set(newValue) {fields[key] = newValue} + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Google_Protobuf_Timestamp+Extensions.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Google_Protobuf_Timestamp+Extensions.swift new file mode 100644 index 0000000..11735f6 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Google_Protobuf_Timestamp+Extensions.swift @@ -0,0 +1,337 @@ +// Sources/SwiftProtobuf/Google_Protobuf_Timestamp+Extensions.swift - Timestamp extensions +// +// Copyright (c) 2014 - 2016 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Extend the generated Timestamp message with customized JSON coding, +/// arithmetic operations, and convenience methods. +/// +// ----------------------------------------------------------------------------- + +import Foundation + +private let minTimestampSeconds: Int64 = -62135596800 // 0001-01-01T00:00:00Z +private let maxTimestampSeconds: Int64 = 253402300799 // 9999-12-31T23:59:59Z + +// TODO: Add convenience methods to interoperate with standard +// date/time classes: an initializer that accepts Unix timestamp as +// Int or Double, an easy way to convert to/from Foundation's +// NSDateTime (on Apple platforms only?), others? + + +// Parse an RFC3339 timestamp into a pair of seconds-since-1970 and nanos. +private func parseTimestamp(s: String) throws -> (Int64, Int32) { + // Convert to an array of integer character values + let value = s.utf8.map{Int($0)} + if value.count < 20 { + throw JSONDecodingError.malformedTimestamp + } + // Since the format is fixed-layout, we can just decode + // directly as follows. + let zero = Int(48) + let nine = Int(57) + let dash = Int(45) + let colon = Int(58) + let plus = Int(43) + let letterT = Int(84) + let letterZ = Int(90) + let period = Int(46) + + func fromAscii2(_ digit0: Int, _ digit1: Int) throws -> Int { + if digit0 < zero || digit0 > nine || digit1 < zero || digit1 > nine { + throw JSONDecodingError.malformedTimestamp + } + return digit0 * 10 + digit1 - 528 + } + + func fromAscii4( + _ digit0: Int, + _ digit1: Int, + _ digit2: Int, + _ digit3: Int + ) throws -> Int { + if (digit0 < zero || digit0 > nine + || digit1 < zero || digit1 > nine + || digit2 < zero || digit2 > nine + || digit3 < zero || digit3 > nine) { + throw JSONDecodingError.malformedTimestamp + } + return digit0 * 1000 + digit1 * 100 + digit2 * 10 + digit3 - 53328 + } + + // Year: 4 digits followed by '-' + let year = try fromAscii4(value[0], value[1], value[2], value[3]) + if value[4] != dash || year < Int(1) || year > Int(9999) { + throw JSONDecodingError.malformedTimestamp + } + + // Month: 2 digits followed by '-' + let month = try fromAscii2(value[5], value[6]) + if value[7] != dash || month < Int(1) || month > Int(12) { + throw JSONDecodingError.malformedTimestamp + } + + // Day: 2 digits followed by 'T' + let mday = try fromAscii2(value[8], value[9]) + if value[10] != letterT || mday < Int(1) || mday > Int(31) { + throw JSONDecodingError.malformedTimestamp + } + + // Hour: 2 digits followed by ':' + let hour = try fromAscii2(value[11], value[12]) + if value[13] != colon || hour > Int(23) { + throw JSONDecodingError.malformedTimestamp + } + + // Minute: 2 digits followed by ':' + let minute = try fromAscii2(value[14], value[15]) + if value[16] != colon || minute > Int(59) { + throw JSONDecodingError.malformedTimestamp + } + + // Second: 2 digits (following char is checked below) + let second = try fromAscii2(value[17], value[18]) + if second > Int(61) { + throw JSONDecodingError.malformedTimestamp + } + + // timegm() is almost entirely useless. It's nonexistent on + // some platforms, broken on others. Everything else I've tried + // is even worse. Hence the code below. + // (If you have a better way to do this, try it and see if it + // passes the test suite on both Linux and OS X.) + + // Day of year + let mdayStart: [Int] = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334] + var yday = Int64(mdayStart[month - 1]) + let isleap = (year % 400 == 0) || ((year % 100 != 0) && (year % 4 == 0)) + if isleap && (month > 2) { + yday += 1 + } + yday += Int64(mday - 1) + + // Days since start of epoch (including leap days) + var daysSinceEpoch = yday + daysSinceEpoch += Int64(365 * year) - Int64(719527) + daysSinceEpoch += Int64((year - 1) / 4) + daysSinceEpoch -= Int64((year - 1) / 100) + daysSinceEpoch += Int64((year - 1) / 400) + + // Second within day + var daySec = Int64(hour) + daySec *= 60 + daySec += Int64(minute) + daySec *= 60 + daySec += Int64(second) + + // Seconds since start of epoch + let t = daysSinceEpoch * Int64(86400) + daySec + + // After seconds, comes various optional bits + var pos = 19 + + var nanos: Int32 = 0 + if value[pos] == period { // "." begins fractional seconds + pos += 1 + var digitValue = 100000000 + while pos < value.count && value[pos] >= zero && value[pos] <= nine { + nanos += Int32(digitValue * (value[pos] - zero)) + digitValue /= 10 + pos += 1 + } + } + + var seconds: Int64 = 0 + // "+" or "-" starts Timezone offset + if value[pos] == plus || value[pos] == dash { + if pos + 6 > value.count { + throw JSONDecodingError.malformedTimestamp + } + let hourOffset = try fromAscii2(value[pos + 1], value[pos + 2]) + let minuteOffset = try fromAscii2(value[pos + 4], value[pos + 5]) + if hourOffset > Int(13) || minuteOffset > Int(59) || value[pos + 3] != colon { + throw JSONDecodingError.malformedTimestamp + } + var adjusted: Int64 = t + if value[pos] == plus { + adjusted -= Int64(hourOffset) * Int64(3600) + adjusted -= Int64(minuteOffset) * Int64(60) + } else { + adjusted += Int64(hourOffset) * Int64(3600) + adjusted += Int64(minuteOffset) * Int64(60) + } + if adjusted < minTimestampSeconds || adjusted > maxTimestampSeconds { + throw JSONDecodingError.malformedTimestamp + } + seconds = adjusted + pos += 6 + } else if value[pos] == letterZ { // "Z" indicator for UTC + seconds = t + pos += 1 + } else { + throw JSONDecodingError.malformedTimestamp + } + if pos != value.count { + throw JSONDecodingError.malformedTimestamp + } + return (seconds, nanos) +} + +private func formatTimestamp(seconds: Int64, nanos: Int32) -> String? { + let (seconds, nanos) = normalizeForTimestamp(seconds: seconds, nanos: nanos) + guard seconds >= minTimestampSeconds && seconds <= maxTimestampSeconds else { + return nil + } + + let (hh, mm, ss) = timeOfDayFromSecondsSince1970(seconds: seconds) + let (YY, MM, DD) = gregorianDateFromSecondsSince1970(seconds: seconds) + + if nanos == 0 { + return String(format: "%04d-%02d-%02dT%02d:%02d:%02dZ", + YY, MM, DD, hh, mm, ss) + } else if nanos % 1000000 == 0 { + return String(format: "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", + YY, MM, DD, hh, mm, ss, nanos / 1000000) + } else if nanos % 1000 == 0 { + return String(format: "%04d-%02d-%02dT%02d:%02d:%02d.%06dZ", + YY, MM, DD, hh, mm, ss, nanos / 1000) + } else { + return String(format: "%04d-%02d-%02dT%02d:%02d:%02d.%09dZ", + YY, MM, DD, hh, mm, ss, nanos) + } +} + +extension Google_Protobuf_Timestamp { + /// Creates a new `Google_Protobuf_Timestamp` equal to the given number of + /// seconds and nanoseconds. + /// + /// - Parameter seconds: The number of seconds. + /// - Parameter nanos: The number of nanoseconds. + public init(seconds: Int64 = 0, nanos: Int32 = 0) { + self.init() + self.seconds = seconds + self.nanos = nanos + } +} + +extension Google_Protobuf_Timestamp: _CustomJSONCodable { + mutating func decodeJSON(from decoder: inout JSONDecoder) throws { + let s = try decoder.scanner.nextQuotedString() + (seconds, nanos) = try parseTimestamp(s: s) + } + + func encodedJSONString(options: JSONEncodingOptions) throws -> String { + if let formatted = formatTimestamp(seconds: seconds, nanos: nanos) { + return "\"\(formatted)\"" + } else { + throw JSONEncodingError.timestampRange + } + } +} + +extension Google_Protobuf_Timestamp { + /// Creates a new `Google_Protobuf_Timestamp` initialized relative to 00:00:00 + /// UTC on 1 January 1970 by a given number of seconds. + /// + /// - Parameter timeIntervalSince1970: The `TimeInterval`, interpreted as + /// seconds relative to 00:00:00 UTC on 1 January 1970. + public init(timeIntervalSince1970: TimeInterval) { + let sd = floor(timeIntervalSince1970) + let nd = round((timeIntervalSince1970 - sd) * TimeInterval(nanosPerSecond)) + let (s, n) = normalizeForTimestamp(seconds: Int64(sd), nanos: Int32(nd)) + self.init(seconds: s, nanos: n) + } + + /// Creates a new `Google_Protobuf_Timestamp` initialized relative to 00:00:00 + /// UTC on 1 January 2001 by a given number of seconds. + /// + /// - Parameter timeIntervalSinceReferenceDate: The `TimeInterval`, + /// interpreted as seconds relative to 00:00:00 UTC on 1 January 2001. + public init(timeIntervalSinceReferenceDate: TimeInterval) { + let sd = floor(timeIntervalSinceReferenceDate) + let nd = round( + (timeIntervalSinceReferenceDate - sd) * TimeInterval(nanosPerSecond)) + // The addition of timeIntervalBetween1970And... is deliberately delayed + // until the input is separated into an integer part and a fraction + // part, so that we don't unnecessarily lose precision. + let (s, n) = normalizeForTimestamp( + seconds: Int64(sd) + Int64(Date.timeIntervalBetween1970AndReferenceDate), + nanos: Int32(nd)) + self.init(seconds: s, nanos: n) + } + + /// Creates a new `Google_Protobuf_Timestamp` initialized to the same time as + /// the given `Date`. + /// + /// - Parameter date: The `Date` with which to initialize the timestamp. + public init(date: Date) { + // Note: Internally, Date uses the "reference date," not the 1970 date. + // We use it when interacting with Dates so that Date doesn't perform + // any double arithmetic on our behalf, which might cost us precision. + self.init( + timeIntervalSinceReferenceDate: date.timeIntervalSinceReferenceDate) + } + + /// The interval between the timestamp and 00:00:00 UTC on 1 January 1970. + public var timeIntervalSince1970: TimeInterval { + return TimeInterval(self.seconds) + + TimeInterval(self.nanos) / TimeInterval(nanosPerSecond) + } + + /// The interval between the timestamp and 00:00:00 UTC on 1 January 2001. + public var timeIntervalSinceReferenceDate: TimeInterval { + return TimeInterval( + self.seconds - Int64(Date.timeIntervalBetween1970AndReferenceDate)) + + TimeInterval(self.nanos) / TimeInterval(nanosPerSecond) + } + + /// A `Date` initialized to the same time as the timestamp. + public var date: Date { + return Date( + timeIntervalSinceReferenceDate: self.timeIntervalSinceReferenceDate) + } +} + +private func normalizeForTimestamp( + seconds: Int64, + nanos: Int32 +) -> (seconds: Int64, nanos: Int32) { + // The Timestamp spec says that nanos must be in the range [0, 999999999), + // as in actual modular arithmetic. + + let s = seconds + Int64(div(nanos, nanosPerSecond)) + let n = mod(nanos, nanosPerSecond) + return (seconds: s, nanos: n) +} + +public func + ( + lhs: Google_Protobuf_Timestamp, + rhs: Google_Protobuf_Duration +) -> Google_Protobuf_Timestamp { + let (s, n) = normalizeForTimestamp(seconds: lhs.seconds + rhs.seconds, + nanos: lhs.nanos + rhs.nanos) + return Google_Protobuf_Timestamp(seconds: s, nanos: n) +} + +public func + ( + lhs: Google_Protobuf_Duration, + rhs: Google_Protobuf_Timestamp +) -> Google_Protobuf_Timestamp { + let (s, n) = normalizeForTimestamp(seconds: lhs.seconds + rhs.seconds, + nanos: lhs.nanos + rhs.nanos) + return Google_Protobuf_Timestamp(seconds: s, nanos: n) +} + +public func - ( + lhs: Google_Protobuf_Timestamp, + rhs: Google_Protobuf_Duration +) -> Google_Protobuf_Timestamp { + let (s, n) = normalizeForTimestamp(seconds: lhs.seconds - rhs.seconds, + nanos: lhs.nanos - rhs.nanos) + return Google_Protobuf_Timestamp(seconds: s, nanos: n) +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Google_Protobuf_Value+Extensions.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Google_Protobuf_Value+Extensions.swift new file mode 100644 index 0000000..9d4c7d7 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Google_Protobuf_Value+Extensions.swift @@ -0,0 +1,163 @@ +// Sources/SwiftProtobuf/Google_Protobuf_Value+Extensions.swift - Value extensions +// +// Copyright (c) 2014 - 2017 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Value is a well-known message type that can be used to parse or encode +/// arbitrary JSON without a predefined schema. +/// +// ----------------------------------------------------------------------------- + +extension Google_Protobuf_Value: ExpressibleByIntegerLiteral { + public typealias IntegerLiteralType = Int64 + + /// Creates a new `Google_Protobuf_Value` from an integer literal. + public init(integerLiteral value: Int64) { + self.init(kind: .numberValue(Double(value))) + } +} + +extension Google_Protobuf_Value: ExpressibleByFloatLiteral { + public typealias FloatLiteralType = Double + + /// Creates a new `Google_Protobuf_Value` from a floating point literal. + public init(floatLiteral value: Double) { + self.init(kind: .numberValue(value)) + } +} + +extension Google_Protobuf_Value: ExpressibleByBooleanLiteral { + public typealias BooleanLiteralType = Bool + + /// Creates a new `Google_Protobuf_Value` from a boolean literal. + public init(booleanLiteral value: Bool) { + self.init(kind: .boolValue(value)) + } +} + +extension Google_Protobuf_Value: ExpressibleByStringLiteral { + public typealias StringLiteralType = String + public typealias ExtendedGraphemeClusterLiteralType = String + public typealias UnicodeScalarLiteralType = String + + /// Creates a new `Google_Protobuf_Value` from a string literal. + public init(stringLiteral value: String) { + self.init(kind: .stringValue(value)) + } + + /// Creates a new `Google_Protobuf_Value` from a Unicode scalar literal. + public init(unicodeScalarLiteral value: String) { + self.init(kind: .stringValue(value)) + } + + /// Creates a new `Google_Protobuf_Value` from a character literal. + public init(extendedGraphemeClusterLiteral value: String) { + self.init(kind: .stringValue(value)) + } +} + +extension Google_Protobuf_Value: ExpressibleByNilLiteral { + /// Creates a new `Google_Protobuf_Value` from the nil literal. + public init(nilLiteral: ()) { + self.init(kind: .nullValue(.nullValue)) + } +} + +extension Google_Protobuf_Value: _CustomJSONCodable { + internal func encodedJSONString(options: JSONEncodingOptions) throws -> String { + var jsonEncoder = JSONEncoder() + try serializeJSONValue(to: &jsonEncoder, options: options) + return jsonEncoder.stringResult + } + + internal mutating func decodeJSON(from decoder: inout JSONDecoder) throws { + let c = try decoder.scanner.peekOneCharacter() + switch c { + case "n": + if !decoder.scanner.skipOptionalNull() { + throw JSONDecodingError.failure + } + kind = .nullValue(.nullValue) + case "[": + var l = Google_Protobuf_ListValue() + try l.decodeJSON(from: &decoder) + kind = .listValue(l) + case "{": + var s = Google_Protobuf_Struct() + try s.decodeJSON(from: &decoder) + kind = .structValue(s) + case "t", "f": + let b = try decoder.scanner.nextBool() + kind = .boolValue(b) + case "\"": + let s = try decoder.scanner.nextQuotedString() + kind = .stringValue(s) + default: + let d = try decoder.scanner.nextDouble() + kind = .numberValue(d) + } + } + + internal static func decodedFromJSONNull() -> Google_Protobuf_Value? { + return Google_Protobuf_Value(kind: .nullValue(.nullValue)) + } +} + +extension Google_Protobuf_Value { + /// Creates a new `Google_Protobuf_Value` with the given kind. + fileprivate init(kind: OneOf_Kind) { + self.init() + self.kind = kind + } + + /// Creates a new `Google_Protobuf_Value` whose `kind` is `numberValue` with + /// the given floating-point value. + public init(numberValue: Double) { + self.init(kind: .numberValue(numberValue)) + } + + /// Creates a new `Google_Protobuf_Value` whose `kind` is `stringValue` with + /// the given string value. + public init(stringValue: String) { + self.init(kind: .stringValue(stringValue)) + } + + /// Creates a new `Google_Protobuf_Value` whose `kind` is `boolValue` with the + /// given boolean value. + public init(boolValue: Bool) { + self.init(kind: .boolValue(boolValue)) + } + + /// Creates a new `Google_Protobuf_Value` whose `kind` is `structValue` with + /// the given `Google_Protobuf_Struct` value. + public init(structValue: Google_Protobuf_Struct) { + self.init(kind: .structValue(structValue)) + } + + /// Creates a new `Google_Protobuf_Value` whose `kind` is `listValue` with the + /// given `Google_Struct_ListValue` value. + public init(listValue: Google_Protobuf_ListValue) { + self.init(kind: .listValue(listValue)) + } + + /// Writes out the JSON representation of the value to the given encoder. + internal func serializeJSONValue( + to encoder: inout JSONEncoder, + options: JSONEncodingOptions + ) throws { + switch kind { + case .nullValue?: encoder.putNullValue() + case .numberValue(let v)?: encoder.putDoubleValue(value: v) + case .stringValue(let v)?: encoder.putStringValue(value: v) + case .boolValue(let v)?: encoder.putBoolValue(value: v) + case .structValue(let v)?: encoder.append(text: try v.jsonString(options: options)) + case .listValue(let v)?: encoder.append(text: try v.jsonString(options: options)) + case nil: throw JSONEncodingError.missingValue + } + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Google_Protobuf_Wrappers+Extensions.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Google_Protobuf_Wrappers+Extensions.swift new file mode 100644 index 0000000..e039598 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Google_Protobuf_Wrappers+Extensions.swift @@ -0,0 +1,247 @@ +// Sources/SwiftProtobuf/Google_Protobuf_Wrappers+Extensions.swift - Well-known wrapper type extensions +// +// Copyright (c) 2014 - 2016 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Extensions to the well-known types in wrapper.proto that customize the JSON +/// format of those messages and provide convenience initializers from literals. +/// +// ----------------------------------------------------------------------------- + +import Foundation + +/// Internal protocol that minimizes the code duplication across the multiple +/// wrapper types extended below. +protocol ProtobufWrapper { + + /// The wrapped protobuf type (for example, `ProtobufDouble`). + associatedtype WrappedType: FieldType + + /// Exposes the generated property to the extensions here. + var value: WrappedType.BaseType { get set } + + /// Exposes the parameterless initializer to the extensions here. + init() + + /// Creates a new instance of the wrapper with the given value. + init(_ value: WrappedType.BaseType) +} + +extension ProtobufWrapper { + mutating func decodeJSON(from decoder: inout JSONDecoder) throws { + var v: WrappedType.BaseType? + try WrappedType.decodeSingular(value: &v, from: &decoder) + value = v ?? WrappedType.proto3DefaultValue + } +} + +extension Google_Protobuf_DoubleValue: + ProtobufWrapper, ExpressibleByFloatLiteral, _CustomJSONCodable { + + public typealias WrappedType = ProtobufDouble + public typealias FloatLiteralType = WrappedType.BaseType + + public init(_ value: WrappedType.BaseType) { + self.init() + self.value = value + } + + public init(floatLiteral: FloatLiteralType) { + self.init(floatLiteral) + } + + func encodedJSONString(options: JSONEncodingOptions) throws -> String { + if value.isFinite { + // Swift 4.2 and later guarantees that this is accurate + // enough to parse back to the exact value on the other end. + return value.description + } else { + // Protobuf-specific handling of NaN and infinities + var encoder = JSONEncoder() + encoder.putDoubleValue(value: value) + return encoder.stringResult + } + } +} + +extension Google_Protobuf_FloatValue: + ProtobufWrapper, ExpressibleByFloatLiteral, _CustomJSONCodable { + + public typealias WrappedType = ProtobufFloat + public typealias FloatLiteralType = Float + + public init(_ value: WrappedType.BaseType) { + self.init() + self.value = value + } + + public init(floatLiteral: FloatLiteralType) { + self.init(floatLiteral) + } + + func encodedJSONString(options: JSONEncodingOptions) throws -> String { + if value.isFinite { + // Swift 4.2 and later guarantees that this is accurate + // enough to parse back to the exact value on the other end. + return value.description + } else { + // Protobuf-specific handling of NaN and infinities + var encoder = JSONEncoder() + encoder.putFloatValue(value: value) + return encoder.stringResult + } + } +} + +extension Google_Protobuf_Int64Value: + ProtobufWrapper, ExpressibleByIntegerLiteral, _CustomJSONCodable { + + public typealias WrappedType = ProtobufInt64 + public typealias IntegerLiteralType = WrappedType.BaseType + + public init(_ value: WrappedType.BaseType) { + self.init() + self.value = value + } + + public init(integerLiteral: IntegerLiteralType) { + self.init(integerLiteral) + } + + func encodedJSONString(options: JSONEncodingOptions) throws -> String { + return "\"" + String(value) + "\"" + } +} + +extension Google_Protobuf_UInt64Value: + ProtobufWrapper, ExpressibleByIntegerLiteral, _CustomJSONCodable { + + public typealias WrappedType = ProtobufUInt64 + public typealias IntegerLiteralType = WrappedType.BaseType + + public init(_ value: WrappedType.BaseType) { + self.init() + self.value = value + } + + public init(integerLiteral: IntegerLiteralType) { + self.init(integerLiteral) + } + + func encodedJSONString(options: JSONEncodingOptions) throws -> String { + return "\"" + String(value) + "\"" + } +} + +extension Google_Protobuf_Int32Value: + ProtobufWrapper, ExpressibleByIntegerLiteral, _CustomJSONCodable { + + public typealias WrappedType = ProtobufInt32 + public typealias IntegerLiteralType = WrappedType.BaseType + + public init(_ value: WrappedType.BaseType) { + self.init() + self.value = value + } + + public init(integerLiteral: IntegerLiteralType) { + self.init(integerLiteral) + } + + func encodedJSONString(options: JSONEncodingOptions) throws -> String { + return String(value) + } +} + +extension Google_Protobuf_UInt32Value: + ProtobufWrapper, ExpressibleByIntegerLiteral, _CustomJSONCodable { + + public typealias WrappedType = ProtobufUInt32 + public typealias IntegerLiteralType = WrappedType.BaseType + + public init(_ value: WrappedType.BaseType) { + self.init() + self.value = value + } + + public init(integerLiteral: IntegerLiteralType) { + self.init(integerLiteral) + } + + func encodedJSONString(options: JSONEncodingOptions) throws -> String { + return String(value) + } +} + +extension Google_Protobuf_BoolValue: + ProtobufWrapper, ExpressibleByBooleanLiteral, _CustomJSONCodable { + + public typealias WrappedType = ProtobufBool + public typealias BooleanLiteralType = Bool + + public init(_ value: WrappedType.BaseType) { + self.init() + self.value = value + } + + public init(booleanLiteral: Bool) { + self.init(booleanLiteral) + } + + func encodedJSONString(options: JSONEncodingOptions) throws -> String { + return value ? "true" : "false" + } +} + +extension Google_Protobuf_StringValue: + ProtobufWrapper, ExpressibleByStringLiteral, _CustomJSONCodable { + + public typealias WrappedType = ProtobufString + public typealias StringLiteralType = String + public typealias ExtendedGraphemeClusterLiteralType = String + public typealias UnicodeScalarLiteralType = String + + public init(_ value: WrappedType.BaseType) { + self.init() + self.value = value + } + + public init(stringLiteral: String) { + self.init(stringLiteral) + } + + public init(extendedGraphemeClusterLiteral: String) { + self.init(extendedGraphemeClusterLiteral) + } + + public init(unicodeScalarLiteral: String) { + self.init(unicodeScalarLiteral) + } + + func encodedJSONString(options: JSONEncodingOptions) throws -> String { + var encoder = JSONEncoder() + encoder.putStringValue(value: value) + return encoder.stringResult + } +} + +extension Google_Protobuf_BytesValue: ProtobufWrapper, _CustomJSONCodable { + + public typealias WrappedType = ProtobufBytes + + public init(_ value: WrappedType.BaseType) { + self.init() + self.value = value + } + + func encodedJSONString(options: JSONEncodingOptions) throws -> String { + var encoder = JSONEncoder() + encoder.putBytesValue(value: value) + return encoder.stringResult + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/HashVisitor.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/HashVisitor.swift new file mode 100644 index 0000000..f8d6a14 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/HashVisitor.swift @@ -0,0 +1,426 @@ +// Sources/SwiftProtobuf/HashVisitor.swift - Hashing support +// +// Copyright (c) 2014 - 2016 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Hashing is basically a serialization problem, so we can leverage the +/// generated traversal methods for that. +/// +// ----------------------------------------------------------------------------- + +import Foundation + +private let i_2166136261 = Int(bitPattern: 2166136261) +private let i_16777619 = Int(16777619) + +/// Computes the hash of a message by visiting its fields recursively. +/// +/// Note that because this visits every field, it has the potential to be slow +/// for large or deeply nested messages. Users who need to use such messages as +/// dictionary keys or set members can use a wrapper struct around the message +/// and use a custom Hashable implementation that looks at the subset of the +/// message fields they want to include. +internal struct HashVisitor: Visitor { + +#if swift(>=4.2) + internal private(set) var hasher: Hasher +#else // swift(>=4.2) + // Roughly based on FNV hash: http://tools.ietf.org/html/draft-eastlake-fnv-03 + private(set) var hashValue = i_2166136261 + + private mutating func mix(_ hash: Int) { + hashValue = (hashValue ^ hash) &* i_16777619 + } + + private mutating func mixMap(map: Dictionary) { + var mapHash = 0 + for (k, v) in map { + // Note: This calculation cannot depend on the order of the items. + mapHash = mapHash &+ (k.hashValue ^ v.hashValue) + } + mix(mapHash) + } +#endif // swift(>=4.2) + +#if swift(>=4.2) + init(_ hasher: Hasher) { + self.hasher = hasher + } +#else + init() {} +#endif + + mutating func visitUnknown(bytes: Data) throws { + #if swift(>=4.2) + hasher.combine(bytes) + #else + mix(bytes.hashValue) + #endif + } + + mutating func visitSingularDoubleField(value: Double, fieldNumber: Int) throws { + #if swift(>=4.2) + hasher.combine(fieldNumber) + hasher.combine(value) + #else + mix(fieldNumber) + mix(value.hashValue) + #endif + } + + mutating func visitSingularInt64Field(value: Int64, fieldNumber: Int) throws { + #if swift(>=4.2) + hasher.combine(fieldNumber) + hasher.combine(value) + #else + mix(fieldNumber) + mix(value.hashValue) + #endif + } + + mutating func visitSingularUInt64Field(value: UInt64, fieldNumber: Int) throws { + #if swift(>=4.2) + hasher.combine(fieldNumber) + hasher.combine(value) + #else + mix(fieldNumber) + mix(value.hashValue) + #endif + } + + mutating func visitSingularBoolField(value: Bool, fieldNumber: Int) throws { + #if swift(>=4.2) + hasher.combine(fieldNumber) + hasher.combine(value) + #else + mix(fieldNumber) + mix(value.hashValue) + #endif + } + + mutating func visitSingularStringField(value: String, fieldNumber: Int) throws { + #if swift(>=4.2) + hasher.combine(fieldNumber) + hasher.combine(value) + #else + mix(fieldNumber) + mix(value.hashValue) + #endif + } + + mutating func visitSingularBytesField(value: Data, fieldNumber: Int) throws { + #if swift(>=4.2) + hasher.combine(fieldNumber) + hasher.combine(value) + #else + mix(fieldNumber) + mix(value.hashValue) + #endif + } + + mutating func visitSingularEnumField(value: E, + fieldNumber: Int) { + #if swift(>=4.2) + hasher.combine(fieldNumber) + hasher.combine(value) + #else + mix(fieldNumber) + mix(value.hashValue) + #endif + } + + mutating func visitSingularMessageField(value: M, fieldNumber: Int) { + #if swift(>=4.2) + hasher.combine(fieldNumber) + value.hash(into: &hasher) + #else + mix(fieldNumber) + mix(value.hashValue) + #endif + } + + mutating func visitRepeatedFloatField(value: [Float], fieldNumber: Int) throws { + assert(!value.isEmpty) + #if swift(>=4.2) + hasher.combine(fieldNumber) + hasher.combine(value) + #else + mix(fieldNumber) + for v in value { + mix(v.hashValue) + } + #endif + } + + mutating func visitRepeatedDoubleField(value: [Double], fieldNumber: Int) throws { + assert(!value.isEmpty) + #if swift(>=4.2) + hasher.combine(fieldNumber) + hasher.combine(value) + #else + mix(fieldNumber) + for v in value { + mix(v.hashValue) + } + #endif + } + + mutating func visitRepeatedInt32Field(value: [Int32], fieldNumber: Int) throws { + assert(!value.isEmpty) + #if swift(>=4.2) + hasher.combine(fieldNumber) + hasher.combine(value) + #else + mix(fieldNumber) + for v in value { + mix(v.hashValue) + } + #endif + } + + mutating func visitRepeatedInt64Field(value: [Int64], fieldNumber: Int) throws { + assert(!value.isEmpty) + #if swift(>=4.2) + hasher.combine(fieldNumber) + hasher.combine(value) + #else + mix(fieldNumber) + for v in value { + mix(v.hashValue) + } + #endif + } + + mutating func visitRepeatedUInt32Field(value: [UInt32], fieldNumber: Int) throws { + assert(!value.isEmpty) + #if swift(>=4.2) + hasher.combine(fieldNumber) + hasher.combine(value) + #else + mix(fieldNumber) + for v in value { + mix(v.hashValue) + } + #endif + } + + mutating func visitRepeatedUInt64Field(value: [UInt64], fieldNumber: Int) throws { + assert(!value.isEmpty) + #if swift(>=4.2) + hasher.combine(fieldNumber) + hasher.combine(value) + #else + mix(fieldNumber) + for v in value { + mix(v.hashValue) + } + #endif + } + + mutating func visitRepeatedSInt32Field(value: [Int32], fieldNumber: Int) throws { + assert(!value.isEmpty) + #if swift(>=4.2) + hasher.combine(fieldNumber) + hasher.combine(value) + #else + mix(fieldNumber) + for v in value { + mix(v.hashValue) + } + #endif + } + + mutating func visitRepeatedSInt64Field(value: [Int64], fieldNumber: Int) throws { + assert(!value.isEmpty) + #if swift(>=4.2) + hasher.combine(fieldNumber) + hasher.combine(value) + #else + mix(fieldNumber) + for v in value { + mix(v.hashValue) + } + #endif + } + + mutating func visitRepeatedFixed32Field(value: [UInt32], fieldNumber: Int) throws { + assert(!value.isEmpty) + #if swift(>=4.2) + hasher.combine(fieldNumber) + hasher.combine(value) + #else + mix(fieldNumber) + for v in value { + mix(v.hashValue) + } + #endif + } + + mutating func visitRepeatedFixed64Field(value: [UInt64], fieldNumber: Int) throws { + assert(!value.isEmpty) + #if swift(>=4.2) + hasher.combine(fieldNumber) + hasher.combine(value) + #else + mix(fieldNumber) + for v in value { + mix(v.hashValue) + } + #endif + } + + mutating func visitRepeatedSFixed32Field(value: [Int32], fieldNumber: Int) throws { + assert(!value.isEmpty) + #if swift(>=4.2) + hasher.combine(fieldNumber) + hasher.combine(value) + #else + mix(fieldNumber) + for v in value { + mix(v.hashValue) + } + #endif + } + + mutating func visitRepeatedSFixed64Field(value: [Int64], fieldNumber: Int) throws { + assert(!value.isEmpty) + #if swift(>=4.2) + hasher.combine(fieldNumber) + hasher.combine(value) + #else + mix(fieldNumber) + for v in value { + mix(v.hashValue) + } + #endif + } + + mutating func visitRepeatedBoolField(value: [Bool], fieldNumber: Int) throws { + assert(!value.isEmpty) + #if swift(>=4.2) + hasher.combine(fieldNumber) + hasher.combine(value) + #else + mix(fieldNumber) + for v in value { + mix(v.hashValue) + } + #endif + } + + mutating func visitRepeatedStringField(value: [String], fieldNumber: Int) throws { + assert(!value.isEmpty) + #if swift(>=4.2) + hasher.combine(fieldNumber) + hasher.combine(value) + #else + mix(fieldNumber) + for v in value { + mix(v.hashValue) + } + #endif + } + + mutating func visitRepeatedBytesField(value: [Data], fieldNumber: Int) throws { + assert(!value.isEmpty) + #if swift(>=4.2) + hasher.combine(fieldNumber) + hasher.combine(value) + #else + mix(fieldNumber) + for v in value { + mix(v.hashValue) + } + #endif + } + + mutating func visitRepeatedEnumField(value: [E], fieldNumber: Int) throws { + assert(!value.isEmpty) + #if swift(>=4.2) + hasher.combine(fieldNumber) + hasher.combine(value) + #else + mix(fieldNumber) + for v in value { + mix(v.hashValue) + } + #endif + } + + mutating func visitRepeatedMessageField(value: [M], fieldNumber: Int) throws { + assert(!value.isEmpty) + #if swift(>=4.2) + hasher.combine(fieldNumber) + for v in value { + v.hash(into: &hasher) + } + #else + mix(fieldNumber) + for v in value { + mix(v.hashValue) + } + #endif + } + + mutating func visitRepeatedGroupField(value: [G], fieldNumber: Int) throws { + assert(!value.isEmpty) + #if swift(>=4.2) + hasher.combine(fieldNumber) + for v in value { + v.hash(into: &hasher) + } + #else + mix(fieldNumber) + for v in value { + mix(v.hashValue) + } + #endif + } + + mutating func visitMapField( + fieldType: _ProtobufMap.Type, + value: _ProtobufMap.BaseType, + fieldNumber: Int + ) throws { + #if swift(>=4.2) + hasher.combine(fieldNumber) + hasher.combine(value) + #else + mix(fieldNumber) + mixMap(map: value) + #endif + } + + mutating func visitMapField( + fieldType: _ProtobufEnumMap.Type, + value: _ProtobufEnumMap.BaseType, + fieldNumber: Int + ) throws where ValueType.RawValue == Int { + #if swift(>=4.2) + hasher.combine(fieldNumber) + hasher.combine(value) + #else + mix(fieldNumber) + mixMap(map: value) + #endif + } + + mutating func visitMapField( + fieldType: _ProtobufMessageMap.Type, + value: _ProtobufMessageMap.BaseType, + fieldNumber: Int + ) throws { + #if swift(>=4.2) + hasher.combine(fieldNumber) + hasher.combine(value) + #else + mix(fieldNumber) + mixMap(map: value) + #endif + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Internal.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Internal.swift new file mode 100644 index 0000000..6402e22 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Internal.swift @@ -0,0 +1,51 @@ +// Sources/SwiftProtobuf/Internal.swift - Message support +// +// Copyright (c) 2014 - 2017 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Internal helpers on Messages for the library. These are public +/// just so the generated code can call them, but shouldn't be called +/// by developers directly. +/// +// ----------------------------------------------------------------------------- + +import Foundation + +/// Functions that are public only because they are used by generated message +/// implementations. NOT INTENDED TO BE CALLED BY CLIENTS. +public enum Internal { + + /// A singleton instance of an empty data that is used by the generated code + /// for default values. This is a performance enhancement to work around the + /// fact that the `Data` type in Swift involves a new heap allocation every + /// time an empty instance is initialized, instead of sharing a common empty + /// backing storage. + public static let emptyData = Data() + + /// Helper to loop over a list of Messages to see if they are all + /// initialized (see Message.isInitialized for what that means). + public static func areAllInitialized(_ listOfMessages: [Message]) -> Bool { + for msg in listOfMessages { + if !msg.isInitialized { + return false + } + } + return true + } + + /// Helper to loop over dictionary with values that are Messages to see if + /// they are all initialized (see Message.isInitialized for what that means). + public static func areAllInitialized(_ mapToMessages: [K: Message]) -> Bool { + for (_, msg) in mapToMessages { + if !msg.isInitialized { + return false + } + } + return true + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/JSONDecoder.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/JSONDecoder.swift new file mode 100644 index 0000000..41e8e5a --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/JSONDecoder.swift @@ -0,0 +1,735 @@ +// Sources/SwiftProtobuf/JSONDecoder.swift - JSON format decoding +// +// Copyright (c) 2014 - 2016 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// JSON format decoding engine. +/// +// ----------------------------------------------------------------------------- + +import Foundation + +internal struct JSONDecoder: Decoder { + internal var scanner: JSONScanner + internal var messageType: Message.Type + private var fieldCount = 0 + private var isMapKey = false + private var fieldNameMap: _NameMap? + + internal var options: JSONDecodingOptions { + return scanner.options + } + + mutating func handleConflictingOneOf() throws { + throw JSONDecodingError.conflictingOneOf + } + + internal init(source: UnsafeRawBufferPointer, options: JSONDecodingOptions, + messageType: Message.Type, extensions: ExtensionMap?) { + let scanner = JSONScanner(source: source, + options: options, + extensions: extensions) + self.init(scanner: scanner, messageType: messageType) + } + + private init(scanner: JSONScanner, messageType: Message.Type) { + self.scanner = scanner + self.messageType = messageType + } + + mutating func nextFieldNumber() throws -> Int? { + if scanner.skipOptionalObjectEnd() { + return nil + } + if fieldCount > 0 { + try scanner.skipRequiredComma() + } + let fieldNumber = try scanner.nextFieldNumber(names: fieldNameMap!, + messageType: messageType) + if let fieldNumber = fieldNumber { + fieldCount += 1 + return fieldNumber + } + return nil + } + + mutating func decodeSingularFloatField(value: inout Float) throws { + if scanner.skipOptionalNull() { + value = 0 + return + } + value = try scanner.nextFloat() + } + + mutating func decodeSingularFloatField(value: inout Float?) throws { + if scanner.skipOptionalNull() { + value = nil + return + } + value = try scanner.nextFloat() + } + + mutating func decodeRepeatedFloatField(value: inout [Float]) throws { + if scanner.skipOptionalNull() { + return + } + try scanner.skipRequiredArrayStart() + if scanner.skipOptionalArrayEnd() { + return + } + while true { + let n = try scanner.nextFloat() + value.append(n) + if scanner.skipOptionalArrayEnd() { + return + } + try scanner.skipRequiredComma() + } + } + + mutating func decodeSingularDoubleField(value: inout Double) throws { + if scanner.skipOptionalNull() { + value = 0 + return + } + value = try scanner.nextDouble() + } + + mutating func decodeSingularDoubleField(value: inout Double?) throws { + if scanner.skipOptionalNull() { + value = nil + return + } + value = try scanner.nextDouble() + } + + mutating func decodeRepeatedDoubleField(value: inout [Double]) throws { + if scanner.skipOptionalNull() { + return + } + try scanner.skipRequiredArrayStart() + if scanner.skipOptionalArrayEnd() { + return + } + while true { + let n = try scanner.nextDouble() + value.append(n) + if scanner.skipOptionalArrayEnd() { + return + } + try scanner.skipRequiredComma() + } + } + + mutating func decodeSingularInt32Field(value: inout Int32) throws { + if scanner.skipOptionalNull() { + value = 0 + return + } + let n = try scanner.nextSInt() + if n > Int64(Int32.max) || n < Int64(Int32.min) { + throw JSONDecodingError.numberRange + } + value = Int32(truncatingIfNeeded: n) + } + + mutating func decodeSingularInt32Field(value: inout Int32?) throws { + if scanner.skipOptionalNull() { + value = nil + return + } + let n = try scanner.nextSInt() + if n > Int64(Int32.max) || n < Int64(Int32.min) { + throw JSONDecodingError.numberRange + } + value = Int32(truncatingIfNeeded: n) + } + + mutating func decodeRepeatedInt32Field(value: inout [Int32]) throws { + if scanner.skipOptionalNull() { + return + } + try scanner.skipRequiredArrayStart() + if scanner.skipOptionalArrayEnd() { + return + } + while true { + let n = try scanner.nextSInt() + if n > Int64(Int32.max) || n < Int64(Int32.min) { + throw JSONDecodingError.numberRange + } + value.append(Int32(truncatingIfNeeded: n)) + if scanner.skipOptionalArrayEnd() { + return + } + try scanner.skipRequiredComma() + } + } + + mutating func decodeSingularInt64Field(value: inout Int64) throws { + if scanner.skipOptionalNull() { + value = 0 + return + } + value = try scanner.nextSInt() + } + + mutating func decodeSingularInt64Field(value: inout Int64?) throws { + if scanner.skipOptionalNull() { + value = nil + return + } + value = try scanner.nextSInt() + } + + mutating func decodeRepeatedInt64Field(value: inout [Int64]) throws { + if scanner.skipOptionalNull() { + return + } + try scanner.skipRequiredArrayStart() + if scanner.skipOptionalArrayEnd() { + return + } + while true { + let n = try scanner.nextSInt() + value.append(n) + if scanner.skipOptionalArrayEnd() { + return + } + try scanner.skipRequiredComma() + } + } + + mutating func decodeSingularUInt32Field(value: inout UInt32) throws { + if scanner.skipOptionalNull() { + value = 0 + return + } + let n = try scanner.nextUInt() + if n > UInt64(UInt32.max) { + throw JSONDecodingError.numberRange + } + value = UInt32(truncatingIfNeeded: n) + } + + mutating func decodeSingularUInt32Field(value: inout UInt32?) throws { + if scanner.skipOptionalNull() { + value = nil + return + } + let n = try scanner.nextUInt() + if n > UInt64(UInt32.max) { + throw JSONDecodingError.numberRange + } + value = UInt32(truncatingIfNeeded: n) + } + + mutating func decodeRepeatedUInt32Field(value: inout [UInt32]) throws { + if scanner.skipOptionalNull() { + return + } + try scanner.skipRequiredArrayStart() + if scanner.skipOptionalArrayEnd() { + return + } + while true { + let n = try scanner.nextUInt() + if n > UInt64(UInt32.max) { + throw JSONDecodingError.numberRange + } + value.append(UInt32(truncatingIfNeeded: n)) + if scanner.skipOptionalArrayEnd() { + return + } + try scanner.skipRequiredComma() + } + } + + mutating func decodeSingularUInt64Field(value: inout UInt64) throws { + if scanner.skipOptionalNull() { + value = 0 + return + } + value = try scanner.nextUInt() + } + + mutating func decodeSingularUInt64Field(value: inout UInt64?) throws { + if scanner.skipOptionalNull() { + value = nil + return + } + value = try scanner.nextUInt() + } + + mutating func decodeRepeatedUInt64Field(value: inout [UInt64]) throws { + if scanner.skipOptionalNull() { + return + } + try scanner.skipRequiredArrayStart() + if scanner.skipOptionalArrayEnd() { + return + } + while true { + let n = try scanner.nextUInt() + value.append(n) + if scanner.skipOptionalArrayEnd() { + return + } + try scanner.skipRequiredComma() + } + } + + mutating func decodeSingularSInt32Field(value: inout Int32) throws { + try decodeSingularInt32Field(value: &value) + } + + mutating func decodeSingularSInt32Field(value: inout Int32?) throws { + try decodeSingularInt32Field(value: &value) + } + + mutating func decodeRepeatedSInt32Field(value: inout [Int32]) throws { + try decodeRepeatedInt32Field(value: &value) + } + + mutating func decodeSingularSInt64Field(value: inout Int64) throws { + try decodeSingularInt64Field(value: &value) + } + + mutating func decodeSingularSInt64Field(value: inout Int64?) throws { + try decodeSingularInt64Field(value: &value) + } + + mutating func decodeRepeatedSInt64Field(value: inout [Int64]) throws { + try decodeRepeatedInt64Field(value: &value) + } + + mutating func decodeSingularFixed32Field(value: inout UInt32) throws { + try decodeSingularUInt32Field(value: &value) + } + + mutating func decodeSingularFixed32Field(value: inout UInt32?) throws { + try decodeSingularUInt32Field(value: &value) + } + + mutating func decodeRepeatedFixed32Field(value: inout [UInt32]) throws { + try decodeRepeatedUInt32Field(value: &value) + } + + mutating func decodeSingularFixed64Field(value: inout UInt64) throws { + try decodeSingularUInt64Field(value: &value) + } + + mutating func decodeSingularFixed64Field(value: inout UInt64?) throws { + try decodeSingularUInt64Field(value: &value) + } + + mutating func decodeRepeatedFixed64Field(value: inout [UInt64]) throws { + try decodeRepeatedUInt64Field(value: &value) + } + + mutating func decodeSingularSFixed32Field(value: inout Int32) throws { + try decodeSingularInt32Field(value: &value) + } + + mutating func decodeSingularSFixed32Field(value: inout Int32?) throws { + try decodeSingularInt32Field(value: &value) + } + + mutating func decodeRepeatedSFixed32Field(value: inout [Int32]) throws { + try decodeRepeatedInt32Field(value: &value) + } + + mutating func decodeSingularSFixed64Field(value: inout Int64) throws { + try decodeSingularInt64Field(value: &value) + } + + mutating func decodeSingularSFixed64Field(value: inout Int64?) throws { + try decodeSingularInt64Field(value: &value) + } + + mutating func decodeRepeatedSFixed64Field(value: inout [Int64]) throws { + try decodeRepeatedInt64Field(value: &value) + } + + mutating func decodeSingularBoolField(value: inout Bool) throws { + if scanner.skipOptionalNull() { + value = false + return + } + if isMapKey { + value = try scanner.nextQuotedBool() + } else { + value = try scanner.nextBool() + } + } + + mutating func decodeSingularBoolField(value: inout Bool?) throws { + if scanner.skipOptionalNull() { + value = nil + return + } + if isMapKey { + value = try scanner.nextQuotedBool() + } else { + value = try scanner.nextBool() + } + } + + mutating func decodeRepeatedBoolField(value: inout [Bool]) throws { + if scanner.skipOptionalNull() { + return + } + try scanner.skipRequiredArrayStart() + if scanner.skipOptionalArrayEnd() { + return + } + while true { + let n = try scanner.nextBool() + value.append(n) + if scanner.skipOptionalArrayEnd() { + return + } + try scanner.skipRequiredComma() + } + } + + mutating func decodeSingularStringField(value: inout String) throws { + if scanner.skipOptionalNull() { + value = String() + return + } + value = try scanner.nextQuotedString() + } + + mutating func decodeSingularStringField(value: inout String?) throws { + if scanner.skipOptionalNull() { + value = nil + return + } + value = try scanner.nextQuotedString() + } + + mutating func decodeRepeatedStringField(value: inout [String]) throws { + if scanner.skipOptionalNull() { + return + } + try scanner.skipRequiredArrayStart() + if scanner.skipOptionalArrayEnd() { + return + } + while true { + let n = try scanner.nextQuotedString() + value.append(n) + if scanner.skipOptionalArrayEnd() { + return + } + try scanner.skipRequiredComma() + } + } + + mutating func decodeSingularBytesField(value: inout Data) throws { + if scanner.skipOptionalNull() { + value = Data() + return + } + value = try scanner.nextBytesValue() + } + + mutating func decodeSingularBytesField(value: inout Data?) throws { + if scanner.skipOptionalNull() { + value = nil + return + } + value = try scanner.nextBytesValue() + } + + mutating func decodeRepeatedBytesField(value: inout [Data]) throws { + if scanner.skipOptionalNull() { + return + } + try scanner.skipRequiredArrayStart() + if scanner.skipOptionalArrayEnd() { + return + } + while true { + let n = try scanner.nextBytesValue() + value.append(n) + if scanner.skipOptionalArrayEnd() { + return + } + try scanner.skipRequiredComma() + } + } + + mutating func decodeSingularEnumField(value: inout E?) throws + where E.RawValue == Int { + if scanner.skipOptionalNull() { + if let customDecodable = E.self as? _CustomJSONCodable.Type { + value = try customDecodable.decodedFromJSONNull() as? E + return + } + value = nil + return + } + value = try scanner.nextEnumValue() as E + } + + mutating func decodeSingularEnumField(value: inout E) throws + where E.RawValue == Int { + if scanner.skipOptionalNull() { + if let customDecodable = E.self as? _CustomJSONCodable.Type { + value = try customDecodable.decodedFromJSONNull() as! E + return + } + value = E() + return + } + value = try scanner.nextEnumValue() + } + + mutating func decodeRepeatedEnumField(value: inout [E]) throws + where E.RawValue == Int { + if scanner.skipOptionalNull() { + return + } + try scanner.skipRequiredArrayStart() + if scanner.skipOptionalArrayEnd() { + return + } + let maybeCustomDecodable = E.self as? _CustomJSONCodable.Type + while true { + if scanner.skipOptionalNull() { + if let customDecodable = maybeCustomDecodable { + let e = try customDecodable.decodedFromJSONNull() as! E + value.append(e) + } else { + throw JSONDecodingError.illegalNull + } + } else { + let e: E = try scanner.nextEnumValue() + value.append(e) + } + if scanner.skipOptionalArrayEnd() { + return + } + try scanner.skipRequiredComma() + } + } + + internal mutating func decodeFullObject(message: inout M) throws { + guard let nameProviding = (M.self as? _ProtoNameProviding.Type) else { + throw JSONDecodingError.missingFieldNames + } + fieldNameMap = nameProviding._protobuf_nameMap + if let m = message as? _CustomJSONCodable { + var customCodable = m + try customCodable.decodeJSON(from: &self) + message = customCodable as! M + } else { + try scanner.skipRequiredObjectStart() + if scanner.skipOptionalObjectEnd() { + return + } + try message.decodeMessage(decoder: &self) + } + } + + mutating func decodeSingularMessageField(value: inout M?) throws { + if scanner.skipOptionalNull() { + if M.self is _CustomJSONCodable.Type { + value = + try (M.self as! _CustomJSONCodable.Type).decodedFromJSONNull() as? M + return + } + // All other message field types treat 'null' as an unset + value = nil + return + } + if value == nil { + value = M() + } + var subDecoder = JSONDecoder(scanner: scanner, messageType: M.self) + try subDecoder.decodeFullObject(message: &value!) + assert(scanner.recursionBudget == subDecoder.scanner.recursionBudget) + scanner = subDecoder.scanner + } + + mutating func decodeRepeatedMessageField( + value: inout [M] + ) throws { + if scanner.skipOptionalNull() { + return + } + try scanner.skipRequiredArrayStart() + if scanner.skipOptionalArrayEnd() { + return + } + while true { + if scanner.skipOptionalNull() { + var appended = false + if M.self is _CustomJSONCodable.Type { + if let message = try (M.self as! _CustomJSONCodable.Type) + .decodedFromJSONNull() as? M { + value.append(message) + appended = true + } + } + if !appended { + throw JSONDecodingError.illegalNull + } + } else { + var message = M() + var subDecoder = JSONDecoder(scanner: scanner, messageType: M.self) + try subDecoder.decodeFullObject(message: &message) + value.append(message) + assert(scanner.recursionBudget == subDecoder.scanner.recursionBudget) + scanner = subDecoder.scanner + } + if scanner.skipOptionalArrayEnd() { + return + } + try scanner.skipRequiredComma() + } + } + + mutating func decodeSingularGroupField(value: inout G?) throws { + throw JSONDecodingError.schemaMismatch + } + + mutating func decodeRepeatedGroupField(value: inout [G]) throws { + throw JSONDecodingError.schemaMismatch + } + + mutating func decodeMapField( + fieldType: _ProtobufMap.Type, + value: inout _ProtobufMap.BaseType + ) throws { + if scanner.skipOptionalNull() { + return + } + try scanner.skipRequiredObjectStart() + if scanner.skipOptionalObjectEnd() { + return + } + while true { + // Next character must be double quote, because + // map keys must always be quoted strings. + let c = try scanner.peekOneCharacter() + if c != "\"" { + throw JSONDecodingError.unquotedMapKey + } + isMapKey = true + var keyField: KeyType.BaseType? + try KeyType.decodeSingular(value: &keyField, from: &self) + isMapKey = false + try scanner.skipRequiredColon() + var valueField: ValueType.BaseType? + try ValueType.decodeSingular(value: &valueField, from: &self) + if let keyField = keyField, let valueField = valueField { + value[keyField] = valueField + } else { + throw JSONDecodingError.malformedMap + } + if scanner.skipOptionalObjectEnd() { + return + } + try scanner.skipRequiredComma() + } + } + + mutating func decodeMapField( + fieldType: _ProtobufEnumMap.Type, + value: inout _ProtobufEnumMap.BaseType + ) throws where ValueType.RawValue == Int { + if scanner.skipOptionalNull() { + return + } + try scanner.skipRequiredObjectStart() + if scanner.skipOptionalObjectEnd() { + return + } + while true { + // Next character must be double quote, because + // map keys must always be quoted strings. + let c = try scanner.peekOneCharacter() + if c != "\"" { + throw JSONDecodingError.unquotedMapKey + } + isMapKey = true + var keyField: KeyType.BaseType? + try KeyType.decodeSingular(value: &keyField, from: &self) + isMapKey = false + try scanner.skipRequiredColon() + var valueField: ValueType? + try decodeSingularEnumField(value: &valueField) + if let keyField = keyField, let valueField = valueField { + value[keyField] = valueField + } else { + throw JSONDecodingError.malformedMap + } + if scanner.skipOptionalObjectEnd() { + return + } + try scanner.skipRequiredComma() + } + } + + mutating func decodeMapField( + fieldType: _ProtobufMessageMap.Type, + value: inout _ProtobufMessageMap.BaseType + ) throws { + if scanner.skipOptionalNull() { + return + } + try scanner.skipRequiredObjectStart() + if scanner.skipOptionalObjectEnd() { + return + } + while true { + // Next character must be double quote, because + // map keys must always be quoted strings. + let c = try scanner.peekOneCharacter() + if c != "\"" { + throw JSONDecodingError.unquotedMapKey + } + isMapKey = true + var keyField: KeyType.BaseType? + try KeyType.decodeSingular(value: &keyField, from: &self) + isMapKey = false + try scanner.skipRequiredColon() + var valueField: ValueType? + try decodeSingularMessageField(value: &valueField) + if let keyField = keyField, let valueField = valueField { + value[keyField] = valueField + } else { + throw JSONDecodingError.malformedMap + } + if scanner.skipOptionalObjectEnd() { + return + } + try scanner.skipRequiredComma() + } + } + + mutating func decodeExtensionField( + values: inout ExtensionFieldValueSet, + messageType: Message.Type, + fieldNumber: Int + ) throws { + // Force-unwrap: we can only get here if the extension exists. + let ext = scanner.extensions[messageType, fieldNumber]! + + var fieldValue = values[fieldNumber] + if fieldValue != nil { + try fieldValue!.decodeExtensionField(decoder: &self) + } else { + fieldValue = try ext._protobuf_newField(decoder: &self) + } + values[fieldNumber] = fieldValue! + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/JSONDecodingError.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/JSONDecodingError.swift new file mode 100644 index 0000000..8008eb0 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/JSONDecodingError.swift @@ -0,0 +1,62 @@ +// Sources/SwiftProtobuf/JSONDecodingError.swift - JSON decoding errors +// +// Copyright (c) 2014 - 2017 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// JSON decoding errors +/// +// ----------------------------------------------------------------------------- + +public enum JSONDecodingError: Error { + /// Something was wrong + case failure + /// A number could not be parsed + case malformedNumber + /// Numeric value was out of range or was not an integer value when expected + case numberRange + /// A map could not be parsed + case malformedMap + /// A bool could not be parsed + case malformedBool + /// We expected a quoted string, or a quoted string has a malformed backslash sequence + case malformedString + /// We encountered malformed UTF8 + case invalidUTF8 + /// The message does not have fieldName information + case missingFieldNames + /// The data type does not match the schema description + case schemaMismatch + /// A value (text or numeric) for an enum was not found on the enum + case unrecognizedEnumValue + /// A 'null' token appeared in an illegal location. + /// For example, Protobuf JSON does not allow 'null' tokens to appear + /// in lists. + case illegalNull + /// A map key was not quoted + case unquotedMapKey + /// JSON RFC 7519 does not allow numbers to have extra leading zeros + case leadingZero + /// We hit the end of the JSON string and expected something more... + case truncated + /// A JSON Duration could not be parsed + case malformedDuration + /// A JSON Timestamp could not be parsed + case malformedTimestamp + /// A FieldMask could not be parsed + case malformedFieldMask + /// Extraneous data remained after decoding should have been complete + case trailingGarbage + /// More than one value was specified for the same oneof field + case conflictingOneOf + /// Reached the nesting limit for messages within messages while decoding. + case messageDepthLimit + /// Encountered an unknown field with the given name. When parsing JSON, you + /// can instead instruct the library to ignore this via + /// JSONDecodingOptions.ignoreUnknownFields. + case unknownField(String) +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/JSONDecodingOptions.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/JSONDecodingOptions.swift new file mode 100644 index 0000000..da539c5 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/JSONDecodingOptions.swift @@ -0,0 +1,29 @@ +// Sources/SwiftProtobuf/JSONDecodingOptions.swift - JSON decoding options +// +// Copyright (c) 2014 - 2017 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// JSON decoding options +/// +// ----------------------------------------------------------------------------- + +/// Options for JSONDecoding. +public struct JSONDecodingOptions { + /// The maximum nesting of message with messages. The default is 100. + /// + /// To prevent corrupt or malicious messages from causing stack overflows, + /// this controls how deep messages can be nested within other messages + /// while parsing. + public var messageDepthLimit: Int = 100 + + /// If unknown fields in the JSON should be ignored. If they aren't + /// ignored, an error will be raised if one is encountered. + public var ignoreUnknownFields: Bool = false + + public init() {} +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/JSONEncoder.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/JSONEncoder.swift new file mode 100644 index 0000000..89f6e10 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/JSONEncoder.swift @@ -0,0 +1,386 @@ +// Sources/SwiftProtobuf/JSONEncoder.swift - JSON Encoding support +// +// Copyright (c) 2014 - 2019 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// JSON serialization engine. +/// +// ----------------------------------------------------------------------------- + +import Foundation + +private let asciiZero = UInt8(ascii: "0") +private let asciiOne = UInt8(ascii: "1") +private let asciiTwo = UInt8(ascii: "2") +private let asciiThree = UInt8(ascii: "3") +private let asciiFour = UInt8(ascii: "4") +private let asciiFive = UInt8(ascii: "5") +private let asciiSix = UInt8(ascii: "6") +private let asciiSeven = UInt8(ascii: "7") +private let asciiEight = UInt8(ascii: "8") +private let asciiNine = UInt8(ascii: "9") +private let asciiMinus = UInt8(ascii: "-") +private let asciiPlus = UInt8(ascii: "+") +private let asciiEquals = UInt8(ascii: "=") +private let asciiColon = UInt8(ascii: ":") +private let asciiComma = UInt8(ascii: ",") +private let asciiDoubleQuote = UInt8(ascii: "\"") +private let asciiBackslash = UInt8(ascii: "\\") +private let asciiForwardSlash = UInt8(ascii: "/") +private let asciiOpenSquareBracket = UInt8(ascii: "[") +private let asciiCloseSquareBracket = UInt8(ascii: "]") +private let asciiOpenCurlyBracket = UInt8(ascii: "{") +private let asciiCloseCurlyBracket = UInt8(ascii: "}") +private let asciiUpperA = UInt8(ascii: "A") +private let asciiUpperB = UInt8(ascii: "B") +private let asciiUpperC = UInt8(ascii: "C") +private let asciiUpperD = UInt8(ascii: "D") +private let asciiUpperE = UInt8(ascii: "E") +private let asciiUpperF = UInt8(ascii: "F") +private let asciiUpperZ = UInt8(ascii: "Z") +private let asciiLowerA = UInt8(ascii: "a") +private let asciiLowerZ = UInt8(ascii: "z") + +private let base64Digits: [UInt8] = { + var digits = [UInt8]() + digits.append(contentsOf: asciiUpperA...asciiUpperZ) + digits.append(contentsOf: asciiLowerA...asciiLowerZ) + digits.append(contentsOf: asciiZero...asciiNine) + digits.append(asciiPlus) + digits.append(asciiForwardSlash) + return digits +}() + +private let hexDigits: [UInt8] = { + var digits = [UInt8]() + digits.append(contentsOf: asciiZero...asciiNine) + digits.append(contentsOf: asciiUpperA...asciiUpperF) + return digits +}() + +internal struct JSONEncoder { + private var data = [UInt8]() + private var separator: UInt8? + + internal init() {} + + internal var dataResult: Data { return Data(data) } + + internal var stringResult: String { + get { + return String(bytes: data, encoding: String.Encoding.utf8)! + } + } + + /// Append a `StaticString` to the JSON text. Because + /// `StaticString` is already UTF8 internally, this is faster + /// than appending a regular `String`. + internal mutating func append(staticText: StaticString) { + let buff = UnsafeBufferPointer(start: staticText.utf8Start, count: staticText.utf8CodeUnitCount) + data.append(contentsOf: buff) + } + + /// Append a `_NameMap.Name` to the JSON text surrounded by quotes. + /// As with StaticString above, a `_NameMap.Name` provides pre-converted + /// UTF8 bytes, so this is much faster than appending a regular + /// `String`. + internal mutating func appendQuoted(name: _NameMap.Name) { + data.append(asciiDoubleQuote) + data.append(contentsOf: name.utf8Buffer) + data.append(asciiDoubleQuote) + } + + /// Append a `String` to the JSON text. + internal mutating func append(text: String) { + data.append(contentsOf: text.utf8) + } + + /// Append a raw utf8 in a `Data` to the JSON text. + internal mutating func append(utf8Data: Data) { + data.append(contentsOf: utf8Data) + } + + /// Begin a new field whose name is given as a `_NameMap.Name` + internal mutating func startField(name: _NameMap.Name) { + if let s = separator { + data.append(s) + } + appendQuoted(name: name) + data.append(asciiColon) + separator = asciiComma + } + + /// Begin a new field whose name is given as a `String`. + internal mutating func startField(name: String) { + if let s = separator { + data.append(s) + } + data.append(asciiDoubleQuote) + // Can avoid overhead of putStringValue, since + // the JSON field names are always clean ASCII. + data.append(contentsOf: name.utf8) + append(staticText: "\":") + separator = asciiComma + } + + /// Begin a new extension field + internal mutating func startExtensionField(name: String) { + if let s = separator { + data.append(s) + } + append(staticText: "\"[") + data.append(contentsOf: name.utf8) + append(staticText: "]\":") + separator = asciiComma + } + + /// Append an open square bracket `[` to the JSON. + internal mutating func startArray() { + data.append(asciiOpenSquareBracket) + separator = nil + } + + /// Append a close square bracket `]` to the JSON. + internal mutating func endArray() { + data.append(asciiCloseSquareBracket) + separator = asciiComma + } + + /// Append a comma `,` to the JSON. + internal mutating func comma() { + data.append(asciiComma) + } + + /// Append an open curly brace `{` to the JSON. + /// Assumes this object is part of an array of objects. + internal mutating func startArrayObject() { + if let s = separator { + data.append(s) + } + data.append(asciiOpenCurlyBracket) + separator = nil + } + + /// Append an open curly brace `{` to the JSON. + internal mutating func startObject() { + data.append(asciiOpenCurlyBracket) + separator = nil + } + + /// Append a close curly brace `}` to the JSON. + internal mutating func endObject() { + data.append(asciiCloseCurlyBracket) + separator = asciiComma + } + + /// Write a JSON `null` token to the output. + internal mutating func putNullValue() { + append(staticText: "null") + } + + /// Append a float value to the output. + /// This handles Nan and infinite values by + /// writing well-known string values. + internal mutating func putFloatValue(value: Float) { + if value.isNaN { + append(staticText: "\"NaN\"") + } else if !value.isFinite { + if value < 0 { + append(staticText: "\"-Infinity\"") + } else { + append(staticText: "\"Infinity\"") + } + } else { + data.append(contentsOf: value.debugDescription.utf8) + } + } + + /// Append a double value to the output. + /// This handles Nan and infinite values by + /// writing well-known string values. + internal mutating func putDoubleValue(value: Double) { + if value.isNaN { + append(staticText: "\"NaN\"") + } else if !value.isFinite { + if value < 0 { + append(staticText: "\"-Infinity\"") + } else { + append(staticText: "\"Infinity\"") + } + } else { + data.append(contentsOf: value.debugDescription.utf8) + } + } + + /// Append a UInt64 to the output (without quoting). + private mutating func appendUInt(value: UInt64) { + if value >= 10 { + appendUInt(value: value / 10) + } + data.append(asciiZero + UInt8(value % 10)) + } + + /// Append an Int64 to the output (without quoting). + private mutating func appendInt(value: Int64) { + if value < 0 { + data.append(asciiMinus) + // This is the twos-complement negation of value, + // computed in a way that won't overflow a 64-bit + // signed integer. + appendUInt(value: 1 + ~UInt64(bitPattern: value)) + } else { + appendUInt(value: UInt64(bitPattern: value)) + } + } + + /// Write an Enum as an int. + internal mutating func putEnumInt(value: Int) { + appendInt(value: Int64(value)) + } + + /// Write an `Int64` using protobuf JSON quoting conventions. + internal mutating func putInt64(value: Int64) { + data.append(asciiDoubleQuote) + appendInt(value: value) + data.append(asciiDoubleQuote) + } + + /// Write an `Int32` with quoting suitable for + /// using the value as a map key. + internal mutating func putQuotedInt32(value: Int32) { + data.append(asciiDoubleQuote) + appendInt(value: Int64(value)) + data.append(asciiDoubleQuote) + } + + /// Write an `Int32` in the default format. + internal mutating func putInt32(value: Int32) { + appendInt(value: Int64(value)) + } + + /// Write a `UInt64` using protobuf JSON quoting conventions. + internal mutating func putUInt64(value: UInt64) { + data.append(asciiDoubleQuote) + appendUInt(value: value) + data.append(asciiDoubleQuote) + } + + /// Write a `UInt32` with quoting suitable for + /// using the value as a map key. + internal mutating func putQuotedUInt32(value: UInt32) { + data.append(asciiDoubleQuote) + appendUInt(value: UInt64(value)) + data.append(asciiDoubleQuote) + } + + /// Write a `UInt32` in the default format. + internal mutating func putUInt32(value: UInt32) { + appendUInt(value: UInt64(value)) + } + + /// Write a `Bool` with quoting suitable for + /// using the value as a map key. + internal mutating func putQuotedBoolValue(value: Bool) { + data.append(asciiDoubleQuote) + putBoolValue(value: value) + data.append(asciiDoubleQuote) + } + + /// Write a `Bool` in the default format. + internal mutating func putBoolValue(value: Bool) { + if value { + append(staticText: "true") + } else { + append(staticText: "false") + } + } + + /// Append a string value escaping special characters as needed. + internal mutating func putStringValue(value: String) { + data.append(asciiDoubleQuote) + for c in value.unicodeScalars { + switch c.value { + // Special two-byte escapes + case 8: append(staticText: "\\b") + case 9: append(staticText: "\\t") + case 10: append(staticText: "\\n") + case 12: append(staticText: "\\f") + case 13: append(staticText: "\\r") + case 34: append(staticText: "\\\"") + case 92: append(staticText: "\\\\") + case 0...31, 127...159: // Hex form for C0 control chars + append(staticText: "\\u00") + data.append(hexDigits[Int(c.value / 16)]) + data.append(hexDigits[Int(c.value & 15)]) + case 23...126: + data.append(UInt8(truncatingIfNeeded: c.value)) + case 0x80...0x7ff: + data.append(0xc0 + UInt8(truncatingIfNeeded: c.value >> 6)) + data.append(0x80 + UInt8(truncatingIfNeeded: c.value & 0x3f)) + case 0x800...0xffff: + data.append(0xe0 + UInt8(truncatingIfNeeded: c.value >> 12)) + data.append(0x80 + UInt8(truncatingIfNeeded: (c.value >> 6) & 0x3f)) + data.append(0x80 + UInt8(truncatingIfNeeded: c.value & 0x3f)) + default: + data.append(0xf0 + UInt8(truncatingIfNeeded: c.value >> 18)) + data.append(0x80 + UInt8(truncatingIfNeeded: (c.value >> 12) & 0x3f)) + data.append(0x80 + UInt8(truncatingIfNeeded: (c.value >> 6) & 0x3f)) + data.append(0x80 + UInt8(truncatingIfNeeded: c.value & 0x3f)) + } + } + data.append(asciiDoubleQuote) + } + + /// Append a bytes value using protobuf JSON Base-64 encoding. + internal mutating func putBytesValue(value: Data) { + data.append(asciiDoubleQuote) + if value.count > 0 { + value.withUnsafeBytes { (body: UnsafeRawBufferPointer) in + if let p = body.baseAddress, body.count > 0 { + var t: Int = 0 + var bytesInGroup: Int = 0 + for i in 0..> 18) & 63]) + data.append(base64Digits[(t >> 12) & 63]) + data.append(base64Digits[(t >> 6) & 63]) + data.append(base64Digits[t & 63]) + t = 0 + bytesInGroup = 0 + } + t = (t << 8) + Int(p[i]) + bytesInGroup += 1 + } + switch bytesInGroup { + case 3: + data.append(base64Digits[(t >> 18) & 63]) + data.append(base64Digits[(t >> 12) & 63]) + data.append(base64Digits[(t >> 6) & 63]) + data.append(base64Digits[t & 63]) + case 2: + t <<= 8 + data.append(base64Digits[(t >> 18) & 63]) + data.append(base64Digits[(t >> 12) & 63]) + data.append(base64Digits[(t >> 6) & 63]) + data.append(asciiEquals) + case 1: + t <<= 16 + data.append(base64Digits[(t >> 18) & 63]) + data.append(base64Digits[(t >> 12) & 63]) + data.append(asciiEquals) + data.append(asciiEquals) + default: + break + } + } + } + } + data.append(asciiDoubleQuote) + } +} + diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/JSONEncodingError.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/JSONEncodingError.swift new file mode 100644 index 0000000..26f828c --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/JSONEncodingError.swift @@ -0,0 +1,35 @@ +// Sources/SwiftProtobuf/JSONEncodingError.swift - Error constants +// +// Copyright (c) 2014 - 2016 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Enum constants that identify the particular error. +/// +// ----------------------------------------------------------------------------- + +public enum JSONEncodingError: Error { + /// Any fields that were decoded from binary format cannot be + /// re-encoded into JSON unless the object they hold is a + /// well-known type or a type registered with via + /// Google_Protobuf_Any.register() + case anyTranscodeFailure + /// Timestamp values can only be JSON encoded if they hold a value + /// between 0001-01-01Z00:00:00 and 9999-12-31Z23:59:59. + case timestampRange + /// Duration values can only be JSON encoded if they hold a value + /// less than +/- 100 years. + case durationRange + /// Field masks get edited when converting between JSON and protobuf + case fieldMaskConversion + /// Field names were not compiled into the binary + case missingFieldNames + /// Instances of `Google_Protobuf_Value` can only be encoded if they have a + /// valid `kind` (that is, they represent a null value, number, boolean, + /// string, struct, or list). + case missingValue +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/JSONEncodingOptions.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/JSONEncodingOptions.swift new file mode 100644 index 0000000..8274e08 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/JSONEncodingOptions.swift @@ -0,0 +1,26 @@ +// Sources/SwiftProtobuf/JSONEncodingOptions.swift - JSON encoding options +// +// Copyright (c) 2014 - 2018 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// JSON encoding options +/// +// ----------------------------------------------------------------------------- + +/// Options for JSONEncoding. +public struct JSONEncodingOptions { + + /// Always print enums as ints. By default they are printed as strings. + public var alwaysPrintEnumsAsInts: Bool = false + + /// Whether to preserve proto field names. + /// By default they are converted to JSON(lowerCamelCase) names. + public var preserveProtoFieldNames: Bool = false + + public init() {} +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/JSONEncodingVisitor.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/JSONEncodingVisitor.swift new file mode 100644 index 0000000..db6a510 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/JSONEncodingVisitor.swift @@ -0,0 +1,404 @@ +// Sources/SwiftProtobuf/JSONEncodingVisitor.swift - JSON encoding visitor +// +// Copyright (c) 2014 - 2016 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Visitor that writes a message in JSON format. +/// +// ----------------------------------------------------------------------------- + +import Foundation + +/// Visitor that serializes a message into JSON format. +internal struct JSONEncodingVisitor: Visitor { + + private var encoder = JSONEncoder() + private var nameMap: _NameMap + private var extensions: ExtensionFieldValueSet? + private let options: JSONEncodingOptions + + /// The JSON text produced by the visitor, as raw UTF8 bytes. + var dataResult: Data { + return encoder.dataResult + } + + /// The JSON text produced by the visitor, as a String. + internal var stringResult: String { + return encoder.stringResult + } + + /// Creates a new visitor for serializing a message of the given type to JSON + /// format. + init(type: Message.Type, options: JSONEncodingOptions) throws { + if let nameProviding = type as? _ProtoNameProviding.Type { + self.nameMap = nameProviding._protobuf_nameMap + } else { + throw JSONEncodingError.missingFieldNames + } + self.options = options + } + + mutating func startArray() { + encoder.startArray() + } + + mutating func endArray() { + encoder.endArray() + } + + mutating func startObject(message: Message) { + self.extensions = (message as? ExtensibleMessage)?._protobuf_extensionFieldValues + encoder.startObject() + } + + mutating func startArrayObject(message: Message) { + self.extensions = (message as? ExtensibleMessage)?._protobuf_extensionFieldValues + encoder.startArrayObject() + } + + mutating func endObject() { + encoder.endObject() + } + + mutating func encodeField(name: String, stringValue value: String) { + encoder.startField(name: name) + encoder.putStringValue(value: value) + } + + mutating func encodeField(name: String, jsonText text: String) { + encoder.startField(name: name) + encoder.append(text: text) + } + + mutating func visitUnknown(bytes: Data) throws { + // JSON encoding has no provision for carrying proto2 unknown fields. + } + + mutating func visitSingularFloatField(value: Float, fieldNumber: Int) throws { + try startField(for: fieldNumber) + encoder.putFloatValue(value: value) + } + + mutating func visitSingularDoubleField(value: Double, fieldNumber: Int) throws { + try startField(for: fieldNumber) + encoder.putDoubleValue(value: value) + } + + mutating func visitSingularInt32Field(value: Int32, fieldNumber: Int) throws { + try startField(for: fieldNumber) + encoder.putInt32(value: value) + } + + mutating func visitSingularInt64Field(value: Int64, fieldNumber: Int) throws { + try startField(for: fieldNumber) + encoder.putInt64(value: value) + } + + mutating func visitSingularUInt32Field(value: UInt32, fieldNumber: Int) throws { + try startField(for: fieldNumber) + encoder.putUInt32(value: value) + } + + mutating func visitSingularUInt64Field(value: UInt64, fieldNumber: Int) throws { + try startField(for: fieldNumber) + encoder.putUInt64(value: value) + } + + mutating func visitSingularFixed32Field(value: UInt32, fieldNumber: Int) throws { + try startField(for: fieldNumber) + encoder.putUInt32(value: value) + } + + mutating func visitSingularSFixed32Field(value: Int32, fieldNumber: Int) throws { + try startField(for: fieldNumber) + encoder.putInt32(value: value) + } + + mutating func visitSingularBoolField(value: Bool, fieldNumber: Int) throws { + try startField(for: fieldNumber) + encoder.putBoolValue(value: value) + } + + mutating func visitSingularStringField(value: String, fieldNumber: Int) throws { + try startField(for: fieldNumber) + encoder.putStringValue(value: value) + } + + mutating func visitSingularBytesField(value: Data, fieldNumber: Int) throws { + try startField(for: fieldNumber) + encoder.putBytesValue(value: value) + } + + private mutating func _visitRepeated( + value: [T], + fieldNumber: Int, + encode: (inout JSONEncoder, T) throws -> () + ) throws { + assert(!value.isEmpty) + try startField(for: fieldNumber) + var comma = false + encoder.startArray() + for v in value { + if comma { + encoder.comma() + } + comma = true + try encode(&encoder, v) + } + encoder.endArray() + } + + mutating func visitSingularEnumField(value: E, fieldNumber: Int) throws { + try startField(for: fieldNumber) + if let e = value as? _CustomJSONCodable { + let json = try e.encodedJSONString(options: options) + encoder.append(text: json) + } else if !options.alwaysPrintEnumsAsInts, let n = value.name { + encoder.appendQuoted(name: n) + } else { + encoder.putEnumInt(value: value.rawValue) + } + } + + mutating func visitSingularMessageField(value: M, fieldNumber: Int) throws { + try startField(for: fieldNumber) + if let m = value as? _CustomJSONCodable { + let json = try m.encodedJSONString(options: options) + encoder.append(text: json) + } else if let newNameMap = (M.self as? _ProtoNameProviding.Type)?._protobuf_nameMap { + // Preserve outer object's name and extension maps; restore them before returning + let oldNameMap = self.nameMap + let oldExtensions = self.extensions + defer { + self.nameMap = oldNameMap + self.extensions = oldExtensions + } + // Install inner object's name and extension maps + self.nameMap = newNameMap + startObject(message: value) + try value.traverse(visitor: &self) + endObject() + } else { + throw JSONEncodingError.missingFieldNames + } + } + + mutating func visitSingularGroupField(value: G, fieldNumber: Int) throws { + // Google does not serialize groups into JSON + } + + mutating func visitRepeatedFloatField(value: [Float], fieldNumber: Int) throws { + try _visitRepeated(value: value, fieldNumber: fieldNumber) { + (encoder: inout JSONEncoder, v: Float) in + encoder.putFloatValue(value: v) + } + } + + mutating func visitRepeatedDoubleField(value: [Double], fieldNumber: Int) throws { + try _visitRepeated(value: value, fieldNumber: fieldNumber) { + (encoder: inout JSONEncoder, v: Double) in + encoder.putDoubleValue(value: v) + } + } + + mutating func visitRepeatedInt32Field(value: [Int32], fieldNumber: Int) throws { + try _visitRepeated(value: value, fieldNumber: fieldNumber) { + (encoder: inout JSONEncoder, v: Int32) in + encoder.putInt32(value: v) + } + } + + mutating func visitRepeatedInt64Field(value: [Int64], fieldNumber: Int) throws { + try _visitRepeated(value: value, fieldNumber: fieldNumber) { + (encoder: inout JSONEncoder, v: Int64) in + encoder.putInt64(value: v) + } + } + + mutating func visitRepeatedUInt32Field(value: [UInt32], fieldNumber: Int) throws { + try _visitRepeated(value: value, fieldNumber: fieldNumber) { + (encoder: inout JSONEncoder, v: UInt32) in + encoder.putUInt32(value: v) + } + } + + mutating func visitRepeatedUInt64Field(value: [UInt64], fieldNumber: Int) throws { + try _visitRepeated(value: value, fieldNumber: fieldNumber) { + (encoder: inout JSONEncoder, v: UInt64) in + encoder.putUInt64(value: v) + } + } + + mutating func visitRepeatedSInt32Field(value: [Int32], fieldNumber: Int) throws { + try visitRepeatedInt32Field(value: value, fieldNumber: fieldNumber) + } + + mutating func visitRepeatedSInt64Field(value: [Int64], fieldNumber: Int) throws { + try visitRepeatedInt64Field(value: value, fieldNumber: fieldNumber) + } + + mutating func visitRepeatedFixed32Field(value: [UInt32], fieldNumber: Int) throws { + try visitRepeatedUInt32Field(value: value, fieldNumber: fieldNumber) + } + + mutating func visitRepeatedFixed64Field(value: [UInt64], fieldNumber: Int) throws { + try visitRepeatedUInt64Field(value: value, fieldNumber: fieldNumber) + } + + mutating func visitRepeatedSFixed32Field(value: [Int32], fieldNumber: Int) throws { + try visitRepeatedInt32Field(value: value, fieldNumber: fieldNumber) + } + + mutating func visitRepeatedSFixed64Field(value: [Int64], fieldNumber: Int) throws { + try visitRepeatedInt64Field(value: value, fieldNumber: fieldNumber) + } + + mutating func visitRepeatedBoolField(value: [Bool], fieldNumber: Int) throws { + try _visitRepeated(value: value, fieldNumber: fieldNumber) { + (encoder: inout JSONEncoder, v: Bool) in + encoder.putBoolValue(value: v) + } + } + + mutating func visitRepeatedStringField(value: [String], fieldNumber: Int) throws { + try _visitRepeated(value: value, fieldNumber: fieldNumber) { + (encoder: inout JSONEncoder, v: String) in + encoder.putStringValue(value: v) + } + } + + mutating func visitRepeatedBytesField(value: [Data], fieldNumber: Int) throws { + try _visitRepeated(value: value, fieldNumber: fieldNumber) { + (encoder: inout JSONEncoder, v: Data) in + encoder.putBytesValue(value: v) + } + } + + mutating func visitRepeatedEnumField(value: [E], fieldNumber: Int) throws { + if let _ = E.self as? _CustomJSONCodable.Type { + let options = self.options + try _visitRepeated(value: value, fieldNumber: fieldNumber) { + (encoder: inout JSONEncoder, v: E) throws in + let e = v as! _CustomJSONCodable + let json = try e.encodedJSONString(options: options) + encoder.append(text: json) + } + } else { + let alwaysPrintEnumsAsInts = options.alwaysPrintEnumsAsInts + try _visitRepeated(value: value, fieldNumber: fieldNumber) { + (encoder: inout JSONEncoder, v: E) throws in + if !alwaysPrintEnumsAsInts, let n = v.name { + encoder.appendQuoted(name: n) + } else { + encoder.putEnumInt(value: v.rawValue) + } + } + } + } + + mutating func visitRepeatedMessageField(value: [M], fieldNumber: Int) throws { + assert(!value.isEmpty) + try startField(for: fieldNumber) + var comma = false + encoder.startArray() + if let _ = M.self as? _CustomJSONCodable.Type { + for v in value { + if comma { + encoder.comma() + } + comma = true + let json = try v.jsonString(options: options) + encoder.append(text: json) + } + } else if let newNameMap = (M.self as? _ProtoNameProviding.Type)?._protobuf_nameMap { + // Preserve name and extension maps for outer object + let oldNameMap = self.nameMap + let oldExtensions = self.extensions + // Restore outer object's name and extension maps before returning + defer { + self.nameMap = oldNameMap + self.extensions = oldExtensions + } + self.nameMap = newNameMap + for v in value { + startArrayObject(message: v) + try v.traverse(visitor: &self) + encoder.endObject() + } + } else { + throw JSONEncodingError.missingFieldNames + } + encoder.endArray() + } + + mutating func visitRepeatedGroupField(value: [G], fieldNumber: Int) throws { + assert(!value.isEmpty) + // Google does not serialize groups into JSON + } + + // Packed fields are handled the same as non-packed fields, so JSON just + // relies on the default implementations in Visitor.swift + + + + mutating func visitMapField(fieldType: _ProtobufMap.Type, value: _ProtobufMap.BaseType, fieldNumber: Int) throws { + try startField(for: fieldNumber) + encoder.append(text: "{") + var mapVisitor = JSONMapEncodingVisitor(encoder: encoder, options: options) + for (k,v) in value { + try KeyType.visitSingular(value: k, fieldNumber: 1, with: &mapVisitor) + try ValueType.visitSingular(value: v, fieldNumber: 2, with: &mapVisitor) + } + encoder = mapVisitor.encoder + encoder.append(text: "}") + } + + mutating func visitMapField(fieldType: _ProtobufEnumMap.Type, value: _ProtobufEnumMap.BaseType, fieldNumber: Int) throws where ValueType.RawValue == Int { + try startField(for: fieldNumber) + encoder.append(text: "{") + var mapVisitor = JSONMapEncodingVisitor(encoder: encoder, options: options) + for (k, v) in value { + try KeyType.visitSingular(value: k, fieldNumber: 1, with: &mapVisitor) + try mapVisitor.visitSingularEnumField(value: v, fieldNumber: 2) + } + encoder = mapVisitor.encoder + encoder.append(text: "}") + } + + mutating func visitMapField(fieldType: _ProtobufMessageMap.Type, value: _ProtobufMessageMap.BaseType, fieldNumber: Int) throws { + try startField(for: fieldNumber) + encoder.append(text: "{") + var mapVisitor = JSONMapEncodingVisitor(encoder: encoder, options: options) + for (k,v) in value { + try KeyType.visitSingular(value: k, fieldNumber: 1, with: &mapVisitor) + try mapVisitor.visitSingularMessageField(value: v, fieldNumber: 2) + } + encoder = mapVisitor.encoder + encoder.append(text: "}") + } + + /// Helper function that throws an error if the field number could not be + /// resolved. + private mutating func startField(for number: Int) throws { + let name: _NameMap.Name? + + if options.preserveProtoFieldNames { + name = nameMap.names(for: number)?.proto + } else { + name = nameMap.names(for: number)?.json + } + + if let name = name { + encoder.startField(name: name) + } else if let name = extensions?[number]?.protobufExtension.fieldName { + encoder.startExtensionField(name: name) + } else { + throw JSONEncodingError.missingFieldNames + } + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/JSONMapEncodingVisitor.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/JSONMapEncodingVisitor.swift new file mode 100644 index 0000000..319e51d --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/JSONMapEncodingVisitor.swift @@ -0,0 +1,174 @@ +// Sources/SwiftProtobuf/JSONMapEncodingVisitor.swift - JSON map encoding visitor +// +// Copyright (c) 2014 - 2016 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Visitor that writes out the key/value pairs for a JSON map. +/// +// ----------------------------------------------------------------------------- + +import Foundation + +/// Visitor that serializes a message into JSON map format. +/// +/// This expects to alternately visit the keys and values for a JSON +/// map. It only accepts singular values. Keys should be identified +/// as `fieldNumber:1`, values should be identified as `fieldNumber:2` +/// +internal struct JSONMapEncodingVisitor: SelectiveVisitor { + private var separator: StaticString? + internal var encoder: JSONEncoder + private let options: JSONEncodingOptions + + init(encoder: JSONEncoder, options: JSONEncodingOptions) { + self.encoder = encoder + self.options = options + } + + private mutating func startKey() { + if let s = separator { + encoder.append(staticText: s) + } else { + separator = "," + } + } + + private mutating func startValue() { + encoder.append(staticText: ":") + } + + mutating func visitSingularFloatField(value: Float, fieldNumber: Int) throws { + // Doubles/Floats can never be map keys, only values + assert(fieldNumber == 2) + startValue() + encoder.putFloatValue(value: value) + } + + mutating func visitSingularDoubleField(value: Double, fieldNumber: Int) throws { + // Doubles/Floats can never be map keys, only values + assert(fieldNumber == 2) + startValue() + encoder.putDoubleValue(value: value) + } + + mutating func visitSingularInt32Field(value: Int32, fieldNumber: Int) throws { + if fieldNumber == 1 { + startKey() + encoder.putQuotedInt32(value: value) + } else { + startValue() + encoder.putInt32(value: value) + } + } + + mutating func visitSingularInt64Field(value: Int64, fieldNumber: Int) throws { + if fieldNumber == 1 { + startKey() + } else { + startValue() + } + // Int64 fields are always quoted anyway + encoder.putInt64(value: value) + } + + mutating func visitSingularUInt32Field(value: UInt32, fieldNumber: Int) throws { + if fieldNumber == 1 { + startKey() + encoder.putQuotedUInt32(value: value) + } else { + startValue() + encoder.putUInt32(value: value) + } + } + + mutating func visitSingularUInt64Field(value: UInt64, fieldNumber: Int) throws { + if fieldNumber == 1 { + startKey() + } else { + startValue() + } + encoder.putUInt64(value: value) + } + + mutating func visitSingularSInt32Field(value: Int32, fieldNumber: Int) throws { + try visitSingularInt32Field(value: value, fieldNumber: fieldNumber) + } + + mutating func visitSingularSInt64Field(value: Int64, fieldNumber: Int) throws { + try visitSingularInt64Field(value: value, fieldNumber: fieldNumber) + } + + mutating func visitSingularFixed32Field(value: UInt32, fieldNumber: Int) throws { + try visitSingularUInt32Field(value: value, fieldNumber: fieldNumber) + } + + mutating func visitSingularFixed64Field(value: UInt64, fieldNumber: Int) throws { + try visitSingularUInt64Field(value: value, fieldNumber: fieldNumber) + } + + mutating func visitSingularSFixed32Field(value: Int32, fieldNumber: Int) throws { + try visitSingularInt32Field(value: value, fieldNumber: fieldNumber) + } + + mutating func visitSingularSFixed64Field(value: Int64, fieldNumber: Int) throws { + try visitSingularInt64Field(value: value, fieldNumber: fieldNumber) + } + + mutating func visitSingularBoolField(value: Bool, fieldNumber: Int) throws { + if fieldNumber == 1 { + startKey() + encoder.putQuotedBoolValue(value: value) + } else { + startValue() + encoder.putBoolValue(value: value) + } + } + + mutating func visitSingularStringField(value: String, fieldNumber: Int) throws { + if fieldNumber == 1 { + startKey() + } else { + startValue() + } + encoder.putStringValue(value: value) + } + + mutating func visitSingularBytesField(value: Data, fieldNumber: Int) throws { + // Bytes can only be map values, never keys + assert(fieldNumber == 2) + startValue() + encoder.putBytesValue(value: value) + } + + mutating func visitSingularEnumField(value: E, fieldNumber: Int) throws { + // Enums can only be map values, never keys + assert(fieldNumber == 2) + startValue() + if !options.alwaysPrintEnumsAsInts, let n = value.name { + encoder.putStringValue(value: String(describing: n)) + } else { + encoder.putEnumInt(value: value.rawValue) + } + } + + mutating func visitSingularMessageField(value: M, fieldNumber: Int) throws { + // Messages can only be map values, never keys + assert(fieldNumber == 2) + startValue() + let json = try value.jsonString(options: options) + encoder.append(text: json) + } + + // SelectiveVisitor will block: + // - single Groups + // - everything repeated + // - everything packed + // - all maps + // - unknown fields + // - extensions +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/JSONScanner.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/JSONScanner.swift new file mode 100644 index 0000000..ebd0384 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/JSONScanner.swift @@ -0,0 +1,1516 @@ +// Sources/SwiftProtobuf/JSONScanner.swift - JSON format decoding +// +// Copyright (c) 2014 - 2019 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// JSON format decoding engine. +/// +// ----------------------------------------------------------------------------- + +import Foundation + +private let asciiBell = UInt8(7) +private let asciiBackspace = UInt8(8) +private let asciiTab = UInt8(9) +private let asciiNewLine = UInt8(10) +private let asciiVerticalTab = UInt8(11) +private let asciiFormFeed = UInt8(12) +private let asciiCarriageReturn = UInt8(13) +private let asciiZero = UInt8(ascii: "0") +private let asciiOne = UInt8(ascii: "1") +private let asciiSeven = UInt8(ascii: "7") +private let asciiNine = UInt8(ascii: "9") +private let asciiColon = UInt8(ascii: ":") +private let asciiPeriod = UInt8(ascii: ".") +private let asciiPlus = UInt8(ascii: "+") +private let asciiComma = UInt8(ascii: ",") +private let asciiSemicolon = UInt8(ascii: ";") +private let asciiDoubleQuote = UInt8(ascii: "\"") +private let asciiSingleQuote = UInt8(ascii: "\'") +private let asciiBackslash = UInt8(ascii: "\\") +private let asciiForwardSlash = UInt8(ascii: "/") +private let asciiHash = UInt8(ascii: "#") +private let asciiEqualSign = UInt8(ascii: "=") +private let asciiUnderscore = UInt8(ascii: "_") +private let asciiQuestionMark = UInt8(ascii: "?") +private let asciiSpace = UInt8(ascii: " ") +private let asciiOpenSquareBracket = UInt8(ascii: "[") +private let asciiCloseSquareBracket = UInt8(ascii: "]") +private let asciiOpenCurlyBracket = UInt8(ascii: "{") +private let asciiCloseCurlyBracket = UInt8(ascii: "}") +private let asciiOpenAngleBracket = UInt8(ascii: "<") +private let asciiCloseAngleBracket = UInt8(ascii: ">") +private let asciiMinus = UInt8(ascii: "-") +private let asciiLowerA = UInt8(ascii: "a") +private let asciiUpperA = UInt8(ascii: "A") +private let asciiLowerB = UInt8(ascii: "b") +private let asciiLowerE = UInt8(ascii: "e") +private let asciiUpperE = UInt8(ascii: "E") +private let asciiLowerF = UInt8(ascii: "f") +private let asciiUpperI = UInt8(ascii: "I") +private let asciiLowerL = UInt8(ascii: "l") +private let asciiLowerN = UInt8(ascii: "n") +private let asciiUpperN = UInt8(ascii: "N") +private let asciiLowerR = UInt8(ascii: "r") +private let asciiLowerS = UInt8(ascii: "s") +private let asciiLowerT = UInt8(ascii: "t") +private let asciiLowerU = UInt8(ascii: "u") +private let asciiLowerZ = UInt8(ascii: "z") +private let asciiUpperZ = UInt8(ascii: "Z") + +private func fromHexDigit(_ c: UnicodeScalar) -> UInt32? { + let n = c.value + if n >= 48 && n <= 57 { + return UInt32(n - 48) + } + switch n { + case 65, 97: return 10 + case 66, 98: return 11 + case 67, 99: return 12 + case 68, 100: return 13 + case 69, 101: return 14 + case 70, 102: return 15 + default: + return nil + } +} + +// Decode both the RFC 4648 section 4 Base 64 encoding and the RFC +// 4648 section 5 Base 64 variant. The section 5 variant is also +// known as "base64url" or the "URL-safe alphabet". +// Note that both "-" and "+" decode to 62 and "/" and "_" both +// decode as 63. +let base64Values: [Int] = [ +/* 0x00 */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +/* 0x10 */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +/* 0x20 */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, 62, -1, 63, +/* 0x30 */ 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, +/* 0x40 */ -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, +/* 0x50 */ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, 63, +/* 0x60 */ -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, +/* 0x70 */ 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1, +/* 0x80 */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +/* 0x90 */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +/* 0xa0 */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +/* 0xb0 */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +/* 0xc0 */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +/* 0xd0 */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +/* 0xe0 */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +/* 0xf0 */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +] + +/// Returns a `Data` value containing bytes equivalent to the given +/// Base64-encoded string, or nil if the conversion fails. +/// +/// Notes on Google's implementation (Base64Unescape() in strutil.cc): +/// * Google's C++ implementation accepts arbitrary whitespace +/// mixed in with the base-64 characters +/// * Google's C++ implementation ignores missing '=' characters +/// but if present, there must be the exact correct number of them. +/// * The conformance test requires us to accept both standard RFC4648 +/// Base 64 encoding and the "URL and Filename Safe Alphabet" variant. +/// +private func parseBytes( + source: UnsafeRawBufferPointer, + index: inout UnsafeRawBufferPointer.Index, + end: UnsafeRawBufferPointer.Index +) throws -> Data { + let c = source[index] + if c != asciiDoubleQuote { + throw JSONDecodingError.malformedString + } + source.formIndex(after: &index) + + // Count the base-64 digits + // Ignore most unrecognized characters in this first pass, + // stop at the closing double quote. + let digitsStart = index + var rawChars = 0 + var sawSection4Characters = false + var sawSection5Characters = false + while index != end { + var digit = source[index] + if digit == asciiDoubleQuote { + break + } + + if digit == asciiBackslash { + source.formIndex(after: &index) + if index == end { + throw JSONDecodingError.malformedString + } + let escaped = source[index] + switch escaped { + case asciiLowerU: + // TODO: Parse hex escapes such as \u0041. Note that + // such escapes are going to be extremely rare, so + // there's little point in optimizing for them. + throw JSONDecodingError.malformedString + case asciiForwardSlash: + digit = escaped + default: + // Reject \b \f \n \r \t \" or \\ and all illegal escapes + throw JSONDecodingError.malformedString + } + } + + if digit == asciiPlus || digit == asciiForwardSlash { + sawSection4Characters = true + } else if digit == asciiMinus || digit == asciiUnderscore { + sawSection5Characters = true + } + let k = base64Values[Int(digit)] + if k >= 0 { + rawChars += 1 + } + source.formIndex(after: &index) + } + + // We reached the end without seeing the close quote + if index == end { + throw JSONDecodingError.malformedString + } + // Reject mixed encodings. + if sawSection4Characters && sawSection5Characters { + throw JSONDecodingError.malformedString + } + + // Allocate a Data object of exactly the right size + var value = Data(count: rawChars * 3 / 4) + + // Scan the digits again and populate the Data object. + // In this pass, we check for (and fail) if there are + // unexpected characters. But we don't check for end-of-input, + // because the loop above already verified that there was + // a closing double quote. + index = digitsStart + try value.withUnsafeMutableBytes { + (body: UnsafeMutableRawBufferPointer) in + if var p = body.baseAddress, body.count > 0 { + var n = 0 + var chars = 0 // # chars in current group + var padding = 0 // # padding '=' chars + digits: while true { + let digit = source[index] + var k = base64Values[Int(digit)] + if k < 0 { + switch digit { + case asciiDoubleQuote: + break digits + case asciiBackslash: + source.formIndex(after: &index) + let escaped = source[index] + switch escaped { + case asciiForwardSlash: + k = base64Values[Int(escaped)] + default: + // Note: Invalid backslash escapes were caught + // above; we should never get here. + throw JSONDecodingError.malformedString + } + case asciiSpace: + source.formIndex(after: &index) + continue digits + case asciiEqualSign: // Count padding + while true { + switch source[index] { + case asciiDoubleQuote: + break digits + case asciiSpace: + break + case 61: + padding += 1 + default: // Only '=' and whitespace permitted + throw JSONDecodingError.malformedString + } + source.formIndex(after: &index) + } + default: + throw JSONDecodingError.malformedString + } + } + n <<= 6 + n |= k + chars += 1 + if chars == 4 { + p[0] = UInt8(truncatingIfNeeded: n >> 16) + p[1] = UInt8(truncatingIfNeeded: n >> 8) + p[2] = UInt8(truncatingIfNeeded: n) + p += 3 + chars = 0 + n = 0 + } + source.formIndex(after: &index) + } + switch chars { + case 3: + p[0] = UInt8(truncatingIfNeeded: n >> 10) + p[1] = UInt8(truncatingIfNeeded: n >> 2) + if padding == 1 || padding == 0 { + return + } + case 2: + p[0] = UInt8(truncatingIfNeeded: n >> 4) + if padding == 2 || padding == 0 { + return + } + case 0: + if padding == 0 { + return + } + default: + break + } + throw JSONDecodingError.malformedString + } + } + source.formIndex(after: &index) + return value +} + +// JSON encoding allows a variety of \-escapes, including +// escaping UTF-16 code points (which may be surrogate pairs). +private func decodeString(_ s: String) -> String? { + var out = String.UnicodeScalarView() + var chars = s.unicodeScalars.makeIterator() + while let c = chars.next() { + switch c.value { + case UInt32(asciiBackslash): // backslash + if let escaped = chars.next() { + switch escaped.value { + case UInt32(asciiLowerU): // "\u" + // Exactly 4 hex digits: + if let digit1 = chars.next(), + let d1 = fromHexDigit(digit1), + let digit2 = chars.next(), + let d2 = fromHexDigit(digit2), + let digit3 = chars.next(), + let d3 = fromHexDigit(digit3), + let digit4 = chars.next(), + let d4 = fromHexDigit(digit4) { + let codePoint = ((d1 * 16 + d2) * 16 + d3) * 16 + d4 + if let scalar = UnicodeScalar(codePoint) { + out.append(scalar) + } else if codePoint < 0xD800 || codePoint >= 0xE000 { + // Not a valid Unicode scalar. + return nil + } else if codePoint >= 0xDC00 { + // Low surrogate without a preceding high surrogate. + return nil + } else { + // We have a high surrogate (in the range 0xD800..<0xDC00), so + // verify that it is followed by a low surrogate. + guard chars.next() == "\\", chars.next() == "u" else { + // High surrogate was not followed by a Unicode escape sequence. + return nil + } + if let digit1 = chars.next(), + let d1 = fromHexDigit(digit1), + let digit2 = chars.next(), + let d2 = fromHexDigit(digit2), + let digit3 = chars.next(), + let d3 = fromHexDigit(digit3), + let digit4 = chars.next(), + let d4 = fromHexDigit(digit4) { + let follower = ((d1 * 16 + d2) * 16 + d3) * 16 + d4 + guard 0xDC00 <= follower && follower < 0xE000 else { + // High surrogate was not followed by a low surrogate. + return nil + } + let high = codePoint - 0xD800 + let low = follower - 0xDC00 + let composed = 0x10000 | high << 10 | low + guard let composedScalar = UnicodeScalar(composed) else { + // Composed value is not a valid Unicode scalar. + return nil + } + out.append(composedScalar) + } else { + // Malformed \u escape for low surrogate + return nil + } + } + } else { + // Malformed \u escape + return nil + } + case UInt32(asciiLowerB): // \b + out.append("\u{08}") + case UInt32(asciiLowerF): // \f + out.append("\u{0c}") + case UInt32(asciiLowerN): // \n + out.append("\u{0a}") + case UInt32(asciiLowerR): // \r + out.append("\u{0d}") + case UInt32(asciiLowerT): // \t + out.append("\u{09}") + case UInt32(asciiDoubleQuote), UInt32(asciiBackslash), + UInt32(asciiForwardSlash): // " \ / + out.append(escaped) + default: + return nil // Unrecognized escape + } + } else { + return nil // Input ends with backslash + } + default: + out.append(c) + } + } + return String(out) +} + +/// +/// The basic scanner support is entirely private +/// +/// For performance, it works directly against UTF-8 bytes in memory. +/// +internal struct JSONScanner { + private let source: UnsafeRawBufferPointer + private var index: UnsafeRawBufferPointer.Index + private var numberParser = DoubleParser() + internal var options: JSONDecodingOptions + internal var extensions: ExtensionMap + internal var recursionLimit: Int + internal var recursionBudget: Int + + /// True if the scanner has read all of the data from the source, with the + /// exception of any trailing whitespace (which is consumed by reading this + /// property). + internal var complete: Bool { + mutating get { + skipWhitespace() + return !hasMoreContent + } + } + + /// True if the scanner has not yet reached the end of the source. + private var hasMoreContent: Bool { + return index != source.endIndex + } + + /// The byte (UTF-8 code unit) at the scanner's current position. + private var currentByte: UInt8 { + return source[index] + } + + internal init( + source: UnsafeRawBufferPointer, + options: JSONDecodingOptions, + extensions: ExtensionMap? + ) { + self.source = source + self.index = source.startIndex + self.recursionLimit = options.messageDepthLimit + self.recursionBudget = options.messageDepthLimit + self.options = options + self.extensions = extensions ?? SimpleExtensionMap() + } + + private mutating func incrementRecursionDepth() throws { + recursionBudget -= 1 + if recursionBudget < 0 { + throw JSONDecodingError.messageDepthLimit + } + } + + private mutating func decrementRecursionDepth() { + recursionBudget += 1 + // This should never happen, if it does, something is probably corrupting memory, and + // simply throwing doesn't make much sense. + if recursionBudget > recursionLimit { + fatalError("Somehow JSONDecoding unwound more objects than it started") + } + } + + /// Advances the scanner to the next position in the source. + private mutating func advance() { + source.formIndex(after: &index) + } + + /// Skip whitespace + private mutating func skipWhitespace() { + while hasMoreContent { + let u = currentByte + switch u { + case asciiSpace, asciiTab, asciiNewLine, asciiCarriageReturn: + advance() + default: + return + } + } + } + + /// Returns (but does not consume) the next non-whitespace + /// character. This is used by google.protobuf.Value, for + /// example, for custom JSON parsing. + internal mutating func peekOneCharacter() throws -> Character { + skipWhitespace() + guard hasMoreContent else { + throw JSONDecodingError.truncated + } + return Character(UnicodeScalar(UInt32(currentByte))!) + } + + // Parse the leading UInt64 from the provided utf8 bytes. + // + // This is called in three different situations: + // + // * Unquoted number. + // + // * Simple quoted number. If a number is quoted but has no + // backslashes, the caller can use this directly on the UTF8 by + // just verifying the quote marks. This code returns `nil` if it + // sees a backslash, in which case the caller will need to handle ... + // + // * Complex quoted number. In this case, the caller must parse the + // quoted value as a string, then convert the string to utf8 and + // use this to parse the result. This is slow but fortunately + // rare. + // + // In the common case where the number is written in integer form, + // this code does a simple straight conversion. If the number is in + // floating-point format, this uses a slower and less accurate + // approach: it identifies a substring comprising a float, and then + // uses Double() and UInt64() to convert that string to an unsigned + // integer. In particular, it cannot preserve full 64-bit integer + // values when they are written in floating-point format. + // + // If it encounters a "\" backslash character, it returns a nil. This + // is used by callers that are parsing quoted numbers. See nextSInt() + // and nextUInt() below. + private func parseBareUInt64( + source: UnsafeRawBufferPointer, + index: inout UnsafeRawBufferPointer.Index, + end: UnsafeRawBufferPointer.Index + ) throws -> UInt64? { + if index == end { + throw JSONDecodingError.truncated + } + let start = index + let c = source[index] + switch c { + case asciiZero: // 0 + source.formIndex(after: &index) + if index != end { + let after = source[index] + switch after { + case asciiZero...asciiNine: // 0...9 + // leading '0' forbidden unless it is the only digit + throw JSONDecodingError.leadingZero + case asciiPeriod, asciiLowerE, asciiUpperE: // . e + // Slow path: JSON numbers can be written in floating-point notation + index = start + if let d = try parseBareDouble(source: source, + index: &index, + end: end) { + if let u = UInt64(exactly: d) { + return u + } + } + throw JSONDecodingError.malformedNumber + case asciiBackslash: + return nil + default: + return 0 + } + } + return 0 + case asciiOne...asciiNine: // 1...9 + var n = 0 as UInt64 + while index != end { + let digit = source[index] + switch digit { + case asciiZero...asciiNine: // 0...9 + let val = UInt64(digit - asciiZero) + if n > UInt64.max / 10 || n * 10 > UInt64.max - val { + throw JSONDecodingError.numberRange + } + source.formIndex(after: &index) + n = n * 10 + val + case asciiPeriod, asciiLowerE, asciiUpperE: // . e + // Slow path: JSON allows floating-point notation for integers + index = start + if let d = try parseBareDouble(source: source, + index: &index, + end: end) { + if let u = UInt64(exactly: d) { + return u + } + } + throw JSONDecodingError.malformedNumber + case asciiBackslash: + return nil + default: + return n + } + } + return n + case asciiBackslash: + return nil + default: + throw JSONDecodingError.malformedNumber + } + } + + // Parse the leading Int64 from the provided utf8. + // + // This uses parseBareUInt64() to do the heavy lifting; + // we just check for a leading minus and negate the result + // as necessary. + // + // As with parseBareUInt64(), if it encounters a "\" backslash + // character, it returns a nil. This allows callers to use this to + // do a "fast-path" decode of simple quoted numbers by parsing the + // UTF8 directly, only falling back to a full String decode when + // absolutely necessary. + private func parseBareSInt64( + source: UnsafeRawBufferPointer, + index: inout UnsafeRawBufferPointer.Index, + end: UnsafeRawBufferPointer.Index + ) throws -> Int64? { + if index == end { + throw JSONDecodingError.truncated + } + let c = source[index] + if c == asciiMinus { // - + source.formIndex(after: &index) + if index == end { + throw JSONDecodingError.truncated + } + // character after '-' must be digit + let digit = source[index] + if digit < asciiZero || digit > asciiNine { + throw JSONDecodingError.malformedNumber + } + if let n = try parseBareUInt64(source: source, index: &index, end: end) { + let limit: UInt64 = 0x8000000000000000 // -Int64.min + if n >= limit { + if n > limit { + // Too large negative number + throw JSONDecodingError.numberRange + } else { + return Int64.min // Special case for Int64.min + } + } + return -Int64(bitPattern: n) + } else { + return nil + } + } else if let n = try parseBareUInt64(source: source, index: &index, end: end) { + if n > UInt64(bitPattern: Int64.max) { + throw JSONDecodingError.numberRange + } + return Int64(bitPattern: n) + } else { + return nil + } + } + + // Identify a floating-point token in the upcoming UTF8 bytes. + // + // This implements the full grammar defined by the JSON RFC 7159. + // Note that Swift's string-to-number conversions are much more + // lenient, so this is necessary if we want to accurately reject + // malformed JSON numbers. + // + // This is used by nextDouble() and nextFloat() to parse double and + // floating-point values, including values that happen to be in quotes. + // It's also used by the slow path in parseBareSInt64() and parseBareUInt64() + // above to handle integer values that are written in float-point notation. + private func parseBareDouble( + source: UnsafeRawBufferPointer, + index: inout UnsafeRawBufferPointer.Index, + end: UnsafeRawBufferPointer.Index + ) throws -> Double? { + // RFC 7159 defines the grammar for JSON numbers as: + // number = [ minus ] int [ frac ] [ exp ] + if index == end { + throw JSONDecodingError.truncated + } + let start = index + var c = source[index] + if c == asciiBackslash { + return nil + } + + // Optional leading minus sign + if c == asciiMinus { // - + source.formIndex(after: &index) + if index == end { + index = start + throw JSONDecodingError.truncated + } + c = source[index] + if c == asciiBackslash { + return nil + } + } else if c == asciiUpperN { // Maybe NaN? + // Return nil, let the caller deal with it. + return nil + } + + if c == asciiUpperI { // Maybe Infinity, Inf, -Infinity, or -Inf ? + // Return nil, let the caller deal with it. + return nil + } + + // Integer part can be zero or a series of digits not starting with zero + // int = zero / (digit1-9 *DIGIT) + switch c { + case asciiZero: + // First digit can be zero only if not followed by a digit + source.formIndex(after: &index) + if index == end { + return 0.0 + } + c = source[index] + if c == asciiBackslash { + return nil + } + if c >= asciiZero && c <= asciiNine { + throw JSONDecodingError.leadingZero + } + case asciiOne...asciiNine: + while c >= asciiZero && c <= asciiNine { + source.formIndex(after: &index) + if index == end { + if let d = numberParser.utf8ToDouble(bytes: source, start: start, end: index) { + return d + } else { + throw JSONDecodingError.invalidUTF8 + } + } + c = source[index] + if c == asciiBackslash { + return nil + } + } + default: + // Integer part cannot be empty + throw JSONDecodingError.malformedNumber + } + + // frac = decimal-point 1*DIGIT + if c == asciiPeriod { + source.formIndex(after: &index) + if index == end { + // decimal point must have a following digit + throw JSONDecodingError.truncated + } + c = source[index] + switch c { + case asciiZero...asciiNine: // 0...9 + while c >= asciiZero && c <= asciiNine { + source.formIndex(after: &index) + if index == end { + if let d = numberParser.utf8ToDouble(bytes: source, start: start, end: index) { + return d + } else { + throw JSONDecodingError.invalidUTF8 + } + } + c = source[index] + if c == asciiBackslash { + return nil + } + } + case asciiBackslash: + return nil + default: + // decimal point must be followed by at least one digit + throw JSONDecodingError.malformedNumber + } + } + + // exp = e [ minus / plus ] 1*DIGIT + if c == asciiLowerE || c == asciiUpperE { + source.formIndex(after: &index) + if index == end { + // "e" must be followed by +,-, or digit + throw JSONDecodingError.truncated + } + c = source[index] + if c == asciiBackslash { + return nil + } + if c == asciiPlus || c == asciiMinus { // + - + source.formIndex(after: &index) + if index == end { + // must be at least one digit in exponent + throw JSONDecodingError.truncated + } + c = source[index] + if c == asciiBackslash { + return nil + } + } + switch c { + case asciiZero...asciiNine: + while c >= asciiZero && c <= asciiNine { + source.formIndex(after: &index) + if index == end { + if let d = numberParser.utf8ToDouble(bytes: source, start: start, end: index) { + return d + } else { + throw JSONDecodingError.invalidUTF8 + } + } + c = source[index] + if c == asciiBackslash { + return nil + } + } + default: + // must be at least one digit in exponent + throw JSONDecodingError.malformedNumber + } + } + if let d = numberParser.utf8ToDouble(bytes: source, start: start, end: index) { + return d + } else { + throw JSONDecodingError.invalidUTF8 + } + } + + /// Returns a fully-parsed string with all backslash escapes + /// correctly processed, or nil if next token is not a string. + /// + /// Assumes the leading quote has been verified (but not consumed) + private mutating func parseOptionalQuotedString() -> String? { + // Caller has already asserted that currentByte == quote here + var sawBackslash = false + advance() + let start = index + while hasMoreContent { + switch currentByte { + case asciiDoubleQuote: // " + let s = utf8ToString(bytes: source, start: start, end: index) + advance() + if let t = s { + if sawBackslash { + return decodeString(t) + } else { + return t + } + } else { + return nil // Invalid UTF8 + } + case asciiBackslash: // \ + advance() + guard hasMoreContent else { + return nil // Unterminated escape + } + sawBackslash = true + default: + break + } + advance() + } + return nil // Unterminated quoted string + } + + /// Parse an unsigned integer, whether or not its quoted. + /// This also handles cases such as quoted numbers that have + /// backslash escapes in them. + /// + /// This supports the full range of UInt64 (whether quoted or not) + /// unless the number is written in floating-point format. In that + /// case, we decode it with only Double precision. + internal mutating func nextUInt() throws -> UInt64 { + skipWhitespace() + guard hasMoreContent else { + throw JSONDecodingError.truncated + } + let c = currentByte + if c == asciiDoubleQuote { + let start = index + advance() + if let u = try parseBareUInt64(source: source, + index: &index, + end: source.endIndex) { + guard hasMoreContent else { + throw JSONDecodingError.truncated + } + if currentByte != asciiDoubleQuote { + throw JSONDecodingError.malformedNumber + } + advance() + return u + } else { + // Couldn't parse because it had a "\" in the string, + // so parse out the quoted string and then reparse + // the result to get a UInt + index = start + let s = try nextQuotedString() + let raw = s.data(using: String.Encoding.utf8)! + let n = try raw.withUnsafeBytes { + (body: UnsafeRawBufferPointer) -> UInt64? in + if body.count > 0 { + var index = body.startIndex + let end = body.endIndex + if let u = try parseBareUInt64(source: body, + index: &index, + end: end) { + if index == end { + return u + } + } + } + return nil + } + if let n = n { + return n + } + } + } else if let u = try parseBareUInt64(source: source, + index: &index, + end: source.endIndex) { + return u + } + throw JSONDecodingError.malformedNumber + } + + /// Parse a signed integer, quoted or not, including handling + /// backslash escapes for quoted values. + /// + /// This supports the full range of Int64 (whether quoted or not) + /// unless the number is written in floating-point format. In that + /// case, we decode it with only Double precision. + internal mutating func nextSInt() throws -> Int64 { + skipWhitespace() + guard hasMoreContent else { + throw JSONDecodingError.truncated + } + let c = currentByte + if c == asciiDoubleQuote { + let start = index + advance() + if let s = try parseBareSInt64(source: source, + index: &index, + end: source.endIndex) { + guard hasMoreContent else { + throw JSONDecodingError.truncated + } + if currentByte != asciiDoubleQuote { + throw JSONDecodingError.malformedNumber + } + advance() + return s + } else { + // Couldn't parse because it had a "\" in the string, + // so parse out the quoted string and then reparse + // the result as an SInt + index = start + let s = try nextQuotedString() + let raw = s.data(using: String.Encoding.utf8)! + let n = try raw.withUnsafeBytes { + (body: UnsafeRawBufferPointer) -> Int64? in + if body.count > 0 { + var index = body.startIndex + let end = body.endIndex + if let s = try parseBareSInt64(source: body, + index: &index, + end: end) { + if index == end { + return s + } + } + } + return nil + } + if let n = n { + return n + } + } + } else if let s = try parseBareSInt64(source: source, + index: &index, + end: source.endIndex) { + return s + } + throw JSONDecodingError.malformedNumber + } + + /// Parse the next Float value, regardless of whether it + /// is quoted, including handling backslash escapes for + /// quoted strings. + internal mutating func nextFloat() throws -> Float { + skipWhitespace() + guard hasMoreContent else { + throw JSONDecodingError.truncated + } + let c = currentByte + if c == asciiDoubleQuote { // " + let start = index + advance() + if let d = try parseBareDouble(source: source, + index: &index, + end: source.endIndex) { + guard hasMoreContent else { + throw JSONDecodingError.truncated + } + if currentByte != asciiDoubleQuote { + throw JSONDecodingError.malformedNumber + } + advance() + return Float(d) + } else { + // Slow Path: parseBareDouble returned nil: It might be + // a valid float, but had something that + // parseBareDouble cannot directly handle. So we reset, + // try a full string parse, then examine the result: + index = start + let s = try nextQuotedString() + switch s { + case "NaN": return Float.nan + case "Inf": return Float.infinity + case "-Inf": return -Float.infinity + case "Infinity": return Float.infinity + case "-Infinity": return -Float.infinity + default: + let raw = s.data(using: String.Encoding.utf8)! + let n = try raw.withUnsafeBytes { + (body: UnsafeRawBufferPointer) -> Float? in + if body.count > 0 { + var index = body.startIndex + let end = body.endIndex + if let d = try parseBareDouble(source: body, + index: &index, + end: end) { + let f = Float(d) + if index == end && f.isFinite { + return f + } + } + } + return nil + } + if let n = n { + return n + } + } + } + } else { + if let d = try parseBareDouble(source: source, + index: &index, + end: source.endIndex) { + let f = Float(d) + if f.isFinite { + return f + } + } + } + throw JSONDecodingError.malformedNumber + } + + /// Parse the next Double value, regardless of whether it + /// is quoted, including handling backslash escapes for + /// quoted strings. + internal mutating func nextDouble() throws -> Double { + skipWhitespace() + guard hasMoreContent else { + throw JSONDecodingError.truncated + } + let c = currentByte + if c == asciiDoubleQuote { // " + let start = index + advance() + if let d = try parseBareDouble(source: source, + index: &index, + end: source.endIndex) { + guard hasMoreContent else { + throw JSONDecodingError.truncated + } + if currentByte != asciiDoubleQuote { + throw JSONDecodingError.malformedNumber + } + advance() + return d + } else { + // Slow Path: parseBareDouble returned nil: It might be + // a valid float, but had something that + // parseBareDouble cannot directly handle. So we reset, + // try a full string parse, then examine the result: + index = start + let s = try nextQuotedString() + switch s { + case "NaN": return Double.nan + case "Inf": return Double.infinity + case "-Inf": return -Double.infinity + case "Infinity": return Double.infinity + case "-Infinity": return -Double.infinity + default: + let raw = s.data(using: String.Encoding.utf8)! + let n = try raw.withUnsafeBytes { + (body: UnsafeRawBufferPointer) -> Double? in + if body.count > 0 { + var index = body.startIndex + let end = body.endIndex + if let d = try parseBareDouble(source: body, + index: &index, + end: end) { + if index == end { + return d + } + } + } + return nil + } + if let n = n { + return n + } + } + } + } else { + if let d = try parseBareDouble(source: source, + index: &index, + end: source.endIndex) { + return d + } + } + throw JSONDecodingError.malformedNumber + } + + /// Return the contents of the following quoted string, + /// or throw an error if the next token is not a string. + internal mutating func nextQuotedString() throws -> String { + skipWhitespace() + guard hasMoreContent else { + throw JSONDecodingError.truncated + } + let c = currentByte + if c != asciiDoubleQuote { + throw JSONDecodingError.malformedString + } + if let s = parseOptionalQuotedString() { + return s + } else { + throw JSONDecodingError.malformedString + } + } + + /// Return the contents of the following quoted string, + /// or nil if the next token is not a string. + /// This will only throw an error if the next token starts + /// out as a string but is malformed in some way. + internal mutating func nextOptionalQuotedString() throws -> String? { + skipWhitespace() + guard hasMoreContent else { + return nil + } + let c = currentByte + if c != asciiDoubleQuote { + return nil + } + return try nextQuotedString() + } + + /// Return a Data with the decoded contents of the + /// following base-64 string. + /// + /// Notes on Google's implementation: + /// * Google's C++ implementation accepts arbitrary whitespace + /// mixed in with the base-64 characters + /// * Google's C++ implementation ignores missing '=' characters + /// but if present, there must be the exact correct number of them. + /// * Google's C++ implementation accepts both "regular" and + /// "web-safe" base-64 variants (it seems to prefer the + /// web-safe version as defined in RFC 4648 + internal mutating func nextBytesValue() throws -> Data { + skipWhitespace() + guard hasMoreContent else { + throw JSONDecodingError.truncated + } + return try parseBytes(source: source, index: &index, end: source.endIndex) + } + + /// Private function to help parse keywords. + private mutating func skipOptionalKeyword(bytes: [UInt8]) -> Bool { + let start = index + for b in bytes { + guard hasMoreContent else { + index = start + return false + } + let c = currentByte + if c != b { + index = start + return false + } + advance() + } + if hasMoreContent { + let c = currentByte + if (c >= asciiUpperA && c <= asciiUpperZ) || + (c >= asciiLowerA && c <= asciiLowerZ) { + index = start + return false + } + } + return true + } + + /// If the next token is the identifier "null", consume it and return true. + internal mutating func skipOptionalNull() -> Bool { + skipWhitespace() + if hasMoreContent && currentByte == asciiLowerN { + return skipOptionalKeyword(bytes: [ + asciiLowerN, asciiLowerU, asciiLowerL, asciiLowerL + ]) + } + return false + } + + /// Return the following Bool "true" or "false", including + /// full processing of quoted boolean values. (Used in map + /// keys, for instance.) + internal mutating func nextBool() throws -> Bool { + skipWhitespace() + guard hasMoreContent else { + throw JSONDecodingError.truncated + } + let c = currentByte + switch c { + case asciiLowerF: // f + if skipOptionalKeyword(bytes: [ + asciiLowerF, asciiLowerA, asciiLowerL, asciiLowerS, asciiLowerE + ]) { + return false + } + case asciiLowerT: // t + if skipOptionalKeyword(bytes: [ + asciiLowerT, asciiLowerR, asciiLowerU, asciiLowerE + ]) { + return true + } + default: + break + } + throw JSONDecodingError.malformedBool + } + + /// Return the following Bool "true" or "false", including + /// full processing of quoted boolean values. (Used in map + /// keys, for instance.) + internal mutating func nextQuotedBool() throws -> Bool { + skipWhitespace() + guard hasMoreContent else { + throw JSONDecodingError.truncated + } + if currentByte != asciiDoubleQuote { + throw JSONDecodingError.unquotedMapKey + } + if let s = parseOptionalQuotedString() { + switch s { + case "false": return false + case "true": return true + default: break + } + } + throw JSONDecodingError.malformedBool + } + + /// Returns pointer/count spanning the UTF8 bytes of the next regular + /// key or nil if the key contains a backslash (and therefore requires + /// the full string-parsing logic to properly parse). + private mutating func nextOptionalKey() throws -> UnsafeRawBufferPointer? { + skipWhitespace() + let stringStart = index + guard hasMoreContent else { + throw JSONDecodingError.truncated + } + if currentByte != asciiDoubleQuote { + return nil + } + advance() + let nameStart = index + while hasMoreContent && currentByte != asciiDoubleQuote { + if currentByte == asciiBackslash { + index = stringStart // Reset to open quote + return nil + } + advance() + } + guard hasMoreContent else { + throw JSONDecodingError.truncated + } + let buff = UnsafeRawBufferPointer( + start: source.baseAddress! + nameStart, + count: index - nameStart) + advance() + return buff + } + + /// Parse a field name, look it up in the provided field name map, + /// and return the corresponding field number. + /// + /// Throws if field name cannot be parsed. + /// If it encounters an unknown field name, it throws + /// unless `options.ignoreUnknownFields` is set, in which case + /// it silently skips it. + internal mutating func nextFieldNumber( + names: _NameMap, + messageType: Message.Type + ) throws -> Int? { + while true { + var fieldName: String + if let key = try nextOptionalKey() { + // Fast path: We parsed it as UTF8 bytes... + try skipRequiredCharacter(asciiColon) // : + if let fieldNumber = names.number(forJSONName: key) { + return fieldNumber + } + fieldName = utf8ToString(bytes: key.baseAddress!, count: key.count)! + } else { + // Slow path: We parsed a String; lookups from String are slower. + fieldName = try nextQuotedString() + try skipRequiredCharacter(asciiColon) // : + if let fieldNumber = names.number(forJSONName: fieldName) { + return fieldNumber + } + } + if let first = fieldName.first, first == "[", + let last = fieldName.last, last == "]" + { + fieldName.removeFirst() + fieldName.removeLast() + if let fieldNumber = extensions.fieldNumberForProto(messageType: messageType, protoFieldName: fieldName) { + return fieldNumber + } + } + if !options.ignoreUnknownFields { + throw JSONDecodingError.unknownField(fieldName) + } + // Unknown field, skip it and try to parse the next field name + try skipValue() + if skipOptionalObjectEnd() { + return nil + } + try skipRequiredComma() + } + } + + /// Parse the next token as a string or numeric enum value. Throws + /// unrecognizedEnumValue if the string/number can't initialize the + /// enum. Will throw other errors if the JSON is malformed. + internal mutating func nextEnumValue() throws -> E { + skipWhitespace() + guard hasMoreContent else { + throw JSONDecodingError.truncated + } + if currentByte == asciiDoubleQuote { + if let name = try nextOptionalKey() { + if let e = E(rawUTF8: name) { + return e + } else { + throw JSONDecodingError.unrecognizedEnumValue + } + } + let name = try nextQuotedString() + if let e = E(name: name) { + return e + } else { + throw JSONDecodingError.unrecognizedEnumValue + } + } else { + let n = try nextSInt() + if let i = Int(exactly: n) { + if let e = E(rawValue: i) { + return e + } else { + throw JSONDecodingError.unrecognizedEnumValue + } + } else { + throw JSONDecodingError.numberRange + } + } + } + + /// Helper for skipping a single-character token. + private mutating func skipRequiredCharacter(_ required: UInt8) throws { + skipWhitespace() + guard hasMoreContent else { + throw JSONDecodingError.truncated + } + let next = currentByte + if next == required { + advance() + return + } + throw JSONDecodingError.failure + } + + /// Skip "{", throw if that's not the next character + internal mutating func skipRequiredObjectStart() throws { + try skipRequiredCharacter(asciiOpenCurlyBracket) // { + try incrementRecursionDepth() + } + + /// Skip ",", throw if that's not the next character + internal mutating func skipRequiredComma() throws { + try skipRequiredCharacter(asciiComma) + } + + /// Skip ":", throw if that's not the next character + internal mutating func skipRequiredColon() throws { + try skipRequiredCharacter(asciiColon) + } + + /// Skip "[", throw if that's not the next character + internal mutating func skipRequiredArrayStart() throws { + try skipRequiredCharacter(asciiOpenSquareBracket) // [ + } + + /// Helper for skipping optional single-character tokens + private mutating func skipOptionalCharacter(_ c: UInt8) -> Bool { + skipWhitespace() + if hasMoreContent && currentByte == c { + advance() + return true + } + return false + } + + /// If the next non-whitespace character is "]", skip it + /// and return true. Otherwise, return false. + internal mutating func skipOptionalArrayEnd() -> Bool { + return skipOptionalCharacter(asciiCloseSquareBracket) // ] + } + + /// If the next non-whitespace character is "}", skip it + /// and return true. Otherwise, return false. + internal mutating func skipOptionalObjectEnd() -> Bool { + let result = skipOptionalCharacter(asciiCloseCurlyBracket) // } + if result { + decrementRecursionDepth() + } + return result + } + + /// Return the next complete JSON structure as a string. + /// For example, this might return "true", or "123.456", + /// or "{\"foo\": 7, \"bar\": [8, 9]}" + /// + /// Used by Any to get the upcoming JSON value as a string. + /// Note: The value might be an object or array. + internal mutating func skip() throws -> String { + skipWhitespace() + let start = index + try skipValue() + if let s = utf8ToString(bytes: source, start: start, end: index) { + return s + } else { + throw JSONDecodingError.invalidUTF8 + } + } + + /// Advance index past the next value. This is used + /// by skip() and by unknown field handling. + private mutating func skipValue() throws { + skipWhitespace() + guard hasMoreContent else { + throw JSONDecodingError.truncated + } + switch currentByte { + case asciiDoubleQuote: // " begins a string + try skipString() + case asciiOpenCurlyBracket: // { begins an object + try skipObject() + case asciiOpenSquareBracket: // [ begins an array + try skipArray() + case asciiLowerN: // n must be null + if !skipOptionalKeyword(bytes: [ + asciiLowerN, asciiLowerU, asciiLowerL, asciiLowerL + ]) { + throw JSONDecodingError.truncated + } + case asciiLowerF: // f must be false + if !skipOptionalKeyword(bytes: [ + asciiLowerF, asciiLowerA, asciiLowerL, asciiLowerS, asciiLowerE + ]) { + throw JSONDecodingError.truncated + } + case asciiLowerT: // t must be true + if !skipOptionalKeyword(bytes: [ + asciiLowerT, asciiLowerR, asciiLowerU, asciiLowerE + ]) { + throw JSONDecodingError.truncated + } + default: // everything else is a number token + _ = try nextDouble() + } + } + + /// Advance the index past the next complete {...} construct. + private mutating func skipObject() throws { + try skipRequiredObjectStart() + if skipOptionalObjectEnd() { + return + } + while true { + skipWhitespace() + try skipString() + try skipRequiredColon() + try skipValue() + if skipOptionalObjectEnd() { + return + } + try skipRequiredComma() + } + } + + /// Advance the index past the next complete [...] construct. + private mutating func skipArray() throws { + try skipRequiredArrayStart() + if skipOptionalArrayEnd() { + return + } + while true { + try skipValue() + if skipOptionalArrayEnd() { + return + } + try skipRequiredComma() + } + } + + /// Advance the index past the next complete quoted string. + /// + // Caveat: This does not fully validate; it will accept + // strings that have malformed \ escapes. + // + // It would be nice to do better, but I don't think it's critical, + // since there are many reasons that strings (and other tokens for + // that matter) may be skippable but not parseable. For example: + // Old clients that don't know new field types will skip fields + // they don't know; newer clients may reject the same input due to + // schema mismatches or other issues. + private mutating func skipString() throws { + if currentByte != asciiDoubleQuote { + throw JSONDecodingError.malformedString + } + advance() + while hasMoreContent { + let c = currentByte + switch c { + case asciiDoubleQuote: + advance() + return + case asciiBackslash: + advance() + guard hasMoreContent else { + throw JSONDecodingError.truncated + } + advance() + default: + advance() + } + } + throw JSONDecodingError.truncated + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/MathUtils.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/MathUtils.swift new file mode 100644 index 0000000..6ae9b1c --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/MathUtils.swift @@ -0,0 +1,40 @@ +// Sources/SwiftProtobuf/MathUtils.swift - Generally useful mathematical functions +// +// Copyright (c) 2014 - 2017 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Generally useful mathematical and arithmetic functions. +/// +// ----------------------------------------------------------------------------- + +import Foundation + +/// Remainder in standard modular arithmetic (modulo). This coincides with (%) +/// when a > 0. +/// +/// - Parameters: +/// - a: The dividend. Can be positive, 0 or negative. +/// - b: The divisor. This must be positive, and is an error if 0 or negative. +/// - Returns: The unique value r such that 0 <= r < b and b * q + r = a for some q. +internal func mod(_ a: T, _ b: T) -> T { + assert(b > 0) + let r = a % b + return r >= 0 ? r : r + b +} + +/// Quotient in standard modular arithmetic (Euclidean division). This coincides +/// with (/) when a > 0. +/// +/// - Parameters: +/// - a: The dividend. Can be positive, 0 or negative. +/// - b: The divisor. This must be positive, and is an error if 0 or negative. +/// - Returns: The unique value q such that for some 0 <= r < b, b * q + r = a. +internal func div(_ a: T, _ b: T) -> T { + assert(b > 0) + return a >= 0 ? a / b : (a + 1) / b - 1 +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Message+AnyAdditions.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Message+AnyAdditions.swift new file mode 100644 index 0000000..7023d64 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Message+AnyAdditions.swift @@ -0,0 +1,45 @@ +// Sources/SwiftProtobuf/Message+AnyAdditions.swift - Any-related Message extensions +// +// Copyright (c) 2014 - 2017 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Extends the `Message` type with `Google_Protobuf_Any`-specific behavior. +/// +// ----------------------------------------------------------------------------- + +extension Message { + /// Initialize this message from the provided `google.protobuf.Any` + /// well-known type. + /// + /// This corresponds to the `unpack` method in the Google C++ API. + /// + /// If the Any object was decoded from Protobuf Binary or JSON + /// format, then the enclosed field data was stored and is not + /// fully decoded until you unpack the Any object into a message. + /// As such, this method will typically need to perform a full + /// deserialization of the enclosed data and can fail for any + /// reason that deserialization can fail. + /// + /// See `Google_Protobuf_Any.unpackTo()` for more discussion. + /// + /// - Parameter unpackingAny: the message to decode. + /// - Parameter extensions: An `ExtensionMap` used to look up and decode any + /// extensions in this message or messages nested within this message's + /// fields. + /// - Parameter options: The BinaryDecodingOptions to use. + /// - Throws: an instance of `AnyUnpackError`, `JSONDecodingError`, or + /// `BinaryDecodingError` on failure. + public init( + unpackingAny: Google_Protobuf_Any, + extensions: ExtensionMap? = nil, + options: BinaryDecodingOptions = BinaryDecodingOptions() + ) throws { + self.init() + try unpackingAny._storage.unpackTo(target: &self, extensions: extensions, options: options) + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Message+BinaryAdditions.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Message+BinaryAdditions.swift new file mode 100644 index 0000000..7da25e9 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Message+BinaryAdditions.swift @@ -0,0 +1,204 @@ +// Sources/SwiftProtobuf/Message+BinaryAdditions.swift - Per-type binary coding +// +// Copyright (c) 2014 - 2016 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Extensions to `Message` to provide binary coding and decoding. +/// +// ----------------------------------------------------------------------------- + +import Foundation + +/// Binary encoding and decoding methods for messages. +extension Message { + /// Returns a `Data` value containing the Protocol Buffer binary format + /// serialization of the message. + /// + /// - Parameters: + /// - partial: If `false` (the default), this method will check + /// `Message.isInitialized` before encoding to verify that all required + /// fields are present. If any are missing, this method throws + /// `BinaryEncodingError.missingRequiredFields`. + /// - Returns: A `Data` value containing the binary serialization of the + /// message. + /// - Throws: `BinaryEncodingError` if encoding fails. + public func serializedData(partial: Bool = false) throws -> Data { + if !partial && !isInitialized { + throw BinaryEncodingError.missingRequiredFields + } + let requiredSize = try serializedDataSize() + var data = Data(count: requiredSize) + try data.withUnsafeMutableBytes { (body: UnsafeMutableRawBufferPointer) in + if let baseAddress = body.baseAddress, body.count > 0 { + var visitor = BinaryEncodingVisitor(forWritingInto: baseAddress) + try traverse(visitor: &visitor) + // Currently not exposing this from the api because it really would be + // an internal error in the library and should never happen. + assert(requiredSize == visitor.encoder.distance(pointer: baseAddress)) + } + } + return data + } + + /// Returns the size in bytes required to encode the message in binary format. + /// This is used by `serializedData()` to precalculate the size of the buffer + /// so that encoding can proceed without bounds checks or reallocation. + internal func serializedDataSize() throws -> Int { + // Note: since this api is internal, it doesn't currently worry about + // needing a partial argument to handle proto2 syntax required fields. + // If this become public, it will need that added. + var visitor = BinaryEncodingSizeVisitor() + try traverse(visitor: &visitor) + return visitor.serializedSize + } + + /// Creates a new message by decoding the given `Data` value containing a + /// serialized message in Protocol Buffer binary format. + /// + /// - Parameters: + /// - serializedData: The binary-encoded message data to decode. + /// - extensions: An `ExtensionMap` used to look up and decode any + /// extensions in this message or messages nested within this message's + /// fields. + /// - partial: If `false` (the default), this method will check + /// `Message.isInitialized` before encoding to verify that all required + /// fields are present. If any are missing, this method throws + /// `BinaryEncodingError.missingRequiredFields`. + /// - options: The BinaryDecodingOptions to use. + /// - Throws: `BinaryDecodingError` if decoding fails. + @inlinable + public init( + serializedData data: Data, + extensions: ExtensionMap? = nil, + partial: Bool = false, + options: BinaryDecodingOptions = BinaryDecodingOptions() + ) throws { + self.init() +#if swift(>=5.0) + try merge(contiguousBytes: data, extensions: extensions, partial: partial, options: options) +#else + try merge(serializedData: data, extensions: extensions, partial: partial, options: options) +#endif + } + +#if swift(>=5.0) + /// Creates a new message by decoding the given `ContiguousBytes` value + /// containing a serialized message in Protocol Buffer binary format. + /// + /// - Parameters: + /// - contiguousBytes: The binary-encoded message data to decode. + /// - extensions: An `ExtensionMap` used to look up and decode any + /// extensions in this message or messages nested within this message's + /// fields. + /// - partial: If `false` (the default), this method will check + /// `Message.isInitialized` before encoding to verify that all required + /// fields are present. If any are missing, this method throws + /// `BinaryEncodingError.missingRequiredFields`. + /// - options: The BinaryDecodingOptions to use. + /// - Throws: `BinaryDecodingError` if decoding fails. + @inlinable + public init( + contiguousBytes bytes: Bytes, + extensions: ExtensionMap? = nil, + partial: Bool = false, + options: BinaryDecodingOptions = BinaryDecodingOptions() + ) throws { + self.init() + try merge(contiguousBytes: bytes, extensions: extensions, partial: partial, options: options) + } +#endif // #if swift(>=5.0) + + /// Updates the message by decoding the given `Data` value containing a + /// serialized message in Protocol Buffer binary format into the receiver. + /// + /// - Note: If this method throws an error, the message may still have been + /// partially mutated by the binary data that was decoded before the error + /// occurred. + /// + /// - Parameters: + /// - serializedData: The binary-encoded message data to decode. + /// - extensions: An `ExtensionMap` used to look up and decode any + /// extensions in this message or messages nested within this message's + /// fields. + /// - partial: If `false` (the default), this method will check + /// `Message.isInitialized` before encoding to verify that all required + /// fields are present. If any are missing, this method throws + /// `BinaryEncodingError.missingRequiredFields`. + /// - options: The BinaryDecodingOptions to use. + /// - Throws: `BinaryDecodingError` if decoding fails. + @inlinable + public mutating func merge( + serializedData data: Data, + extensions: ExtensionMap? = nil, + partial: Bool = false, + options: BinaryDecodingOptions = BinaryDecodingOptions() + ) throws { +#if swift(>=5.0) + try merge(contiguousBytes: data, extensions: extensions, partial: partial, options: options) +#else + try data.withUnsafeBytes { (body: UnsafeRawBufferPointer) in + try _merge(rawBuffer: body, extensions: extensions, partial: partial, options: options) + } +#endif // swift(>=5.0) + } + +#if swift(>=5.0) + /// Updates the message by decoding the given `ContiguousBytes` value + /// containing a serialized message in Protocol Buffer binary format into the + /// receiver. + /// + /// - Note: If this method throws an error, the message may still have been + /// partially mutated by the binary data that was decoded before the error + /// occurred. + /// + /// - Parameters: + /// - contiguousBytes: The binary-encoded message data to decode. + /// - extensions: An `ExtensionMap` used to look up and decode any + /// extensions in this message or messages nested within this message's + /// fields. + /// - partial: If `false` (the default), this method will check + /// `Message.isInitialized` before encoding to verify that all required + /// fields are present. If any are missing, this method throws + /// `BinaryEncodingError.missingRequiredFields`. + /// - options: The BinaryDecodingOptions to use. + /// - Throws: `BinaryDecodingError` if decoding fails. + @inlinable + public mutating func merge( + contiguousBytes bytes: Bytes, + extensions: ExtensionMap? = nil, + partial: Bool = false, + options: BinaryDecodingOptions = BinaryDecodingOptions() + ) throws { + try bytes.withUnsafeBytes { (body: UnsafeRawBufferPointer) in + try _merge(rawBuffer: body, extensions: extensions, partial: partial, options: options) + } + } +#endif // swift(>=5.0) + + // Helper for `merge()`s to keep the Decoder internal to SwiftProtobuf while + // allowing the generic over ContiguousBytes to get better codegen from the + // compiler by being `@inlinable`. + @usableFromInline + internal mutating func _merge( + rawBuffer body: UnsafeRawBufferPointer, + extensions: ExtensionMap?, + partial: Bool, + options: BinaryDecodingOptions + ) throws { + if let baseAddress = body.baseAddress, body.count > 0 { + var decoder = BinaryDecoder(forReadingFrom: baseAddress, + count: body.count, + options: options, + extensions: extensions) + try decoder.decodeFullMessage(message: &self) + } + if !partial && !isInitialized { + throw BinaryDecodingError.missingRequiredFields + } + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Message+JSONAdditions.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Message+JSONAdditions.swift new file mode 100644 index 0000000..2a25053 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Message+JSONAdditions.swift @@ -0,0 +1,150 @@ +// Sources/SwiftProtobuf/Message+JSONAdditions.swift - JSON format primitive types +// +// Copyright (c) 2014 - 2016 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Extensions to `Message` to support JSON encoding/decoding. +/// +// ----------------------------------------------------------------------------- + +import Foundation + +/// JSON encoding and decoding methods for messages. +extension Message { + /// Returns a string containing the JSON serialization of the message. + /// + /// Unlike binary encoding, presence of required fields is not enforced when + /// serializing to JSON. + /// + /// - Returns: A string containing the JSON serialization of the message. + /// - Parameters: + /// - options: The JSONEncodingOptions to use. + /// - Throws: `JSONEncodingError` if encoding fails. + public func jsonString( + options: JSONEncodingOptions = JSONEncodingOptions() + ) throws -> String { + if let m = self as? _CustomJSONCodable { + return try m.encodedJSONString(options: options) + } + let data = try jsonUTF8Data(options: options) + return String(data: data, encoding: String.Encoding.utf8)! + } + + /// Returns a Data containing the UTF-8 JSON serialization of the message. + /// + /// Unlike binary encoding, presence of required fields is not enforced when + /// serializing to JSON. + /// + /// - Returns: A Data containing the JSON serialization of the message. + /// - Parameters: + /// - options: The JSONEncodingOptions to use. + /// - Throws: `JSONEncodingError` if encoding fails. + public func jsonUTF8Data( + options: JSONEncodingOptions = JSONEncodingOptions() + ) throws -> Data { + if let m = self as? _CustomJSONCodable { + let string = try m.encodedJSONString(options: options) + let data = string.data(using: String.Encoding.utf8)! // Cannot fail! + return data + } + var visitor = try JSONEncodingVisitor(type: Self.self, options: options) + visitor.startObject(message: self) + try traverse(visitor: &visitor) + visitor.endObject() + return visitor.dataResult + } + + /// Creates a new message by decoding the given string containing a + /// serialized message in JSON format. + /// + /// - Parameter jsonString: The JSON-formatted string to decode. + /// - Parameter options: The JSONDecodingOptions to use. + /// - Throws: `JSONDecodingError` if decoding fails. + public init( + jsonString: String, + options: JSONDecodingOptions = JSONDecodingOptions() + ) throws { + try self.init(jsonString: jsonString, extensions: nil, options: options) + } + + /// Creates a new message by decoding the given string containing a + /// serialized message in JSON format. + /// + /// - Parameter jsonString: The JSON-formatted string to decode. + /// - Parameter extensions: An ExtensionMap for looking up extensions by name + /// - Parameter options: The JSONDecodingOptions to use. + /// - Throws: `JSONDecodingError` if decoding fails. + public init( + jsonString: String, + extensions: ExtensionMap? = nil, + options: JSONDecodingOptions = JSONDecodingOptions() + ) throws { + if jsonString.isEmpty { + throw JSONDecodingError.truncated + } + if let data = jsonString.data(using: String.Encoding.utf8) { + try self.init(jsonUTF8Data: data, extensions: extensions, options: options) + } else { + throw JSONDecodingError.truncated + } + } + + /// Creates a new message by decoding the given `Data` containing a + /// serialized message in JSON format, interpreting the data as UTF-8 encoded + /// text. + /// + /// - Parameter jsonUTF8Data: The JSON-formatted data to decode, represented + /// as UTF-8 encoded text. + /// - Parameter options: The JSONDecodingOptions to use. + /// - Throws: `JSONDecodingError` if decoding fails. + public init( + jsonUTF8Data: Data, + options: JSONDecodingOptions = JSONDecodingOptions() + ) throws { + try self.init(jsonUTF8Data: jsonUTF8Data, extensions: nil, options: options) + } + + /// Creates a new message by decoding the given `Data` containing a + /// serialized message in JSON format, interpreting the data as UTF-8 encoded + /// text. + /// + /// - Parameter jsonUTF8Data: The JSON-formatted data to decode, represented + /// as UTF-8 encoded text. + /// - Parameter extensions: The extension map to use with this decode + /// - Parameter options: The JSONDecodingOptions to use. + /// - Throws: `JSONDecodingError` if decoding fails. + public init( + jsonUTF8Data: Data, + extensions: ExtensionMap? = nil, + options: JSONDecodingOptions = JSONDecodingOptions() + ) throws { + self.init() + try jsonUTF8Data.withUnsafeBytes { (body: UnsafeRawBufferPointer) in + // Empty input is valid for binary, but not for JSON. + guard body.count > 0 else { + throw JSONDecodingError.truncated + } + var decoder = JSONDecoder(source: body, options: options, + messageType: Self.self, extensions: extensions) + if decoder.scanner.skipOptionalNull() { + if let customCodable = Self.self as? _CustomJSONCodable.Type, + let message = try customCodable.decodedFromJSONNull() { + self = message as! Self + } else { + throw JSONDecodingError.illegalNull + } + } else { + try decoder.decodeFullObject(message: &self) + } + if !decoder.scanner.complete { + throw JSONDecodingError.trailingGarbage + } + } + } +} + diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Message+JSONArrayAdditions.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Message+JSONArrayAdditions.swift new file mode 100644 index 0000000..2290ed0 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Message+JSONArrayAdditions.swift @@ -0,0 +1,146 @@ +// Sources/SwiftProtobuf/Array+JSONAdditions.swift - JSON format primitive types +// +// Copyright (c) 2014 - 2017 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Extensions to `Array` to support JSON encoding/decoding. +/// +// ----------------------------------------------------------------------------- + +import Foundation + +/// JSON encoding and decoding methods for arrays of messages. +extension Message { + /// Returns a string containing the JSON serialization of the messages. + /// + /// Unlike binary encoding, presence of required fields is not enforced when + /// serializing to JSON. + /// + /// - Returns: A string containing the JSON serialization of the messages. + /// - Parameters: + /// - collection: The list of messages to encode. + /// - options: The JSONEncodingOptions to use. + /// - Throws: `JSONEncodingError` if encoding fails. + public static func jsonString( + from collection: C, + options: JSONEncodingOptions = JSONEncodingOptions() + ) throws -> String where C.Iterator.Element == Self { + let data = try jsonUTF8Data(from: collection, options: options) + return String(data: data, encoding: String.Encoding.utf8)! + } + + /// Returns a Data containing the UTF-8 JSON serialization of the messages. + /// + /// Unlike binary encoding, presence of required fields is not enforced when + /// serializing to JSON. + /// + /// - Returns: A Data containing the JSON serialization of the messages. + /// - Parameters: + /// - collection: The list of messages to encode. + /// - options: The JSONEncodingOptions to use. + /// - Throws: `JSONEncodingError` if encoding fails. + public static func jsonUTF8Data( + from collection: C, + options: JSONEncodingOptions = JSONEncodingOptions() + ) throws -> Data where C.Iterator.Element == Self { + var visitor = try JSONEncodingVisitor(type: Self.self, options: options) + visitor.startArray() + for message in collection { + visitor.startArrayObject(message: message) + try message.traverse(visitor: &visitor) + visitor.endObject() + } + visitor.endArray() + return visitor.dataResult + } + + /// Creates a new array of messages by decoding the given string containing a + /// serialized array of messages in JSON format. + /// + /// - Parameter jsonString: The JSON-formatted string to decode. + /// - Parameter options: The JSONDecodingOptions to use. + /// - Throws: `JSONDecodingError` if decoding fails. + public static func array( + fromJSONString jsonString: String, + options: JSONDecodingOptions = JSONDecodingOptions() + ) throws -> [Self] { + return try self.array(fromJSONString: jsonString, + extensions: SimpleExtensionMap(), + options: options) + } + + /// Creates a new array of messages by decoding the given string containing a + /// serialized array of messages in JSON format. + /// + /// - Parameter jsonString: The JSON-formatted string to decode. + /// - Parameter extensions: The extension map to use with this decode + /// - Parameter options: The JSONDecodingOptions to use. + /// - Throws: `JSONDecodingError` if decoding fails. + public static func array( + fromJSONString jsonString: String, + extensions: ExtensionMap = SimpleExtensionMap(), + options: JSONDecodingOptions = JSONDecodingOptions() + ) throws -> [Self] { + if jsonString.isEmpty { + throw JSONDecodingError.truncated + } + if let data = jsonString.data(using: String.Encoding.utf8) { + return try array(fromJSONUTF8Data: data, extensions: extensions, options: options) + } else { + throw JSONDecodingError.truncated + } + } + + /// Creates a new array of messages by decoding the given `Data` containing a + /// serialized array of messages in JSON format, interpreting the data as + /// UTF-8 encoded text. + /// + /// - Parameter jsonUTF8Data: The JSON-formatted data to decode, represented + /// as UTF-8 encoded text. + /// - Parameter options: The JSONDecodingOptions to use. + /// - Throws: `JSONDecodingError` if decoding fails. + public static func array( + fromJSONUTF8Data jsonUTF8Data: Data, + options: JSONDecodingOptions = JSONDecodingOptions() + ) throws -> [Self] { + return try self.array(fromJSONUTF8Data: jsonUTF8Data, + extensions: SimpleExtensionMap(), + options: options) + } + + /// Creates a new array of messages by decoding the given `Data` containing a + /// serialized array of messages in JSON format, interpreting the data as + /// UTF-8 encoded text. + /// + /// - Parameter jsonUTF8Data: The JSON-formatted data to decode, represented + /// as UTF-8 encoded text. + /// - Parameter extensions: The extension map to use with this decode + /// - Parameter options: The JSONDecodingOptions to use. + /// - Throws: `JSONDecodingError` if decoding fails. + public static func array( + fromJSONUTF8Data jsonUTF8Data: Data, + extensions: ExtensionMap = SimpleExtensionMap(), + options: JSONDecodingOptions = JSONDecodingOptions() + ) throws -> [Self] { + return try jsonUTF8Data.withUnsafeBytes { (body: UnsafeRawBufferPointer) in + var array = [Self]() + + if body.count > 0 { + var decoder = JSONDecoder(source: body, options: options, + messageType: Self.self, extensions: extensions) + try decoder.decodeRepeatedMessageField(value: &array) + if !decoder.scanner.complete { + throw JSONDecodingError.trailingGarbage + } + } + + return array + } + } + +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Message+TextFormatAdditions.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Message+TextFormatAdditions.swift new file mode 100644 index 0000000..6c1abd0 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Message+TextFormatAdditions.swift @@ -0,0 +1,88 @@ +// Sources/SwiftProtobuf/Message+TextFormatAdditions.swift - Text format primitive types +// +// Copyright (c) 2014 - 2016 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Extensions to `Message` to support text format encoding/decoding. +/// +// ----------------------------------------------------------------------------- + +import Foundation + +/// Text format encoding and decoding methods for messages. +extension Message { + /// Returns a string containing the Protocol Buffer text format serialization + /// of the message. + /// + /// Unlike binary encoding, presence of required fields is not enforced when + /// serializing to text format. + /// + /// - Returns: A string containing the text format serialization of the + /// message. + public func textFormatString() -> String { + // This is implemented as a separate zero-argument function + // to preserve binary compatibility. + return textFormatString(options: TextFormatEncodingOptions()) + } + + /// Returns a string containing the Protocol Buffer text format serialization + /// of the message. + /// + /// Unlike binary encoding, presence of required fields is not enforced when + /// serializing to JSON. + /// + /// - Returns: A string containing the text format serialization of the message. + /// - Parameters: + /// - options: The TextFormatEncodingOptions to use. + public func textFormatString( + options: TextFormatEncodingOptions + ) -> String { + var visitor = TextFormatEncodingVisitor(message: self, options: options) + if let any = self as? Google_Protobuf_Any { + any._storage.textTraverse(visitor: &visitor) + } else { + // Although the general traversal/encoding infrastructure supports + // throwing errors (needed for JSON/Binary WKTs support, binary format + // missing required fields); TextEncoding never actually does throw. + try! traverse(visitor: &visitor) + } + return visitor.result + } + + /// Creates a new message by decoding the given string containing a + /// serialized message in Protocol Buffer text format. + /// + /// - Parameters: + /// - textFormatString: The text format string to decode. + /// - extensions: An `ExtensionMap` used to look up and decode any + /// extensions in this message or messages nested within this message's + /// fields. + /// - Throws: an instance of `TextFormatDecodingError` on failure. + public init( + textFormatString: String, + extensions: ExtensionMap? = nil + ) throws { + self.init() + if !textFormatString.isEmpty { + if let data = textFormatString.data(using: String.Encoding.utf8) { + try data.withUnsafeBytes { (body: UnsafeRawBufferPointer) in + if let baseAddress = body.baseAddress, body.count > 0 { + var decoder = try TextFormatDecoder(messageType: Self.self, + utf8Pointer: baseAddress, + count: body.count, + extensions: extensions) + try decodeMessage(decoder: &decoder) + if !decoder.complete { + throw TextFormatDecodingError.trailingGarbage + } + } + } + } + } + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Message.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Message.swift new file mode 100644 index 0000000..b6b9b3b --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Message.swift @@ -0,0 +1,216 @@ +// Sources/SwiftProtobuf/Message.swift - Message support +// +// Copyright (c) 2014 - 2016 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// + +/// The protocol which all generated protobuf messages implement. +/// `Message` is the protocol type you should use whenever +/// you need an argument or variable which holds "some message". +/// +/// Generated messages also implement `Hashable`, and thus `Equatable`. +/// However, the protocol conformance is declared on a different protocol. +/// This allows you to use `Message` as a type directly: +/// +/// func consume(message: Message) { ... } +/// +/// Instead of needing to use it as a type constraint on a generic declaration: +/// +/// func consume(message: M) { ... } +/// +/// If you need to convince the compiler that your message is `Hashable` so +/// you can insert it into a `Set` or use it as a `Dictionary` key, use +/// a generic declaration with a type constraint: +/// +/// func insertIntoSet(message: M) { +/// mySet.insert(message) +/// } +/// +/// The actual functionality is implemented either in the generated code or in +/// default implementations of the below methods and properties. +public protocol Message: CustomDebugStringConvertible { + /// Creates a new message with all of its fields initialized to their default + /// values. + init() + + // Metadata + // Basic facts about this class and the proto message it was generated from + // Used by various encoders and decoders + + /// The fully-scoped name of the message from the original .proto file, + /// including any relevant package name. + static var protoMessageName: String { get } + + /// True if all required fields (if any) on this message and any nested + /// messages (recursively) have values set; otherwise, false. + var isInitialized: Bool { get } + + /// Some formats include enough information to transport fields that were + /// not known at generation time. When encountered, they are stored here. + var unknownFields: UnknownStorage { get set } + + // + // General serialization/deserialization machinery + // + + /// Decode all of the fields from the given decoder. + /// + /// This is a simple loop that repeatedly gets the next field number + /// from `decoder.nextFieldNumber()` and then uses the number returned + /// and the type information from the original .proto file to decide + /// what type of data should be decoded for that field. The corresponding + /// method on the decoder is then called to get the field value. + /// + /// This is the core method used by the deserialization machinery. It is + /// `public` to enable users to implement their own encoding formats by + /// conforming to `Decoder`; it should not be called otherwise. + /// + /// Note that this is not specific to binary encodng; formats that use + /// textual identifiers translate those to field numbers and also go + /// through this to decode messages. + /// + /// - Parameters: + /// - decoder: a `Decoder`; the `Message` will call the method + /// corresponding to the type of this field. + /// - Throws: an error on failure or type mismatch. The type of error + /// thrown depends on which decoder is used. + mutating func decodeMessage(decoder: inout D) throws + + /// Traverses the fields of the message, calling the appropriate methods + /// of the passed `Visitor` object. + /// + /// This is used internally by: + /// + /// * Protobuf binary serialization + /// * JSON serialization (with some twists to account for specialty JSON) + /// * Protobuf Text serialization + /// * `Hashable` computation + /// + /// Conceptually, serializers create visitor objects that are + /// then passed recursively to every message and field via generated + /// `traverse` methods. The details get a little involved due to + /// the need to allow particular messages to override particular + /// behaviors for specific encodings, but the general idea is quite simple. + func traverse(visitor: inout V) throws + + // Standard utility properties and methods. + // Most of these are simple wrappers on top of the visitor machinery. + // They are implemented in the protocol, not in the generated structs, + // so can be overridden in user code by defining custom extensions to + // the generated struct. + +#if swift(>=4.2) + /// An implementation of hash(into:) to provide conformance with the + /// `Hashable` protocol. + func hash(into hasher: inout Hasher) +#else // swift(>=4.2) + /// The hash value generated from this message's contents, for conformance + /// with the `Hashable` protocol. + var hashValue: Int { get } +#endif // swift(>=4.2) + + /// Helper to compare `Message`s when not having a specific type to use + /// normal `Equatable`. `Equatable` is provided with specific generated + /// types. + func isEqualTo(message: Message) -> Bool +} + +extension Message { + /// Generated proto2 messages that contain required fields, nested messages + /// that contain required fields, and/or extensions will provide their own + /// implementation of this property that tests that all required fields are + /// set. Users of the generated code SHOULD NOT override this property. + public var isInitialized: Bool { + // The generated code will include a specialization as needed. + return true + } + + /// A hash based on the message's full contents. +#if swift(>=4.2) + public func hash(into hasher: inout Hasher) { + var visitor = HashVisitor(hasher) + try? traverse(visitor: &visitor) + hasher = visitor.hasher + } +#else // swift(>=4.2) + public var hashValue: Int { + var visitor = HashVisitor() + try? traverse(visitor: &visitor) + return visitor.hashValue + } +#endif // swift(>=4.2) + + /// A description generated by recursively visiting all fields in the message, + /// including messages. + public var debugDescription: String { + // TODO Ideally there would be something like serializeText() that can + // take a prefix so we could do something like: + // [class name]( + // [text format] + // ) + let className = String(reflecting: type(of: self)) + let header = "\(className):\n" + return header + textFormatString() + } + + /// Creates an instance of the message type on which this method is called, + /// executes the given block passing the message in as its sole `inout` + /// argument, and then returns the message. + /// + /// This method acts essentially as a "builder" in that the initialization of + /// the message is captured within the block, allowing the returned value to + /// be set in an immutable variable. For example, + /// + /// let msg = MyMessage.with { $0.myField = "foo" } + /// msg.myOtherField = 5 // error: msg is immutable + /// + /// - Parameter populator: A block or function that populates the new message, + /// which is passed into the block as an `inout` argument. + /// - Returns: The message after execution of the block. + public static func with( + _ populator: (inout Self) throws -> () + ) rethrows -> Self { + var message = Self() + try populator(&message) + return message + } +} + +/// Implementation base for all messages; not intended for client use. +/// +/// In general, use `SwiftProtobuf.Message` instead when you need a variable or +/// argument that can hold any type of message. Occasionally, you can use +/// `SwiftProtobuf.Message & Equatable` or `SwiftProtobuf.Message & Hashable` as +/// generic constraints if you need to write generic code that can be applied to +/// multiple message types that uses equality tests, puts messages in a `Set`, +/// or uses them as `Dictionary` keys. +public protocol _MessageImplementationBase: Message, Hashable { + + // Legacy function; no longer used, but left to maintain source compatibility. + func _protobuf_generated_isEqualTo(other: Self) -> Bool +} + +extension _MessageImplementationBase { + public func isEqualTo(message: Message) -> Bool { + guard let other = message as? Self else { + return false + } + return self == other + } + + // Legacy default implementation that is used by old generated code, current + // versions of the plugin/generator provide this directly, but this is here + // just to avoid breaking source compatibility. + public static func ==(lhs: Self, rhs: Self) -> Bool { + return lhs._protobuf_generated_isEqualTo(other: rhs) + } + + // Legacy function that is generated by old versions of the plugin/generator, + // defaulted to keep things simple without changing the api surface. + public func _protobuf_generated_isEqualTo(other: Self) -> Bool { + return self == other + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/MessageExtension.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/MessageExtension.swift new file mode 100644 index 0000000..42c75da --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/MessageExtension.swift @@ -0,0 +1,41 @@ +// Sources/SwiftProtobuf/MessageExtension.swift - Extension support +// +// Copyright (c) 2014 - 2016 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// A 'Message Extension' is an immutable class object that describes +/// a particular extension field, including string and number +/// identifiers, serialization details, and the identity of the +/// message that is being extended. +/// +// ----------------------------------------------------------------------------- + +/// Type-erased MessageExtension field implementation. +public protocol AnyMessageExtension { + var fieldNumber: Int { get } + var fieldName: String { get } + var messageType: Message.Type { get } + func _protobuf_newField(decoder: inout D) throws -> AnyExtensionField? +} + +/// A "Message Extension" relates a particular extension field to +/// a particular message. The generic constraints allow +/// compile-time compatibility checks. +public class MessageExtension: AnyMessageExtension { + public let fieldNumber: Int + public let fieldName: String + public let messageType: Message.Type + public init(_protobuf_fieldNumber: Int, fieldName: String) { + self.fieldNumber = _protobuf_fieldNumber + self.fieldName = fieldName + self.messageType = MessageType.self + } + public func _protobuf_newField(decoder: inout D) throws -> AnyExtensionField? { + return try FieldType(protobufExtension: self, decoder: &decoder) + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/NameMap.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/NameMap.swift new file mode 100644 index 0000000..1e56757 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/NameMap.swift @@ -0,0 +1,310 @@ +// Sources/SwiftProtobuf/NameMap.swift - Bidirectional number/name mapping +// +// Copyright (c) 2014 - 2016 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- + +/// TODO: Right now, only the NameMap and the NameDescription enum +/// (which are directly used by the generated code) are public. +/// This means that code outside the library has no way to actually +/// use this data. We should develop and publicize a suitable API +/// for that purpose. (Which might be the same as the internal API.) + +/// This must be exactly the same as the corresponding code in the +/// protoc-gen-swift code generator. Changing it will break +/// compatibility of the library with older generated code. +/// +/// It does not necessarily need to match protoc's JSON field naming +/// logic, however. +private func toJsonFieldName(_ s: String) -> String { + var result = String() + var capitalizeNext = false + for c in s { + if c == "_" { + capitalizeNext = true + } else if capitalizeNext { + result.append(String(c).uppercased()) + capitalizeNext = false + } else { + result.append(String(c)) + } + } + return result +} + +/// Allocate static memory buffers to intern UTF-8 +/// string data. Track the buffers and release all of those buffers +/// in case we ever get deallocated. +fileprivate class InternPool { + private var interned = [UnsafeRawBufferPointer]() + + func intern(utf8: String.UTF8View) -> UnsafeRawBufferPointer { + #if swift(>=4.1) + let mutable = UnsafeMutableRawBufferPointer.allocate(byteCount: utf8.count, + alignment: MemoryLayout.alignment) + #else + let mutable = UnsafeMutableRawBufferPointer.allocate(count: utf8.count) + #endif + mutable.copyBytes(from: utf8) + let immutable = UnsafeRawBufferPointer(mutable) + interned.append(immutable) + return immutable + } + + func intern(utf8Ptr: UnsafeBufferPointer) -> UnsafeRawBufferPointer { + #if swift(>=4.1) + let mutable = UnsafeMutableRawBufferPointer.allocate(byteCount: utf8Ptr.count, + alignment: MemoryLayout.alignment) + #else + let mutable = UnsafeMutableRawBufferPointer.allocate(count: utf8.count) + #endif + mutable.copyBytes(from: utf8Ptr) + let immutable = UnsafeRawBufferPointer(mutable) + interned.append(immutable) + return immutable + } + + deinit { + for buff in interned { + #if swift(>=4.1) + buff.deallocate() + #else + let p = UnsafeMutableRawPointer(mutating: buff.baseAddress)! + p.deallocate(bytes: buff.count, alignedTo: 1) + #endif + } + } +} + +#if !swift(>=4.2) +// Constants for FNV hash http://tools.ietf.org/html/draft-eastlake-fnv-03 +private let i_2166136261 = Int(bitPattern: 2166136261) +private let i_16777619 = Int(16777619) +#endif + +/// An immutable bidirectional mapping between field/enum-case names +/// and numbers, used to record field names for text-based +/// serialization (JSON and text). These maps are lazily instantiated +/// for each message as needed, so there is no run-time overhead for +/// users who do not use text-based serialization formats. +public struct _NameMap: ExpressibleByDictionaryLiteral { + + /// An immutable interned string container. The `utf8Start` pointer + /// is guaranteed valid for the lifetime of the `NameMap` that you + /// fetched it from. Since `NameMap`s are only instantiated as + /// immutable static values, that should be the lifetime of the + /// program. + /// + /// Internally, this uses `StaticString` (which refers to a fixed + /// block of UTF-8 data) where possible. In cases where the string + /// has to be computed, it caches the UTF-8 bytes in an + /// unmovable and immutable heap area. + internal struct Name: Hashable, CustomStringConvertible { + // This should not be used outside of this file, as it requires + // coordinating the lifecycle with the lifecycle of the pool + // where the raw UTF8 gets interned. + fileprivate init(staticString: StaticString, pool: InternPool) { + self.nameString = .staticString(staticString) + if staticString.hasPointerRepresentation { + self.utf8Buffer = UnsafeRawBufferPointer(start: staticString.utf8Start, + count: staticString.utf8CodeUnitCount) + } else { + self.utf8Buffer = staticString.withUTF8Buffer { pool.intern(utf8Ptr: $0) } + } + } + + // This should not be used outside of this file, as it requires + // coordinating the lifecycle with the lifecycle of the pool + // where the raw UTF8 gets interned. + fileprivate init(string: String, pool: InternPool) { + let utf8 = string.utf8 + self.utf8Buffer = pool.intern(utf8: utf8) + self.nameString = .string(string) + } + + // This is for building a transient `Name` object sufficient for lookup purposes. + // It MUST NOT be exposed outside of this file. + fileprivate init(transientUtf8Buffer: UnsafeRawBufferPointer) { + self.nameString = .staticString("") + self.utf8Buffer = transientUtf8Buffer + } + + private(set) var utf8Buffer: UnsafeRawBufferPointer + + private enum NameString { + case string(String) + case staticString(StaticString) + } + private var nameString: NameString + + public var description: String { + switch nameString { + case .string(let s): return s + case .staticString(let s): return s.description + } + } + + #if swift(>=4.2) + public func hash(into hasher: inout Hasher) { + for byte in utf8Buffer { + hasher.combine(byte) + } + } + #else // swift(>=4.2) + public var hashValue: Int { + var h = i_2166136261 + for byte in utf8Buffer { + h = (h ^ Int(byte)) &* i_16777619 + } + return h + } + #endif // swift(>=4.2) + + public static func ==(lhs: Name, rhs: Name) -> Bool { + if lhs.utf8Buffer.count != rhs.utf8Buffer.count { + return false + } + return lhs.utf8Buffer.elementsEqual(rhs.utf8Buffer) + } + } + + /// The JSON and proto names for a particular field, enum case, or extension. + internal struct Names { + private(set) var json: Name? + private(set) var proto: Name + } + + /// A description of the names for a particular field or enum case. + /// The different forms here let us minimize the amount of string + /// data that we store in the binary. + /// + /// These are only used in the generated code to initialize a NameMap. + public enum NameDescription { + + /// The proto (text format) name and the JSON name are the same string. + case same(proto: StaticString) + + /// The JSON name can be computed from the proto string + case standard(proto: StaticString) + + /// The JSON and text format names are just different. + case unique(proto: StaticString, json: StaticString) + + /// Used for enum cases only to represent a value's primary proto name (the + /// first defined case) and its aliases. The JSON and text format names for + /// enums are always the same. + case aliased(proto: StaticString, aliases: [StaticString]) + } + + private var internPool = InternPool() + + /// The mapping from field/enum-case numbers to names. + private var numberToNameMap: [Int: Names] = [:] + + /// The mapping from proto/text names to field/enum-case numbers. + private var protoToNumberMap: [Name: Int] = [:] + + /// The mapping from JSON names to field/enum-case numbers. + /// Note that this also contains all of the proto/text names, + /// as required by Google's spec for protobuf JSON. + private var jsonToNumberMap: [Name: Int] = [:] + + /// Creates a new empty field/enum-case name/number mapping. + public init() {} + + /// Build the bidirectional maps between numbers and proto/JSON names. + public init(dictionaryLiteral elements: (Int, NameDescription)...) { + for (number, description) in elements { + switch description { + + case .same(proto: let p): + let protoName = Name(staticString: p, pool: internPool) + let names = Names(json: protoName, proto: protoName) + numberToNameMap[number] = names + protoToNumberMap[protoName] = number + jsonToNumberMap[protoName] = number + + case .standard(proto: let p): + let protoName = Name(staticString: p, pool: internPool) + let jsonString = toJsonFieldName(protoName.description) + let jsonName = Name(string: jsonString, pool: internPool) + let names = Names(json: jsonName, proto: protoName) + numberToNameMap[number] = names + protoToNumberMap[protoName] = number + jsonToNumberMap[protoName] = number + jsonToNumberMap[jsonName] = number + + case .unique(proto: let p, json: let j): + let jsonName = Name(staticString: j, pool: internPool) + let protoName = Name(staticString: p, pool: internPool) + let names = Names(json: jsonName, proto: protoName) + numberToNameMap[number] = names + protoToNumberMap[protoName] = number + jsonToNumberMap[protoName] = number + jsonToNumberMap[jsonName] = number + + case .aliased(proto: let p, aliases: let aliases): + let protoName = Name(staticString: p, pool: internPool) + let names = Names(json: protoName, proto: protoName) + numberToNameMap[number] = names + protoToNumberMap[protoName] = number + jsonToNumberMap[protoName] = number + for alias in aliases { + let protoName = Name(staticString: alias, pool: internPool) + protoToNumberMap[protoName] = number + jsonToNumberMap[protoName] = number + } + } + } + } + + /// Returns the name bundle for the field/enum-case with the given number, or + /// `nil` if there is no match. + internal func names(for number: Int) -> Names? { + return numberToNameMap[number] + } + + /// Returns the field/enum-case number that has the given JSON name, + /// or `nil` if there is no match. + /// + /// This is used by the Text format parser to look up field or enum + /// names using a direct reference to the un-decoded UTF8 bytes. + internal func number(forProtoName raw: UnsafeRawBufferPointer) -> Int? { + let n = Name(transientUtf8Buffer: raw) + return protoToNumberMap[n] + } + + /// Returns the field/enum-case number that has the given JSON name, + /// or `nil` if there is no match. + /// + /// This accepts a regular `String` and is used in JSON parsing + /// only when a field name or enum name was decoded from a string + /// containing backslash escapes. + /// + /// JSON parsing must interpret *both* the JSON name of the + /// field/enum-case provided by the descriptor *as well as* its + /// original proto/text name. + internal func number(forJSONName name: String) -> Int? { + let utf8 = Array(name.utf8) + return utf8.withUnsafeBytes { (buffer: UnsafeRawBufferPointer) in + let n = Name(transientUtf8Buffer: buffer) + return jsonToNumberMap[n] + } + } + + /// Returns the field/enum-case number that has the given JSON name, + /// or `nil` if there is no match. + /// + /// This is used by the JSON parser when a field name or enum name + /// required no special processing. As a result, we can avoid + /// copying the name and look up the number using a direct reference + /// to the un-decoded UTF8 bytes. + internal func number(forJSONName raw: UnsafeRawBufferPointer) -> Int? { + let n = Name(transientUtf8Buffer: raw) + return jsonToNumberMap[n] + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/ProtoNameProviding.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/ProtoNameProviding.swift new file mode 100644 index 0000000..42ed9b4 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/ProtoNameProviding.swift @@ -0,0 +1,23 @@ +// Sources/SwiftProtobuf/ProtoNameProviding.swift - Support for accessing proto names +// +// Copyright (c) 2014 - 2016 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- + + +/// SwiftProtobuf Internal: Common support looking up field names. +/// +/// Messages conform to this protocol to provide the proto/text and JSON field +/// names for their fields. This allows these names to be pulled out into +/// extensions in separate files so that users can omit them in release builds +/// (reducing bloat and minimizing leaks of field names). +public protocol _ProtoNameProviding { + + /// The mapping between field numbers and proto/JSON field names defined in + /// the conforming message type. + static var _protobuf_nameMap: _NameMap { get } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/ProtobufAPIVersionCheck.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/ProtobufAPIVersionCheck.swift new file mode 100644 index 0000000..eed776e --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/ProtobufAPIVersionCheck.swift @@ -0,0 +1,43 @@ +// Sources/SwiftProtobuf/ProtobufAPIVersionCheck.swift - Version checking +// +// Copyright (c) 2014 - 2016 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// A scheme that ensures that generated protos cannot be compiled or linked +/// against a version of the runtime with which they are not compatible. +/// +/// In many cases, API changes themselves might introduce incompatibilities +/// between generated code and the runtime library, but we also want to protect +/// against cases where breaking behavioral changes (without affecting the API) +/// would cause generated code to be incompatible with a particular version of +/// the runtime. +/// +// ----------------------------------------------------------------------------- + + +/// An empty protocol that encodes the version of the runtime library. +/// +/// This protocol will be replaced with one containing a different version +/// number any time that breaking changes are made to the Swift Protobuf API. +/// Combined with the protocol below, this lets us verify that generated code is +/// never compiled against a version of the API with which it is incompatible. +/// +/// The version associated with a particular build of the compiler is defined as +/// `Version.compatibilityVersion` in `protoc-gen-swift`. That version and this +/// version must match for the generated protos to be compatible, so if you +/// update one, make sure to update it here and in the associated type below. +public protocol ProtobufAPIVersion_2 {} + +/// This protocol is expected to be implemented by a `fileprivate` type in each +/// source file emitted by `protoc-gen-swift`. It effectively creates a binding +/// between the version of the generated code and the version of this library, +/// causing a compile-time error (with reasonable diagnostics) if they are +/// incompatible. +public protocol ProtobufAPIVersionCheck { + associatedtype Version: ProtobufAPIVersion_2 +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/ProtobufMap.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/ProtobufMap.swift new file mode 100644 index 0000000..911ff8b --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/ProtobufMap.swift @@ -0,0 +1,39 @@ +// Sources/SwiftProtobuf/ProtobufMap.swift - Map<> support +// +// Copyright (c) 2014 - 2016 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Generic type representing proto map<> fields. +/// +// ----------------------------------------------------------------------------- + +import Foundation + +/// SwiftProtobuf Internal: Support for Encoding/Decoding. +public struct _ProtobufMap +{ + public typealias Key = KeyType.BaseType + public typealias Value = ValueType.BaseType + public typealias BaseType = Dictionary +} + +/// SwiftProtobuf Internal: Support for Encoding/Decoding. +public struct _ProtobufMessageMap +{ + public typealias Key = KeyType.BaseType + public typealias Value = ValueType + public typealias BaseType = Dictionary +} + +/// SwiftProtobuf Internal: Support for Encoding/Decoding. +public struct _ProtobufEnumMap +{ + public typealias Key = KeyType.BaseType + public typealias Value = ValueType + public typealias BaseType = Dictionary +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/SelectiveVisitor.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/SelectiveVisitor.swift new file mode 100644 index 0000000..f6fc5d7 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/SelectiveVisitor.swift @@ -0,0 +1,268 @@ +// Sources/SwiftProtobuf/SelectiveVisitor.swift - Base for custom Visitors +// +// Copyright (c) 2014 - 2017 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// A base for Visitors that only expect a subset of things to called. +/// +// ----------------------------------------------------------------------------- + +import Foundation + +/// A base for Visitors that only expects a subset of things to called. +internal protocol SelectiveVisitor: Visitor { + // Adds nothing. +} + +/// Default impls for everything so things using this only have to write the +/// methods they expect. Asserts to catch developer errors, but becomes +/// nothing in release to keep code size small. +/// +/// NOTE: This is an impl for *everything*. This means the default impls +/// provided by Visitor to bridge packed->repeated, repeated->singular, etc +/// won't kick in. +extension SelectiveVisitor { + internal mutating func visitSingularFloatField(value: Float, fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitSingularDoubleField(value: Double, fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitSingularInt32Field(value: Int32, fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitSingularInt64Field(value: Int64, fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitSingularUInt32Field(value: UInt32, fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitSingularUInt64Field(value: UInt64, fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitSingularSInt32Field(value: Int32, fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitSingularSInt64Field(value: Int64, fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitSingularFixed32Field(value: UInt32, fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitSingularFixed64Field(value: UInt64, fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitSingularSFixed32Field(value: Int32, fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitSingularSFixed64Field(value: Int64, fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitSingularBoolField(value: Bool, fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitSingularStringField(value: String, fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitSingularBytesField(value: Data, fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitSingularEnumField(value: E, fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitSingularMessageField(value: M, fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitSingularGroupField(value: G, fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitRepeatedFloatField(value: [Float], fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitRepeatedDoubleField(value: [Double], fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitRepeatedInt32Field(value: [Int32], fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitRepeatedInt64Field(value: [Int64], fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitRepeatedUInt32Field(value: [UInt32], fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitRepeatedUInt64Field(value: [UInt64], fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitRepeatedSInt32Field(value: [Int32], fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitRepeatedSInt64Field(value: [Int64], fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitRepeatedFixed32Field(value: [UInt32], fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitRepeatedFixed64Field(value: [UInt64], fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitRepeatedSFixed32Field(value: [Int32], fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitRepeatedSFixed64Field(value: [Int64], fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitRepeatedBoolField(value: [Bool], fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitRepeatedStringField(value: [String], fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitRepeatedBytesField(value: [Data], fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitRepeatedEnumField(value: [E], fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitRepeatedMessageField(value: [M], fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitRepeatedGroupField(value: [G], fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitPackedFloatField(value: [Float], fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitPackedDoubleField(value: [Double], fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitPackedInt32Field(value: [Int32], fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitPackedInt64Field(value: [Int64], fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitPackedUInt32Field(value: [UInt32], fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitPackedUInt64Field(value: [UInt64], fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitPackedSInt32Field(value: [Int32], fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitPackedSInt64Field(value: [Int64], fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitPackedFixed32Field(value: [UInt32], fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitPackedFixed64Field(value: [UInt64], fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitPackedSFixed32Field(value: [Int32], fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitPackedSFixed64Field(value: [Int64], fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitPackedBoolField(value: [Bool], fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitPackedEnumField(value: [E], fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitMapField( + fieldType: _ProtobufMap.Type, + value: _ProtobufMap.BaseType, + fieldNumber: Int) throws { + assert(false) + } + + internal mutating func visitMapField( + fieldType: _ProtobufEnumMap.Type, + value: _ProtobufEnumMap.BaseType, + fieldNumber: Int + ) throws where ValueType.RawValue == Int { + assert(false) + } + + internal mutating func visitMapField( + fieldType: _ProtobufMessageMap.Type, + value: _ProtobufMessageMap.BaseType, + fieldNumber: Int + ) throws { + assert(false) + } + + internal mutating func visitExtensionFields(fields: ExtensionFieldValueSet, start: Int, end: Int) throws { + assert(false) + } + + internal mutating func visitExtensionFieldsAsMessageSet( + fields: ExtensionFieldValueSet, + start: Int, + end: Int + ) throws { + assert(false) + } + + internal mutating func visitUnknown(bytes: Data) throws { + assert(false) + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/SimpleExtensionMap.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/SimpleExtensionMap.swift new file mode 100644 index 0000000..986a8c3 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/SimpleExtensionMap.swift @@ -0,0 +1,112 @@ +// Sources/SwiftProtobuf/SimpleExtensionMap.swift - Extension support +// +// Copyright (c) 2014 - 2016 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// A default implementation of ExtensionMap. +/// +// ----------------------------------------------------------------------------- + + +// Note: The generated code only relies on ExpressibleByArrayLiteral +public struct SimpleExtensionMap: ExtensionMap, ExpressibleByArrayLiteral, CustomDebugStringConvertible { + public typealias Element = AnyMessageExtension + + // Since type objects aren't Hashable, we can't do much better than this... + internal var fields = [Int: Array]() + + public init() {} + + public init(arrayLiteral: Element...) { + insert(contentsOf: arrayLiteral) + } + + public init(_ others: SimpleExtensionMap...) { + for other in others { + formUnion(other) + } + } + + public subscript(messageType: Message.Type, fieldNumber: Int) -> AnyMessageExtension? { + get { + if let l = fields[fieldNumber] { + for e in l { + if messageType == e.messageType { + return e + } + } + } + return nil + } + } + + public func fieldNumberForProto(messageType: Message.Type, protoFieldName: String) -> Int? { + // TODO: Make this faster... + for (_, list) in fields { + for e in list { + if e.fieldName == protoFieldName && e.messageType == messageType { + return e.fieldNumber + } + } + } + return nil + } + + public mutating func insert(_ newValue: Element) { + let fieldNumber = newValue.fieldNumber + if let l = fields[fieldNumber] { + let messageType = newValue.messageType + var newL = l.filter { return $0.messageType != messageType } + newL.append(newValue) + fields[fieldNumber] = newL + } else { + fields[fieldNumber] = [newValue] + } + } + + public mutating func insert(contentsOf: [Element]) { + for e in contentsOf { + insert(e) + } + } + + public mutating func formUnion(_ other: SimpleExtensionMap) { + for (fieldNumber, otherList) in other.fields { + if let list = fields[fieldNumber] { + var newList = list.filter { + for o in otherList { + if $0.messageType == o.messageType { return false } + } + return true + } + newList.append(contentsOf: otherList) + fields[fieldNumber] = newList + } else { + fields[fieldNumber] = otherList + } + } + } + + public func union(_ other: SimpleExtensionMap) -> SimpleExtensionMap { + var out = self + out.formUnion(other) + return out + } + + public var debugDescription: String { + var names = [String]() + for (_, list) in fields { + for e in list { + names.append("\(e.fieldName):(\(e.fieldNumber))") + } + } + let d = names.joined(separator: ",") + return "SimpleExtensionMap(\(d))" + } + +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/StringUtils.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/StringUtils.swift new file mode 100644 index 0000000..3e6fa64 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/StringUtils.swift @@ -0,0 +1,73 @@ +// Sources/SwiftProtobuf/StringUtils.swift - String utility functions +// +// Copyright (c) 2014 - 2016 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Utility functions for converting UTF8 bytes into Strings. +/// These functions must: +/// * Accept any valid UTF8, including a zero byte (which is +/// a valid UTF8 encoding of U+0000) +/// * Return nil for any invalid UTF8 +/// * Be fast (since they're extensively used by all decoders +/// and even some of the encoders) +/// +// ----------------------------------------------------------------------------- + +import Foundation + +// Wrapper that takes a buffer and start/end offsets +internal func utf8ToString( + bytes: UnsafeRawBufferPointer, + start: UnsafeRawBufferPointer.Index, + end: UnsafeRawBufferPointer.Index +) -> String? { + return utf8ToString(bytes: bytes.baseAddress! + start, count: end - start) +} + + +// Swift 4 introduced new faster String facilities +// that seem to work consistently across all platforms. + +// Notes on performance: +// +// The pre-verification here only takes about 10% of +// the time needed for constructing the string. +// Eliminating it would provide only a very minor +// speed improvement. +// +// On macOS, this is only about 25% faster than +// the Foundation initializer used below for Swift 3. +// On Linux, the Foundation initializer is much +// slower than on macOS, so this is a much bigger +// win there. +internal func utf8ToString(bytes: UnsafeRawPointer, count: Int) -> String? { + if count == 0 { + return String() + } + let codeUnits = UnsafeRawBufferPointer(start: bytes, count: count) + let sourceEncoding = Unicode.UTF8.self + + // Verify that the UTF-8 is valid. + var p = sourceEncoding.ForwardParser() + var i = codeUnits.makeIterator() + Loop: + while true { + switch p.parseScalar(from: &i) { + case .valid(_): + break + case .error: + return nil + case .emptyInput: + break Loop + } + } + + // This initializer is fast but does not reject broken + // UTF-8 (which is why we validate the UTF-8 above). + return String(decoding: codeUnits, as: sourceEncoding) + } diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/TextFormatDecoder.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/TextFormatDecoder.swift new file mode 100644 index 0000000..52b0c7e --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/TextFormatDecoder.swift @@ -0,0 +1,713 @@ +// Sources/SwiftProtobuf/TextFormatDecoder.swift - Text format decoding +// +// Copyright (c) 2014 - 2016 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Test format decoding engine. +/// +// ----------------------------------------------------------------------------- + +import Foundation + +/// +/// Provides a higher-level interface to the token stream coming +/// from a TextFormatScanner. In particular, this provides +/// single-token pushback and convenience functions for iterating +/// over complex structures. +/// +internal struct TextFormatDecoder: Decoder { + internal var scanner: TextFormatScanner + private var fieldCount = 0 + private var terminator: UInt8? + private var fieldNameMap: _NameMap? + private var messageType: Message.Type? + + internal var complete: Bool { + mutating get { + return scanner.complete + } + } + + internal init(messageType: Message.Type, utf8Pointer: UnsafeRawPointer, count: Int, extensions: ExtensionMap?) throws { + scanner = TextFormatScanner(utf8Pointer: utf8Pointer, count: count, extensions: extensions) + guard let nameProviding = (messageType as? _ProtoNameProviding.Type) else { + throw TextFormatDecodingError.missingFieldNames + } + fieldNameMap = nameProviding._protobuf_nameMap + self.messageType = messageType + } + + internal init(messageType: Message.Type, scanner: TextFormatScanner, terminator: UInt8?) throws { + self.scanner = scanner + self.terminator = terminator + guard let nameProviding = (messageType as? _ProtoNameProviding.Type) else { + throw TextFormatDecodingError.missingFieldNames + } + fieldNameMap = nameProviding._protobuf_nameMap + self.messageType = messageType + } + + + mutating func handleConflictingOneOf() throws { + throw TextFormatDecodingError.conflictingOneOf + } + + mutating func nextFieldNumber() throws -> Int? { + if let terminator = terminator { + if scanner.skipOptionalObjectEnd(terminator) { + return nil + } + } + if fieldCount > 0 { + scanner.skipOptionalSeparator() + } + if let key = try scanner.nextOptionalExtensionKey() { + // Extension key; look up in the extension registry + if let fieldNumber = scanner.extensions?.fieldNumberForProto(messageType: messageType!, protoFieldName: key) { + fieldCount += 1 + return fieldNumber + } else { + throw TextFormatDecodingError.unknownField + } + } else if let fieldNumber = try scanner.nextFieldNumber(names: fieldNameMap!) { + fieldCount += 1 + return fieldNumber + } else if terminator == nil { + return nil + } else { + throw TextFormatDecodingError.truncated + } + + } + + mutating func decodeSingularFloatField(value: inout Float) throws { + try scanner.skipRequiredColon() + value = try scanner.nextFloat() + } + mutating func decodeSingularFloatField(value: inout Float?) throws { + try scanner.skipRequiredColon() + value = try scanner.nextFloat() + } + mutating func decodeRepeatedFloatField(value: inout [Float]) throws { + try scanner.skipRequiredColon() + if scanner.skipOptionalBeginArray() { + var firstItem = true + while true { + if scanner.skipOptionalEndArray() { + return + } + if firstItem { + firstItem = false + } else { + try scanner.skipRequiredComma() + } + let n = try scanner.nextFloat() + value.append(n) + } + } else { + let n = try scanner.nextFloat() + value.append(n) + } + } + mutating func decodeSingularDoubleField(value: inout Double) throws { + try scanner.skipRequiredColon() + value = try scanner.nextDouble() + } + mutating func decodeSingularDoubleField(value: inout Double?) throws { + try scanner.skipRequiredColon() + value = try scanner.nextDouble() + } + mutating func decodeRepeatedDoubleField(value: inout [Double]) throws { + try scanner.skipRequiredColon() + if scanner.skipOptionalBeginArray() { + var firstItem = true + while true { + if scanner.skipOptionalEndArray() { + return + } + if firstItem { + firstItem = false + } else { + try scanner.skipRequiredComma() + } + let n = try scanner.nextDouble() + value.append(n) + } + } else { + let n = try scanner.nextDouble() + value.append(n) + } + } + mutating func decodeSingularInt32Field(value: inout Int32) throws { + try scanner.skipRequiredColon() + let n = try scanner.nextSInt() + if n > Int64(Int32.max) || n < Int64(Int32.min) { + throw TextFormatDecodingError.malformedNumber + } + value = Int32(truncatingIfNeeded: n) + } + mutating func decodeSingularInt32Field(value: inout Int32?) throws { + try scanner.skipRequiredColon() + let n = try scanner.nextSInt() + if n > Int64(Int32.max) || n < Int64(Int32.min) { + throw TextFormatDecodingError.malformedNumber + } + value = Int32(truncatingIfNeeded: n) + } + mutating func decodeRepeatedInt32Field(value: inout [Int32]) throws { + try scanner.skipRequiredColon() + if scanner.skipOptionalBeginArray() { + var firstItem = true + while true { + if scanner.skipOptionalEndArray() { + return + } + if firstItem { + firstItem = false + } else { + try scanner.skipRequiredComma() + } + let n = try scanner.nextSInt() + if n > Int64(Int32.max) || n < Int64(Int32.min) { + throw TextFormatDecodingError.malformedNumber + } + value.append(Int32(truncatingIfNeeded: n)) + } + } else { + let n = try scanner.nextSInt() + if n > Int64(Int32.max) || n < Int64(Int32.min) { + throw TextFormatDecodingError.malformedNumber + } + value.append(Int32(truncatingIfNeeded: n)) + } + } + mutating func decodeSingularInt64Field(value: inout Int64) throws { + try scanner.skipRequiredColon() + value = try scanner.nextSInt() + } + mutating func decodeSingularInt64Field(value: inout Int64?) throws { + try scanner.skipRequiredColon() + value = try scanner.nextSInt() + } + mutating func decodeRepeatedInt64Field(value: inout [Int64]) throws { + try scanner.skipRequiredColon() + if scanner.skipOptionalBeginArray() { + var firstItem = true + while true { + if scanner.skipOptionalEndArray() { + return + } + if firstItem { + firstItem = false + } else { + try scanner.skipRequiredComma() + } + let n = try scanner.nextSInt() + value.append(n) + } + } else { + let n = try scanner.nextSInt() + value.append(n) + } + } + mutating func decodeSingularUInt32Field(value: inout UInt32) throws { + try scanner.skipRequiredColon() + let n = try scanner.nextUInt() + if n > UInt64(UInt32.max) { + throw TextFormatDecodingError.malformedNumber + } + value = UInt32(truncatingIfNeeded: n) + } + mutating func decodeSingularUInt32Field(value: inout UInt32?) throws { + try scanner.skipRequiredColon() + let n = try scanner.nextUInt() + if n > UInt64(UInt32.max) { + throw TextFormatDecodingError.malformedNumber + } + value = UInt32(truncatingIfNeeded: n) + } + mutating func decodeRepeatedUInt32Field(value: inout [UInt32]) throws { + try scanner.skipRequiredColon() + if scanner.skipOptionalBeginArray() { + var firstItem = true + while true { + if scanner.skipOptionalEndArray() { + return + } + if firstItem { + firstItem = false + } else { + try scanner.skipRequiredComma() + } + let n = try scanner.nextUInt() + if n > UInt64(UInt32.max) { + throw TextFormatDecodingError.malformedNumber + } + value.append(UInt32(truncatingIfNeeded: n)) + } + } else { + let n = try scanner.nextUInt() + if n > UInt64(UInt32.max) { + throw TextFormatDecodingError.malformedNumber + } + value.append(UInt32(truncatingIfNeeded: n)) + } + } + mutating func decodeSingularUInt64Field(value: inout UInt64) throws { + try scanner.skipRequiredColon() + value = try scanner.nextUInt() + } + mutating func decodeSingularUInt64Field(value: inout UInt64?) throws { + try scanner.skipRequiredColon() + value = try scanner.nextUInt() + } + mutating func decodeRepeatedUInt64Field(value: inout [UInt64]) throws { + try scanner.skipRequiredColon() + if scanner.skipOptionalBeginArray() { + var firstItem = true + while true { + if scanner.skipOptionalEndArray() { + return + } + if firstItem { + firstItem = false + } else { + try scanner.skipRequiredComma() + } + let n = try scanner.nextUInt() + value.append(n) + } + } else { + let n = try scanner.nextUInt() + value.append(n) + } + } + mutating func decodeSingularSInt32Field(value: inout Int32) throws { + try decodeSingularInt32Field(value: &value) + } + mutating func decodeSingularSInt32Field(value: inout Int32?) throws { + try decodeSingularInt32Field(value: &value) + } + mutating func decodeRepeatedSInt32Field(value: inout [Int32]) throws { + try decodeRepeatedInt32Field(value: &value) + } + mutating func decodeSingularSInt64Field(value: inout Int64) throws { + try decodeSingularInt64Field(value: &value) + } + mutating func decodeSingularSInt64Field(value: inout Int64?) throws { + try decodeSingularInt64Field(value: &value) + } + mutating func decodeRepeatedSInt64Field(value: inout [Int64]) throws { + try decodeRepeatedInt64Field(value: &value) + } + mutating func decodeSingularFixed32Field(value: inout UInt32) throws { + try decodeSingularUInt32Field(value: &value) + } + mutating func decodeSingularFixed32Field(value: inout UInt32?) throws { + try decodeSingularUInt32Field(value: &value) + } + mutating func decodeRepeatedFixed32Field(value: inout [UInt32]) throws { + try decodeRepeatedUInt32Field(value: &value) + } + mutating func decodeSingularFixed64Field(value: inout UInt64) throws { + try decodeSingularUInt64Field(value: &value) + } + mutating func decodeSingularFixed64Field(value: inout UInt64?) throws { + try decodeSingularUInt64Field(value: &value) + } + mutating func decodeRepeatedFixed64Field(value: inout [UInt64]) throws { + try decodeRepeatedUInt64Field(value: &value) + } + mutating func decodeSingularSFixed32Field(value: inout Int32) throws { + try decodeSingularInt32Field(value: &value) + } + mutating func decodeSingularSFixed32Field(value: inout Int32?) throws { + try decodeSingularInt32Field(value: &value) + } + mutating func decodeRepeatedSFixed32Field(value: inout [Int32]) throws { + try decodeRepeatedInt32Field(value: &value) + } + mutating func decodeSingularSFixed64Field(value: inout Int64) throws { + try decodeSingularInt64Field(value: &value) + } + mutating func decodeSingularSFixed64Field(value: inout Int64?) throws { + try decodeSingularInt64Field(value: &value) + } + mutating func decodeRepeatedSFixed64Field(value: inout [Int64]) throws { + try decodeRepeatedInt64Field(value: &value) + } + mutating func decodeSingularBoolField(value: inout Bool) throws { + try scanner.skipRequiredColon() + value = try scanner.nextBool() + } + mutating func decodeSingularBoolField(value: inout Bool?) throws { + try scanner.skipRequiredColon() + value = try scanner.nextBool() + } + mutating func decodeRepeatedBoolField(value: inout [Bool]) throws { + try scanner.skipRequiredColon() + if scanner.skipOptionalBeginArray() { + var firstItem = true + while true { + if scanner.skipOptionalEndArray() { + return + } + if firstItem { + firstItem = false + } else { + try scanner.skipRequiredComma() + } + let n = try scanner.nextBool() + value.append(n) + } + } else { + let n = try scanner.nextBool() + value.append(n) + } + } + mutating func decodeSingularStringField(value: inout String) throws { + try scanner.skipRequiredColon() + value = try scanner.nextStringValue() + } + mutating func decodeSingularStringField(value: inout String?) throws { + try scanner.skipRequiredColon() + value = try scanner.nextStringValue() + } + mutating func decodeRepeatedStringField(value: inout [String]) throws { + try scanner.skipRequiredColon() + if scanner.skipOptionalBeginArray() { + var firstItem = true + while true { + if scanner.skipOptionalEndArray() { + return + } + if firstItem { + firstItem = false + } else { + try scanner.skipRequiredComma() + } + let n = try scanner.nextStringValue() + value.append(n) + } + } else { + let n = try scanner.nextStringValue() + value.append(n) + } + } + mutating func decodeSingularBytesField(value: inout Data) throws { + try scanner.skipRequiredColon() + value = try scanner.nextBytesValue() + } + mutating func decodeSingularBytesField(value: inout Data?) throws { + try scanner.skipRequiredColon() + value = try scanner.nextBytesValue() + } + mutating func decodeRepeatedBytesField(value: inout [Data]) throws { + try scanner.skipRequiredColon() + if scanner.skipOptionalBeginArray() { + var firstItem = true + while true { + if scanner.skipOptionalEndArray() { + return + } + if firstItem { + firstItem = false + } else { + try scanner.skipRequiredComma() + } + let n = try scanner.nextBytesValue() + value.append(n) + } + } else { + let n = try scanner.nextBytesValue() + value.append(n) + } + } + + private mutating func decodeEnum() throws -> E where E.RawValue == Int { + if let name = try scanner.nextOptionalEnumName() { + if let b = E(rawUTF8: name) { + return b + } else { + throw TextFormatDecodingError.unrecognizedEnumValue + } + } + let number = try scanner.nextSInt() + if number >= Int64(Int32.min) && number <= Int64(Int32.max) { + let n = Int32(truncatingIfNeeded: number) + if let e = E(rawValue: Int(n)) { + return e + } else { + throw TextFormatDecodingError.unrecognizedEnumValue + } + } + throw TextFormatDecodingError.malformedText + + } + + mutating func decodeSingularEnumField(value: inout E?) throws where E.RawValue == Int { + try scanner.skipRequiredColon() + let e: E = try decodeEnum() + value = e + } + + mutating func decodeSingularEnumField(value: inout E) throws where E.RawValue == Int { + try scanner.skipRequiredColon() + let e: E = try decodeEnum() + value = e + } + + mutating func decodeRepeatedEnumField(value: inout [E]) throws where E.RawValue == Int { + try scanner.skipRequiredColon() + if scanner.skipOptionalBeginArray() { + var firstItem = true + while true { + if scanner.skipOptionalEndArray() { + return + } + if firstItem { + firstItem = false + } else { + try scanner.skipRequiredComma() + } + let e: E = try decodeEnum() + value.append(e) + } + } else { + let e: E = try decodeEnum() + value.append(e) + } + } + + mutating func decodeSingularMessageField(value: inout M?) throws { + _ = scanner.skipOptionalColon() + if value == nil { + value = M() + } + let terminator = try scanner.skipObjectStart() + var subDecoder = try TextFormatDecoder(messageType: M.self,scanner: scanner, terminator: terminator) + if M.self == Google_Protobuf_Any.self { + var any = value as! Google_Protobuf_Any? + try any!.decodeTextFormat(decoder: &subDecoder) + value = any as! M? + } else { + try value!.decodeMessage(decoder: &subDecoder) + } + scanner = subDecoder.scanner + } + + mutating func decodeRepeatedMessageField(value: inout [M]) throws { + _ = scanner.skipOptionalColon() + if scanner.skipOptionalBeginArray() { + var firstItem = true + while true { + if scanner.skipOptionalEndArray() { + return + } + if firstItem { + firstItem = false + } else { + try scanner.skipRequiredComma() + } + let terminator = try scanner.skipObjectStart() + var subDecoder = try TextFormatDecoder(messageType: M.self,scanner: scanner, terminator: terminator) + if M.self == Google_Protobuf_Any.self { + var message = Google_Protobuf_Any() + try message.decodeTextFormat(decoder: &subDecoder) + value.append(message as! M) + } else { + var message = M() + try message.decodeMessage(decoder: &subDecoder) + value.append(message) + } + scanner = subDecoder.scanner + } + } else { + let terminator = try scanner.skipObjectStart() + var subDecoder = try TextFormatDecoder(messageType: M.self,scanner: scanner, terminator: terminator) + if M.self == Google_Protobuf_Any.self { + var message = Google_Protobuf_Any() + try message.decodeTextFormat(decoder: &subDecoder) + value.append(message as! M) + } else { + var message = M() + try message.decodeMessage(decoder: &subDecoder) + value.append(message) + } + scanner = subDecoder.scanner + } + } + + mutating func decodeSingularGroupField(value: inout G?) throws { + try decodeSingularMessageField(value: &value) + } + + mutating func decodeRepeatedGroupField(value: inout [G]) throws { + try decodeRepeatedMessageField(value: &value) + } + + private mutating func decodeMapEntry(mapType: _ProtobufMap.Type, value: inout _ProtobufMap.BaseType) throws { + var keyField: KeyType.BaseType? + var valueField: ValueType.BaseType? + let terminator = try scanner.skipObjectStart() + while true { + if scanner.skipOptionalObjectEnd(terminator) { + if let keyField = keyField, let valueField = valueField { + value[keyField] = valueField + return + } else { + throw TextFormatDecodingError.malformedText + } + } + if let key = try scanner.nextKey() { + switch key { + case "key", "1": + try KeyType.decodeSingular(value: &keyField, from: &self) + case "value", "2": + try ValueType.decodeSingular(value: &valueField, from: &self) + default: + throw TextFormatDecodingError.unknownField + } + scanner.skipOptionalSeparator() + } + } + } + + mutating func decodeMapField(fieldType: _ProtobufMap.Type, value: inout _ProtobufMap.BaseType) throws { + _ = scanner.skipOptionalColon() + if scanner.skipOptionalBeginArray() { + var firstItem = true + while true { + if scanner.skipOptionalEndArray() { + return + } + if firstItem { + firstItem = false + } else { + try scanner.skipRequiredComma() + } + try decodeMapEntry(mapType: fieldType, value: &value) + } + } else { + try decodeMapEntry(mapType: fieldType, value: &value) + } + } + + private mutating func decodeMapEntry(mapType: _ProtobufEnumMap.Type, value: inout _ProtobufEnumMap.BaseType) throws where ValueType.RawValue == Int { + var keyField: KeyType.BaseType? + var valueField: ValueType? + let terminator = try scanner.skipObjectStart() + while true { + if scanner.skipOptionalObjectEnd(terminator) { + if let keyField = keyField, let valueField = valueField { + value[keyField] = valueField + return + } else { + throw TextFormatDecodingError.malformedText + } + } + if let key = try scanner.nextKey() { + switch key { + case "key", "1": + try KeyType.decodeSingular(value: &keyField, from: &self) + case "value", "2": + try decodeSingularEnumField(value: &valueField) + default: + throw TextFormatDecodingError.unknownField + } + scanner.skipOptionalSeparator() + } + } + } + + mutating func decodeMapField(fieldType: _ProtobufEnumMap.Type, value: inout _ProtobufEnumMap.BaseType) throws where ValueType.RawValue == Int { + _ = scanner.skipOptionalColon() + if scanner.skipOptionalBeginArray() { + var firstItem = true + while true { + if scanner.skipOptionalEndArray() { + return + } + if firstItem { + firstItem = false + } else { + try scanner.skipRequiredComma() + } + try decodeMapEntry(mapType: fieldType, value: &value) + } + } else { + try decodeMapEntry(mapType: fieldType, value: &value) + } + } + + private mutating func decodeMapEntry(mapType: _ProtobufMessageMap.Type, value: inout _ProtobufMessageMap.BaseType) throws { + var keyField: KeyType.BaseType? + var valueField: ValueType? + let terminator = try scanner.skipObjectStart() + while true { + if scanner.skipOptionalObjectEnd(terminator) { + if let keyField = keyField, let valueField = valueField { + value[keyField] = valueField + return + } else { + throw TextFormatDecodingError.malformedText + } + } + if let key = try scanner.nextKey() { + switch key { + case "key", "1": + try KeyType.decodeSingular(value: &keyField, from: &self) + case "value", "2": + try decodeSingularMessageField(value: &valueField) + default: + throw TextFormatDecodingError.unknownField + } + scanner.skipOptionalSeparator() + } + } + } + + mutating func decodeMapField(fieldType: _ProtobufMessageMap.Type, value: inout _ProtobufMessageMap.BaseType) throws { + _ = scanner.skipOptionalColon() + if scanner.skipOptionalBeginArray() { + var firstItem = true + while true { + if scanner.skipOptionalEndArray() { + return + } + if firstItem { + firstItem = false + } else { + try scanner.skipRequiredComma() + } + try decodeMapEntry(mapType: fieldType, value: &value) + } + } else { + try decodeMapEntry(mapType: fieldType, value: &value) + } + } + + mutating func decodeExtensionField(values: inout ExtensionFieldValueSet, messageType: Message.Type, fieldNumber: Int) throws { + if let ext = scanner.extensions?[messageType, fieldNumber] { + var fieldValue = values[fieldNumber] + if fieldValue != nil { + try fieldValue!.decodeExtensionField(decoder: &self) + } else { + fieldValue = try ext._protobuf_newField(decoder: &self) + } + if fieldValue != nil { + values[fieldNumber] = fieldValue + } else { + // Really things should never get here, for TextFormat, decoding + // the value should always work or throw an error. This specific + // error result is to allow this to be more detectable. + throw TextFormatDecodingError.internalExtensionError + } + } + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/TextFormatDecodingError.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/TextFormatDecodingError.swift new file mode 100644 index 0000000..49047b2 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/TextFormatDecodingError.swift @@ -0,0 +1,40 @@ +// Sources/SwiftProtobuf/TextFormatDecodingError.swift - Protobuf text format decoding errors +// +// Copyright (c) 2014 - 2017 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Protobuf text format decoding errors +/// +// ----------------------------------------------------------------------------- + +public enum TextFormatDecodingError: Error { + /// Text data could not be parsed + case malformedText + /// A number could not be parsed + case malformedNumber + /// Extraneous data remained after decoding should have been complete + case trailingGarbage + /// The data stopped before we expected + case truncated + /// A string was not valid UTF8 + case invalidUTF8 + /// The data being parsed does not match the type specified in the proto file + case schemaMismatch + /// Field names were not compiled into the binary + case missingFieldNames + /// A field identifier (name or number) was not found on the message + case unknownField + /// The enum value was not recognized + case unrecognizedEnumValue + /// Text format rejects conflicting values for the same oneof field + case conflictingOneOf + /// An internal error happened while decoding. If this is ever encountered, + /// please file an issue with SwiftProtobuf with as much details as possible + /// for what happened (proto definitions, bytes being decoded (if possible)). + case internalExtensionError +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/TextFormatEncoder.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/TextFormatEncoder.swift new file mode 100644 index 0000000..16846d4 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/TextFormatEncoder.swift @@ -0,0 +1,296 @@ +// Sources/SwiftProtobuf/TextFormatEncoder.swift - Text format encoding support +// +// Copyright (c) 2014 - 2019 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Text format serialization engine. +/// +// ----------------------------------------------------------------------------- + +import Foundation + +private let asciiSpace = UInt8(ascii: " ") +private let asciiColon = UInt8(ascii: ":") +private let asciiComma = UInt8(ascii: ",") +private let asciiMinus = UInt8(ascii: "-") +private let asciiBackslash = UInt8(ascii: "\\") +private let asciiDoubleQuote = UInt8(ascii: "\"") +private let asciiZero = UInt8(ascii: "0") +private let asciiOpenCurlyBracket = UInt8(ascii: "{") +private let asciiCloseCurlyBracket = UInt8(ascii: "}") +private let asciiOpenSquareBracket = UInt8(ascii: "[") +private let asciiCloseSquareBracket = UInt8(ascii: "]") +private let asciiNewline = UInt8(ascii: "\n") +private let asciiUpperA = UInt8(ascii: "A") + +private let tabSize = 2 +private let tab = [UInt8](repeating: asciiSpace, count: tabSize) + +/// TextFormatEncoder has no public members. +internal struct TextFormatEncoder { + private var data = [UInt8]() + private var indentString: [UInt8] = [] + var stringResult: String { + get { + return String(bytes: data, encoding: String.Encoding.utf8)! + } + } + + internal mutating func append(staticText: StaticString) { + let buff = UnsafeBufferPointer(start: staticText.utf8Start, count: staticText.utf8CodeUnitCount) + data.append(contentsOf: buff) + } + + internal mutating func append(name: _NameMap.Name) { + data.append(contentsOf: name.utf8Buffer) + } + + internal mutating func append(bytes: [UInt8]) { + data.append(contentsOf: bytes) + } + + private mutating func append(text: String) { + data.append(contentsOf: text.utf8) + } + + init() {} + + internal mutating func indent() { + data.append(contentsOf: indentString) + } + + mutating func emitFieldName(name: UnsafeRawBufferPointer) { + indent() + data.append(contentsOf: name) + } + + mutating func emitFieldName(name: StaticString) { + let buff = UnsafeRawBufferPointer(start: name.utf8Start, count: name.utf8CodeUnitCount) + emitFieldName(name: buff) + } + + mutating func emitFieldName(name: [UInt8]) { + indent() + data.append(contentsOf: name) + } + + mutating func emitExtensionFieldName(name: String) { + indent() + data.append(asciiOpenSquareBracket) + append(text: name) + data.append(asciiCloseSquareBracket) + } + + mutating func emitFieldNumber(number: Int) { + indent() + appendUInt(value: UInt64(number)) + } + + mutating func startRegularField() { + append(staticText: ": ") + } + mutating func endRegularField() { + data.append(asciiNewline) + } + + // In Text format, a message-valued field writes the name + // without a trailing colon: + // name_of_field {key: value key2: value2} + mutating func startMessageField() { + append(staticText: " {\n") + indentString.append(contentsOf: tab) + } + + mutating func endMessageField() { + indentString.removeLast(tabSize) + indent() + append(staticText: "}\n") + } + + mutating func startArray() { + data.append(asciiOpenSquareBracket) + } + + mutating func arraySeparator() { + append(staticText: ", ") + } + + mutating func endArray() { + data.append(asciiCloseSquareBracket) + } + + mutating func putEnumValue(value: E) { + if let name = value.name { + data.append(contentsOf: name.utf8Buffer) + } else { + appendInt(value: Int64(value.rawValue)) + } + } + + mutating func putFloatValue(value: Float) { + if value.isNaN { + append(staticText: "nan") + } else if !value.isFinite { + if value < 0 { + append(staticText: "-inf") + } else { + append(staticText: "inf") + } + } else { + data.append(contentsOf: value.debugDescription.utf8) + } + } + + mutating func putDoubleValue(value: Double) { + if value.isNaN { + append(staticText: "nan") + } else if !value.isFinite { + if value < 0 { + append(staticText: "-inf") + } else { + append(staticText: "inf") + } + } else { + data.append(contentsOf: value.debugDescription.utf8) + } + } + + private mutating func appendUInt(value: UInt64) { + if value >= 1000 { + appendUInt(value: value / 1000) + } + if value >= 100 { + data.append(asciiZero + UInt8((value / 100) % 10)) + } + if value >= 10 { + data.append(asciiZero + UInt8((value / 10) % 10)) + } + data.append(asciiZero + UInt8(value % 10)) + } + private mutating func appendInt(value: Int64) { + if value < 0 { + data.append(asciiMinus) + // This is the twos-complement negation of value, + // computed in a way that won't overflow a 64-bit + // signed integer. + appendUInt(value: 1 + ~UInt64(bitPattern: value)) + } else { + appendUInt(value: UInt64(bitPattern: value)) + } + } + + mutating func putInt64(value: Int64) { + appendInt(value: value) + } + + mutating func putUInt64(value: UInt64) { + appendUInt(value: value) + } + + mutating func appendUIntHex(value: UInt64, digits: Int) { + if digits == 0 { + append(staticText: "0x") + } else { + appendUIntHex(value: value >> 4, digits: digits - 1) + let d = UInt8(truncatingIfNeeded: value % 16) + data.append(d < 10 ? asciiZero + d : asciiUpperA + d - 10) + } + } + + mutating func putUInt64Hex(value: UInt64, digits: Int) { + appendUIntHex(value: value, digits: digits) + } + + mutating func putBoolValue(value: Bool) { + append(staticText: value ? "true" : "false") + } + + mutating func putStringValue(value: String) { + data.append(asciiDoubleQuote) + for c in value.unicodeScalars { + switch c.value { + // Special two-byte escapes + case 8: + append(staticText: "\\b") + case 9: + append(staticText: "\\t") + case 10: + append(staticText: "\\n") + case 11: + append(staticText: "\\v") + case 12: + append(staticText: "\\f") + case 13: + append(staticText: "\\r") + case 34: + append(staticText: "\\\"") + case 92: + append(staticText: "\\\\") + case 0...31, 127: // Octal form for C0 control chars + data.append(asciiBackslash) + data.append(asciiZero + UInt8(c.value / 64)) + data.append(asciiZero + UInt8(c.value / 8 % 8)) + data.append(asciiZero + UInt8(c.value % 8)) + case 0...127: // ASCII + data.append(UInt8(truncatingIfNeeded: c.value)) + case 0x80...0x7ff: + data.append(0xc0 + UInt8(c.value / 64)) + data.append(0x80 + UInt8(c.value % 64)) + case 0x800...0xffff: + data.append(0xe0 + UInt8(truncatingIfNeeded: c.value >> 12)) + data.append(0x80 + UInt8(truncatingIfNeeded: (c.value >> 6) & 0x3f)) + data.append(0x80 + UInt8(truncatingIfNeeded: c.value & 0x3f)) + default: + data.append(0xf0 + UInt8(truncatingIfNeeded: c.value >> 18)) + data.append(0x80 + UInt8(truncatingIfNeeded: (c.value >> 12) & 0x3f)) + data.append(0x80 + UInt8(truncatingIfNeeded: (c.value >> 6) & 0x3f)) + data.append(0x80 + UInt8(truncatingIfNeeded: c.value & 0x3f)) + } + } + data.append(asciiDoubleQuote) + } + + mutating func putBytesValue(value: Data) { + data.append(asciiDoubleQuote) + value.withUnsafeBytes { (body: UnsafeRawBufferPointer) in + if let p = body.baseAddress, body.count > 0 { + for i in 0.. [UInt8] { + var bytes = [UInt8]() + if let protoName = nameMap?.names(for: fieldNumber)?.proto { + bytes.append(contentsOf: protoName.utf8Buffer) + } else if let protoName = nameResolver[fieldNumber] { + let buff = UnsafeBufferPointer(start: protoName.utf8Start, count: protoName.utf8CodeUnitCount) + bytes.append(contentsOf: buff) + } else if let extensionName = extensions?[fieldNumber]?.protobufExtension.fieldName { + bytes.append(UInt8(ascii: "[")) + bytes.append(contentsOf: extensionName.utf8) + bytes.append(UInt8(ascii: "]")) + } else { + bytes.append(contentsOf: fieldNumber.description.utf8) + } + return bytes + } + + private mutating func emitFieldName(lookingUp fieldNumber: Int) { + if let protoName = nameMap?.names(for: fieldNumber)?.proto { + encoder.emitFieldName(name: protoName.utf8Buffer) + } else if let protoName = nameResolver[fieldNumber] { + encoder.emitFieldName(name: protoName) + } else if let extensionName = extensions?[fieldNumber]?.protobufExtension.fieldName { + encoder.emitExtensionFieldName(name: extensionName) + } else { + encoder.emitFieldNumber(number: fieldNumber) + } + } + + mutating func visitUnknown(bytes: Data) throws { + if options.printUnknownFields { + try bytes.withUnsafeBytes { (body: UnsafeRawBufferPointer) -> () in + if let baseAddress = body.baseAddress, body.count > 0 { + // All fields will be directly handled, so there is no need for + // the unknown field buffering/collection (when scannings to see + // if something is a message, this would be extremely wasteful). + var binaryOptions = BinaryDecodingOptions() + binaryOptions.discardUnknownFields = true + var decoder = BinaryDecoder(forReadingFrom: baseAddress, + count: body.count, + options: binaryOptions) + try visitUnknown(decoder: &decoder) + } + } + } + } + + /// Helper for printing out unknowns. + /// + /// The implementation tries to be "helpful" and if a length delimited field + /// appears to be a submessage, it prints it as such. However, that opens the + /// door to someone sending a message with an unknown field that is a stack + /// bomb, i.e. - it causes this code to recurse, exhausing the stack and + /// thus opening up an attack vector. To keep this "help", but avoid the + /// attack, a limit is placed on how many times it will recurse before just + /// treating the length delimted fields as bytes and not trying to decode + /// them. + private mutating func visitUnknown( + decoder: inout BinaryDecoder, + recursionBudget: Int = 10 + ) throws { + // This stack serves to avoid recursion for groups within groups within + // groups..., this avoid the stack attack that the message detection + // hits. No limit is placed on this because there is no stack risk with + // recursion, and because if a limit was hit, there is no other way to + // encode the group (the message field can just print as length + // delimited, groups don't have an option like that). + var groupFieldNumberStack: [Int] = [] + + while let tag = try decoder.getTag() { + switch tag.wireFormat { + case .varint: + encoder.emitFieldNumber(number: tag.fieldNumber) + var value: UInt64 = 0 + encoder.startRegularField() + try decoder.decodeSingularUInt64Field(value: &value) + encoder.putUInt64(value: value) + encoder.endRegularField() + case .fixed64: + encoder.emitFieldNumber(number: tag.fieldNumber) + var value: UInt64 = 0 + encoder.startRegularField() + try decoder.decodeSingularFixed64Field(value: &value) + encoder.putUInt64Hex(value: value, digits: 16) + encoder.endRegularField() + case .lengthDelimited: + encoder.emitFieldNumber(number: tag.fieldNumber) + var bytes = Data() + try decoder.decodeSingularBytesField(value: &bytes) + bytes.withUnsafeBytes { (body: UnsafeRawBufferPointer) -> () in + if let baseAddress = body.baseAddress, body.count > 0 { + var encodeAsBytes: Bool + if (recursionBudget > 0) { + do { + // Walk all the fields to test if it looks like a message + var testDecoder = BinaryDecoder(forReadingFrom: baseAddress, + count: body.count, + parent: decoder) + while let _ = try testDecoder.nextFieldNumber() { + } + // No error? Output the message body. + encodeAsBytes = false + var subDecoder = BinaryDecoder(forReadingFrom: baseAddress, + count: bytes.count, + parent: decoder) + encoder.startMessageField() + try visitUnknown(decoder: &subDecoder, + recursionBudget: recursionBudget - 1) + encoder.endMessageField() + } catch { + encodeAsBytes = true + } + } else { + encodeAsBytes = true + } + if (encodeAsBytes) { + encoder.startRegularField() + encoder.putBytesValue(value: bytes) + encoder.endRegularField() + } + } + } + case .startGroup: + encoder.emitFieldNumber(number: tag.fieldNumber) + encoder.startMessageField() + groupFieldNumberStack.append(tag.fieldNumber) + case .endGroup: + let groupFieldNumber = groupFieldNumberStack.popLast() + // Unknown data is scanned and verified by the + // binary parser, so this can never fail. + assert(tag.fieldNumber == groupFieldNumber) + encoder.endMessageField() + case .fixed32: + encoder.emitFieldNumber(number: tag.fieldNumber) + var value: UInt32 = 0 + encoder.startRegularField() + try decoder.decodeSingularFixed32Field(value: &value) + encoder.putUInt64Hex(value: UInt64(value), digits: 8) + encoder.endRegularField() + } + } + + // Unknown data is scanned and verified by the binary parser, so this can + // never fail. + assert(groupFieldNumberStack.isEmpty) + } + + // Visitor.swift defines default versions for other singular field types + // that simply widen and dispatch to one of the following. Since Text format + // does not distinguish e.g., Fixed64 vs. UInt64, this is sufficient. + + mutating func visitSingularFloatField(value: Float, fieldNumber: Int) throws { + emitFieldName(lookingUp: fieldNumber) + encoder.startRegularField() + encoder.putFloatValue(value: value) + encoder.endRegularField() + } + + mutating func visitSingularDoubleField(value: Double, fieldNumber: Int) throws { + emitFieldName(lookingUp: fieldNumber) + encoder.startRegularField() + encoder.putDoubleValue(value: value) + encoder.endRegularField() + } + + mutating func visitSingularInt64Field(value: Int64, fieldNumber: Int) throws { + emitFieldName(lookingUp: fieldNumber) + encoder.startRegularField() + encoder.putInt64(value: value) + encoder.endRegularField() + } + + mutating func visitSingularUInt64Field(value: UInt64, fieldNumber: Int) throws { + emitFieldName(lookingUp: fieldNumber) + encoder.startRegularField() + encoder.putUInt64(value: value) + encoder.endRegularField() + } + + mutating func visitSingularBoolField(value: Bool, fieldNumber: Int) throws { + emitFieldName(lookingUp: fieldNumber) + encoder.startRegularField() + encoder.putBoolValue(value: value) + encoder.endRegularField() + } + + mutating func visitSingularStringField(value: String, fieldNumber: Int) throws { + emitFieldName(lookingUp: fieldNumber) + encoder.startRegularField() + encoder.putStringValue(value: value) + encoder.endRegularField() + } + + mutating func visitSingularBytesField(value: Data, fieldNumber: Int) throws { + emitFieldName(lookingUp: fieldNumber) + encoder.startRegularField() + encoder.putBytesValue(value: value) + encoder.endRegularField() + } + + mutating func visitSingularEnumField(value: E, fieldNumber: Int) throws { + emitFieldName(lookingUp: fieldNumber) + encoder.startRegularField() + encoder.putEnumValue(value: value) + encoder.endRegularField() + } + + mutating func visitSingularMessageField(value: M, + fieldNumber: Int) throws { + emitFieldName(lookingUp: fieldNumber) + + // Cache old encoder state + let oldNameMap = self.nameMap + let oldNameResolver = self.nameResolver + let oldExtensions = self.extensions + // Update encoding state for new message + self.nameMap = (M.self as? _ProtoNameProviding.Type)?._protobuf_nameMap + self.nameResolver = [:] + self.extensions = (value as? ExtensibleMessage)?._protobuf_extensionFieldValues + // Restore state before returning + defer { + self.extensions = oldExtensions + self.nameResolver = oldNameResolver + self.nameMap = oldNameMap + } + // Encode submessage + encoder.startMessageField() + if let any = value as? Google_Protobuf_Any { + any.textTraverse(visitor: &self) + } else { + try! value.traverse(visitor: &self) + } + encoder.endMessageField() + } + + // Emit the full "verbose" form of an Any. This writes the typeURL + // as a field name in `[...]` followed by the fields of the + // contained message. + internal mutating func visitAnyVerbose(value: Message, typeURL: String) { + encoder.emitExtensionFieldName(name: typeURL) + encoder.startMessageField() + var visitor = TextFormatEncodingVisitor(message: value, encoder: encoder, options: options) + if let any = value as? Google_Protobuf_Any { + any.textTraverse(visitor: &visitor) + } else { + try! value.traverse(visitor: &visitor) + } + encoder = visitor.encoder + encoder.endMessageField() + } + + // Write a single special field called "#json". This + // is used for Any objects with undecoded JSON contents. + internal mutating func visitAnyJSONDataField(value: Data) { + encoder.indent() + encoder.append(staticText: "#json: ") + encoder.putBytesValue(value: value) + encoder.append(staticText: "\n") + } + + // The default implementations in Visitor.swift provide the correct + // results, but we get significantly better performance by only doing + // the name lookup once for the array, rather than once for each element: + + mutating func visitRepeatedFloatField(value: [Float], fieldNumber: Int) throws { + assert(!value.isEmpty) + let fieldName = formatFieldName(lookingUp: fieldNumber) + for v in value { + encoder.emitFieldName(name: fieldName) + encoder.startRegularField() + encoder.putFloatValue(value: v) + encoder.endRegularField() + } + } + + mutating func visitRepeatedDoubleField(value: [Double], fieldNumber: Int) throws { + assert(!value.isEmpty) + let fieldName = formatFieldName(lookingUp: fieldNumber) + for v in value { + encoder.emitFieldName(name: fieldName) + encoder.startRegularField() + encoder.putDoubleValue(value: v) + encoder.endRegularField() + } + } + + mutating func visitRepeatedInt32Field(value: [Int32], fieldNumber: Int) throws { + assert(!value.isEmpty) + let fieldName = formatFieldName(lookingUp: fieldNumber) + for v in value { + encoder.emitFieldName(name: fieldName) + encoder.startRegularField() + encoder.putInt64(value: Int64(v)) + encoder.endRegularField() + } + } + + mutating func visitRepeatedInt64Field(value: [Int64], fieldNumber: Int) throws { + assert(!value.isEmpty) + let fieldName = formatFieldName(lookingUp: fieldNumber) + for v in value { + encoder.emitFieldName(name: fieldName) + encoder.startRegularField() + encoder.putInt64(value: v) + encoder.endRegularField() + } + } + + mutating func visitRepeatedUInt32Field(value: [UInt32], fieldNumber: Int) throws { + assert(!value.isEmpty) + let fieldName = formatFieldName(lookingUp: fieldNumber) + for v in value { + encoder.emitFieldName(name: fieldName) + encoder.startRegularField() + encoder.putUInt64(value: UInt64(v)) + encoder.endRegularField() + } + } + + mutating func visitRepeatedUInt64Field(value: [UInt64], fieldNumber: Int) throws { + assert(!value.isEmpty) + let fieldName = formatFieldName(lookingUp: fieldNumber) + for v in value { + encoder.emitFieldName(name: fieldName) + encoder.startRegularField() + encoder.putUInt64(value: v) + encoder.endRegularField() + } + } + + mutating func visitRepeatedSInt32Field(value: [Int32], fieldNumber: Int) throws { + try visitRepeatedInt32Field(value: value, fieldNumber: fieldNumber) + } + mutating func visitRepeatedSInt64Field(value: [Int64], fieldNumber: Int) throws { + try visitRepeatedInt64Field(value: value, fieldNumber: fieldNumber) + } + mutating func visitRepeatedFixed32Field(value: [UInt32], fieldNumber: Int) throws { + try visitRepeatedUInt32Field(value: value, fieldNumber: fieldNumber) + } + mutating func visitRepeatedFixed64Field(value: [UInt64], fieldNumber: Int) throws { + try visitRepeatedUInt64Field(value: value, fieldNumber: fieldNumber) + } + mutating func visitRepeatedSFixed32Field(value: [Int32], fieldNumber: Int) throws { + try visitRepeatedInt32Field(value: value, fieldNumber: fieldNumber) + } + mutating func visitRepeatedSFixed64Field(value: [Int64], fieldNumber: Int) throws { + try visitRepeatedInt64Field(value: value, fieldNumber: fieldNumber) + } + + mutating func visitRepeatedBoolField(value: [Bool], fieldNumber: Int) throws { + assert(!value.isEmpty) + let fieldName = formatFieldName(lookingUp: fieldNumber) + for v in value { + encoder.emitFieldName(name: fieldName) + encoder.startRegularField() + encoder.putBoolValue(value: v) + encoder.endRegularField() + } + } + + mutating func visitRepeatedStringField(value: [String], fieldNumber: Int) throws { + assert(!value.isEmpty) + let fieldName = formatFieldName(lookingUp: fieldNumber) + for v in value { + encoder.emitFieldName(name: fieldName) + encoder.startRegularField() + encoder.putStringValue(value: v) + encoder.endRegularField() + } + } + + mutating func visitRepeatedBytesField(value: [Data], fieldNumber: Int) throws { + assert(!value.isEmpty) + let fieldName = formatFieldName(lookingUp: fieldNumber) + for v in value { + encoder.emitFieldName(name: fieldName) + encoder.startRegularField() + encoder.putBytesValue(value: v) + encoder.endRegularField() + } + } + + mutating func visitRepeatedEnumField(value: [E], fieldNumber: Int) throws { + assert(!value.isEmpty) + let fieldName = formatFieldName(lookingUp: fieldNumber) + for v in value { + encoder.emitFieldName(name: fieldName) + encoder.startRegularField() + encoder.putEnumValue(value: v) + encoder.endRegularField() + } + } + + // Messages and groups + mutating func visitRepeatedMessageField(value: [M], + fieldNumber: Int) throws { + assert(!value.isEmpty) + // Look up field name against outer message encoding state + let fieldName = formatFieldName(lookingUp: fieldNumber) + // Cache old encoder state + let oldNameMap = self.nameMap + let oldNameResolver = self.nameResolver + let oldExtensions = self.extensions + // Update encoding state for new message type + self.nameMap = (M.self as? _ProtoNameProviding.Type)?._protobuf_nameMap + self.nameResolver = [:] + self.extensions = (value as? ExtensibleMessage)?._protobuf_extensionFieldValues + // Iterate and encode each message + for v in value { + encoder.emitFieldName(name: fieldName) + encoder.startMessageField() + if let any = v as? Google_Protobuf_Any { + any.textTraverse(visitor: &self) + } else { + try! v.traverse(visitor: &self) + } + encoder.endMessageField() + } + // Restore state + self.extensions = oldExtensions + self.nameResolver = oldNameResolver + self.nameMap = oldNameMap + } + + // Google's C++ implementation of Text format supports two formats + // for repeated numeric fields: "short" format writes the list as a + // single field with values enclosed in `[...]`, "long" format + // writes a separate field name/value for each item. They provide + // an option for callers to select which output version they prefer. + + // Since this distinction mirrors the difference in Protobuf Binary + // between "packed" and "non-packed", I've chosen to use the short + // format for packed fields and the long version for repeated + // fields. This provides a clear visual distinction between these + // fields (including proto3's default use of packed) without + // introducing the baggage of a separate option. + + private mutating func _visitPacked( + value: [T], fieldNumber: Int, + encode: (T, inout TextFormatEncoder) -> () + ) throws { + assert(!value.isEmpty) + emitFieldName(lookingUp: fieldNumber) + encoder.startRegularField() + var firstItem = true + encoder.startArray() + for v in value { + if !firstItem { + encoder.arraySeparator() + } + encode(v, &encoder) + firstItem = false + } + encoder.endArray() + encoder.endRegularField() + } + + mutating func visitPackedFloatField(value: [Float], fieldNumber: Int) throws { + try _visitPacked(value: value, fieldNumber: fieldNumber) { + (v: Float, encoder: inout TextFormatEncoder) in + encoder.putFloatValue(value: v) + } + } + + mutating func visitPackedDoubleField(value: [Double], fieldNumber: Int) throws { + try _visitPacked(value: value, fieldNumber: fieldNumber) { + (v: Double, encoder: inout TextFormatEncoder) in + encoder.putDoubleValue(value: v) + } + } + + mutating func visitPackedInt32Field(value: [Int32], fieldNumber: Int) throws { + try _visitPacked(value: value, fieldNumber: fieldNumber) { + (v: Int32, encoder: inout TextFormatEncoder) in + encoder.putInt64(value: Int64(v)) + } + } + + mutating func visitPackedInt64Field(value: [Int64], fieldNumber: Int) throws { + try _visitPacked(value: value, fieldNumber: fieldNumber) { + (v: Int64, encoder: inout TextFormatEncoder) in + encoder.putInt64(value: v) + } + } + + mutating func visitPackedUInt32Field(value: [UInt32], fieldNumber: Int) throws { + try _visitPacked(value: value, fieldNumber: fieldNumber) { + (v: UInt32, encoder: inout TextFormatEncoder) in + encoder.putUInt64(value: UInt64(v)) + } + } + + mutating func visitPackedUInt64Field(value: [UInt64], fieldNumber: Int) throws { + try _visitPacked(value: value, fieldNumber: fieldNumber) { + (v: UInt64, encoder: inout TextFormatEncoder) in + encoder.putUInt64(value: v) + } + } + + mutating func visitPackedSInt32Field(value: [Int32], fieldNumber: Int) throws { + try visitPackedInt32Field(value: value, fieldNumber: fieldNumber) + } + + mutating func visitPackedSInt64Field(value: [Int64], fieldNumber: Int) throws { + try visitPackedInt64Field(value: value, fieldNumber: fieldNumber) + } + + mutating func visitPackedFixed32Field(value: [UInt32], fieldNumber: Int) throws { + try visitPackedUInt32Field(value: value, fieldNumber: fieldNumber) + } + + mutating func visitPackedFixed64Field(value: [UInt64], fieldNumber: Int) throws { + try visitPackedUInt64Field(value: value, fieldNumber: fieldNumber) + } + + mutating func visitPackedSFixed32Field(value: [Int32], fieldNumber: Int) throws { + try visitPackedInt32Field(value: value, fieldNumber: fieldNumber) + } + + mutating func visitPackedSFixed64Field(value: [Int64], fieldNumber: Int) throws { + try visitPackedInt64Field(value: value, fieldNumber: fieldNumber) + } + + mutating func visitPackedBoolField(value: [Bool], fieldNumber: Int) throws { + try _visitPacked(value: value, fieldNumber: fieldNumber) { + (v: Bool, encoder: inout TextFormatEncoder) in + encoder.putBoolValue(value: v) + } + } + + mutating func visitPackedEnumField(value: [E], fieldNumber: Int) throws { + try _visitPacked(value: value, fieldNumber: fieldNumber) { + (v: E, encoder: inout TextFormatEncoder) in + encoder.putEnumValue(value: v) + } + } + + /// Helper to encapsulate the common structure of iterating over a map + /// and encoding the keys and values. + private mutating func _visitMap( + map: Dictionary, + fieldNumber: Int, + coder: (inout TextFormatEncodingVisitor, K, V) throws -> () + ) throws { + for (k,v) in map { + emitFieldName(lookingUp: fieldNumber) + encoder.startMessageField() + var visitor = TextFormatEncodingVisitor(nameMap: nil, nameResolver: mapNameResolver, extensions: nil, encoder: encoder, options: options) + try coder(&visitor, k, v) + encoder = visitor.encoder + encoder.endMessageField() + } + } + + mutating func visitMapField( + fieldType: _ProtobufMap.Type, + value: _ProtobufMap.BaseType, + fieldNumber: Int + ) throws { + try _visitMap(map: value, fieldNumber: fieldNumber) { + (visitor: inout TextFormatEncodingVisitor, key, value) throws -> () in + try KeyType.visitSingular(value: key, fieldNumber: 1, with: &visitor) + try ValueType.visitSingular(value: value, fieldNumber: 2, with: &visitor) + } + } + + mutating func visitMapField( + fieldType: _ProtobufEnumMap.Type, + value: _ProtobufEnumMap.BaseType, + fieldNumber: Int + ) throws where ValueType.RawValue == Int { + try _visitMap(map: value, fieldNumber: fieldNumber) { + (visitor: inout TextFormatEncodingVisitor, key, value) throws -> () in + try KeyType.visitSingular(value: key, fieldNumber: 1, with: &visitor) + try visitor.visitSingularEnumField(value: value, fieldNumber: 2) + } + } + + mutating func visitMapField( + fieldType: _ProtobufMessageMap.Type, + value: _ProtobufMessageMap.BaseType, + fieldNumber: Int + ) throws { + try _visitMap(map: value, fieldNumber: fieldNumber) { + (visitor: inout TextFormatEncodingVisitor, key, value) throws -> () in + try KeyType.visitSingular(value: key, fieldNumber: 1, with: &visitor) + try visitor.visitSingularMessageField(value: value, fieldNumber: 2) + } + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/TextFormatScanner.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/TextFormatScanner.swift new file mode 100644 index 0000000..519ec2d --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/TextFormatScanner.swift @@ -0,0 +1,1077 @@ +// Sources/SwiftProtobuf/TextFormatScanner.swift - Text format decoding +// +// Copyright (c) 2014 - 2019 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Test format decoding engine. +/// +// ----------------------------------------------------------------------------- + +import Foundation + +private let asciiBell = UInt8(7) +private let asciiBackspace = UInt8(8) +private let asciiTab = UInt8(9) +private let asciiNewLine = UInt8(10) +private let asciiVerticalTab = UInt8(11) +private let asciiFormFeed = UInt8(12) +private let asciiCarriageReturn = UInt8(13) +private let asciiZero = UInt8(ascii: "0") +private let asciiOne = UInt8(ascii: "1") +private let asciiThree = UInt8(ascii: "3") +private let asciiSeven = UInt8(ascii: "7") +private let asciiNine = UInt8(ascii: "9") +private let asciiColon = UInt8(ascii: ":") +private let asciiPeriod = UInt8(ascii: ".") +private let asciiPlus = UInt8(ascii: "+") +private let asciiComma = UInt8(ascii: ",") +private let asciiSemicolon = UInt8(ascii: ";") +private let asciiDoubleQuote = UInt8(ascii: "\"") +private let asciiSingleQuote = UInt8(ascii: "\'") +private let asciiBackslash = UInt8(ascii: "\\") +private let asciiForwardSlash = UInt8(ascii: "/") +private let asciiHash = UInt8(ascii: "#") +private let asciiUnderscore = UInt8(ascii: "_") +private let asciiQuestionMark = UInt8(ascii: "?") +private let asciiSpace = UInt8(ascii: " ") +private let asciiOpenSquareBracket = UInt8(ascii: "[") +private let asciiCloseSquareBracket = UInt8(ascii: "]") +private let asciiOpenCurlyBracket = UInt8(ascii: "{") +private let asciiCloseCurlyBracket = UInt8(ascii: "}") +private let asciiOpenAngleBracket = UInt8(ascii: "<") +private let asciiCloseAngleBracket = UInt8(ascii: ">") +private let asciiMinus = UInt8(ascii: "-") +private let asciiLowerA = UInt8(ascii: "a") +private let asciiUpperA = UInt8(ascii: "A") +private let asciiLowerB = UInt8(ascii: "b") +private let asciiLowerE = UInt8(ascii: "e") +private let asciiUpperE = UInt8(ascii: "E") +private let asciiLowerF = UInt8(ascii: "f") +private let asciiUpperF = UInt8(ascii: "F") +private let asciiLowerI = UInt8(ascii: "i") +private let asciiLowerL = UInt8(ascii: "l") +private let asciiLowerN = UInt8(ascii: "n") +private let asciiLowerR = UInt8(ascii: "r") +private let asciiLowerS = UInt8(ascii: "s") +private let asciiLowerT = UInt8(ascii: "t") +private let asciiUpperT = UInt8(ascii: "T") +private let asciiLowerU = UInt8(ascii: "u") +private let asciiLowerV = UInt8(ascii: "v") +private let asciiLowerX = UInt8(ascii: "x") +private let asciiLowerY = UInt8(ascii: "y") +private let asciiLowerZ = UInt8(ascii: "z") +private let asciiUpperZ = UInt8(ascii: "Z") + +private func fromHexDigit(_ c: UInt8) -> UInt8? { + if c >= asciiZero && c <= asciiNine { + return c - asciiZero + } + if c >= asciiUpperA && c <= asciiUpperF { + return c - asciiUpperA + UInt8(10) + } + if c >= asciiLowerA && c <= asciiLowerF { + return c - asciiLowerA + UInt8(10) + } + return nil +} + +// Protobuf Text encoding assumes that you're working directly +// in UTF-8. So this implementation converts the string to UTF8, +// then decodes it into a sequence of bytes, then converts +// it back into a string. +private func decodeString(_ s: String) -> String? { + var out = [UInt8]() + var bytes = s.utf8.makeIterator() + while let byte = bytes.next() { + switch byte { + case asciiBackslash: // backslash + if let escaped = bytes.next() { + switch escaped { + case asciiZero...asciiSeven: // 0...7 + // C standard allows 1, 2, or 3 octal digits. + let savedPosition = bytes + let digit1 = escaped + let digit1Value = digit1 - asciiZero + if let digit2 = bytes.next(), + digit2 >= asciiZero && digit2 <= asciiSeven { + let digit2Value = digit2 - asciiZero + let innerSavedPosition = bytes + if let digit3 = bytes.next(), + digit3 >= asciiZero && digit3 <= asciiSeven { + let digit3Value = digit3 - asciiZero + let n = digit1Value * 64 + digit2Value * 8 + digit3Value + out.append(n) + } else { + let n = digit1Value * 8 + digit2Value + out.append(n) + bytes = innerSavedPosition + } + } else { + let n = digit1Value + out.append(n) + bytes = savedPosition + } + case asciiLowerX: // "x" + // Unlike C/C++, protobuf only allows 1 or 2 digits here: + if let byte = bytes.next(), let digit = fromHexDigit(byte) { + var n = digit + let savedPosition = bytes + if let byte = bytes.next(), let digit = fromHexDigit(byte) { + n = n &* 16 + digit + } else { + // No second digit; reset the iterator + bytes = savedPosition + } + out.append(n) + } else { + return nil // Hex escape must have at least 1 digit + } + case asciiLowerA: // \a + out.append(asciiBell) + case asciiLowerB: // \b + out.append(asciiBackspace) + case asciiLowerF: // \f + out.append(asciiFormFeed) + case asciiLowerN: // \n + out.append(asciiNewLine) + case asciiLowerR: // \r + out.append(asciiCarriageReturn) + case asciiLowerT: // \t + out.append(asciiTab) + case asciiLowerV: // \v + out.append(asciiVerticalTab) + case asciiDoubleQuote, + asciiSingleQuote, + asciiQuestionMark, + asciiBackslash: // " ' ? \ + out.append(escaped) + default: + return nil // Unrecognized escape + } + } else { + return nil // Input ends with backslash + } + default: + out.append(byte) + } + } + // There has got to be an easier way to convert a [UInt8] into a String. + return out.withUnsafeBufferPointer { ptr in + if let addr = ptr.baseAddress { + return utf8ToString(bytes: addr, count: ptr.count) + } else { + return String() + } + } +} + +/// +/// TextFormatScanner has no public members. +/// +internal struct TextFormatScanner { + internal var extensions: ExtensionMap? + private var p: UnsafeRawPointer + private var end: UnsafeRawPointer + private var doubleParser = DoubleParser() + + internal var complete: Bool { + mutating get { + return p == end + } + } + + internal init(utf8Pointer: UnsafeRawPointer, count: Int, extensions: ExtensionMap? = nil) { + p = utf8Pointer + end = p + count + self.extensions = extensions + skipWhitespace() + } + + /// Skip whitespace + private mutating func skipWhitespace() { + while p != end { + let u = p[0] + switch u { + case asciiSpace, + asciiTab, + asciiNewLine, + asciiCarriageReturn: // space, tab, NL, CR + p += 1 + case asciiHash: // # comment + p += 1 + while p != end { + // Skip until end of line + let c = p[0] + p += 1 + if c == asciiNewLine || c == asciiCarriageReturn { + break + } + } + default: + return + } + } + } + + /// Return a buffer containing the raw UTF8 for an identifier. + /// Assumes that you already know the current byte is a valid + /// start of identifier. + private mutating func parseUTF8Identifier() -> UnsafeRawBufferPointer { + let start = p + loop: while p != end { + let c = p[0] + switch c { + case asciiLowerA...asciiLowerZ, + asciiUpperA...asciiUpperZ, + asciiZero...asciiNine, + asciiUnderscore: + p += 1 + default: + break loop + } + } + let s = UnsafeRawBufferPointer(start: start, count: p - start) + skipWhitespace() + return s + } + + /// Return a String containing the next identifier. + private mutating func parseIdentifier() -> String { + let buff = parseUTF8Identifier() + let s = utf8ToString(bytes: buff.baseAddress!, count: buff.count) + // Force-unwrap is OK: we never have invalid UTF8 at this point. + return s! + } + + /// Parse the rest of an [extension_field_name] in the input, assuming the + /// initial "[" character has already been read (and is in the prefix) + /// This is also used for AnyURL, so we include "/", "." + private mutating func parseExtensionKey() -> String? { + let start = p + if p == end { + return nil + } + let c = p[0] + switch c { + case asciiLowerA...asciiLowerZ, asciiUpperA...asciiUpperZ: + p += 1 + default: + return nil + } + while p != end { + let c = p[0] + switch c { + case asciiLowerA...asciiLowerZ, + asciiUpperA...asciiUpperZ, + asciiZero...asciiNine, + asciiUnderscore, + asciiPeriod, + asciiForwardSlash: + p += 1 + case asciiCloseSquareBracket: // ] + return utf8ToString(bytes: start, count: p - start) + default: + return nil + } + } + return nil + } + + /// Scan a string that encodes a byte field, return a count of + /// the number of bytes that should be decoded from it + private mutating func validateAndCountBytesFromString(terminator: UInt8, sawBackslash: inout Bool) throws -> Int { + var count = 0 + let start = p + sawBackslash = false + while p != end { + let byte = p[0] + p += 1 + if byte == terminator { + p = start + return count + } + switch byte { + case asciiBackslash: // "\\" + sawBackslash = true + if p != end { + let escaped = p[0] + p += 1 + switch escaped { + case asciiZero...asciiSeven: // '0'...'7' + // C standard allows 1, 2, or 3 octal digits. + if p != end, p[0] >= asciiZero, p[0] <= asciiSeven { + p += 1 + if p != end, p[0] >= asciiZero, p[0] <= asciiSeven { + if escaped > asciiThree { + // Out of range octal: three digits and first digit is greater than 3 + throw TextFormatDecodingError.malformedText + } + p += 1 + } + } + count += 1 + case asciiLowerX: // 'x' hexadecimal escape + if p != end && fromHexDigit(p[0]) != nil { + p += 1 + if p != end && fromHexDigit(p[0]) != nil { + p += 1 + } + } else { + throw TextFormatDecodingError.malformedText // Hex escape must have at least 1 digit + } + count += 1 + case asciiLowerA, // \a ("alert") + asciiLowerB, // \b + asciiLowerF, // \f + asciiLowerN, // \n + asciiLowerR, // \r + asciiLowerT, // \t + asciiLowerV, // \v + asciiSingleQuote, // \' + asciiDoubleQuote, // \" + asciiQuestionMark, // \? + asciiBackslash: // \\ + count += 1 + default: + throw TextFormatDecodingError.malformedText // Unrecognized escape + } + } + default: + count += 1 + } + } + throw TextFormatDecodingError.malformedText + } + + /// Protobuf Text format uses C ASCII conventions for + /// encoding byte sequences, including the use of octal + /// and hexadecimal escapes. + /// + /// Assumes that validateAndCountBytesFromString() has already + /// verified the correctness. So we get to avoid error checks here. + private mutating func parseBytesFromString(terminator: UInt8, into data: inout Data) { + data.withUnsafeMutableBytes { + (body: UnsafeMutableRawBufferPointer) in + if var out = body.baseAddress, body.count > 0 { + while p[0] != terminator { + let byte = p[0] + p += 1 + switch byte { + case asciiBackslash: // "\\" + let escaped = p[0] + p += 1 + switch escaped { + case asciiZero...asciiSeven: // '0'...'7' + // C standard allows 1, 2, or 3 octal digits. + let digit1Value = escaped - asciiZero + let digit2 = p[0] + if digit2 >= asciiZero, digit2 <= asciiSeven { + p += 1 + let digit2Value = digit2 - asciiZero + let digit3 = p[0] + if digit3 >= asciiZero, digit3 <= asciiSeven { + p += 1 + let digit3Value = digit3 - asciiZero + out[0] = digit1Value &* 64 + digit2Value * 8 + digit3Value + out += 1 + } else { + out[0] = digit1Value * 8 + digit2Value + out += 1 + } + } else { + out[0] = digit1Value + out += 1 + } + case asciiLowerX: // 'x' hexadecimal escape + // We already validated, so we know there's at least one digit: + var n = fromHexDigit(p[0])! + p += 1 + if let digit = fromHexDigit(p[0]) { + n = n &* 16 &+ digit + p += 1 + } + out[0] = n + out += 1 + case asciiLowerA: // \a ("alert") + out[0] = asciiBell + out += 1 + case asciiLowerB: // \b + out[0] = asciiBackspace + out += 1 + case asciiLowerF: // \f + out[0] = asciiFormFeed + out += 1 + case asciiLowerN: // \n + out[0] = asciiNewLine + out += 1 + case asciiLowerR: // \r + out[0] = asciiCarriageReturn + out += 1 + case asciiLowerT: // \t + out[0] = asciiTab + out += 1 + case asciiLowerV: // \v + out[0] = asciiVerticalTab + out += 1 + default: + out[0] = escaped + out += 1 + } + default: + out[0] = byte + out += 1 + } + } + p += 1 // Consume terminator + } + } + } + + /// Assumes the leading quote has already been consumed + private mutating func parseStringSegment(terminator: UInt8) -> String? { + let start = p + var sawBackslash = false + while p != end { + let c = p[0] + if c == terminator { + let s = utf8ToString(bytes: start, count: p - start) + p += 1 + skipWhitespace() + if let s = s, sawBackslash { + return decodeString(s) + } else { + return s + } + } + p += 1 + if c == asciiBackslash { // \ + if p == end { + return nil + } + sawBackslash = true + p += 1 + } + } + return nil // Unterminated quoted string + } + + internal mutating func nextUInt() throws -> UInt64 { + if p == end { + throw TextFormatDecodingError.malformedNumber + } + let c = p[0] + p += 1 + if c == asciiZero { // leading '0' precedes octal or hex + if p[0] == asciiLowerX { // 'x' => hex + p += 1 + var n: UInt64 = 0 + while p != end { + let digit = p[0] + let val: UInt64 + switch digit { + case asciiZero...asciiNine: // 0...9 + val = UInt64(digit - asciiZero) + case asciiLowerA...asciiLowerF: // a...f + val = UInt64(digit - asciiLowerA + 10) + case asciiUpperA...asciiUpperF: + val = UInt64(digit - asciiUpperA + 10) + case asciiLowerU: // trailing 'u' + p += 1 + skipWhitespace() + return n + default: + skipWhitespace() + return n + } + if n > UInt64.max / 16 { + throw TextFormatDecodingError.malformedNumber + } + p += 1 + n = n * 16 + val + } + skipWhitespace() + return n + } else { // octal + var n: UInt64 = 0 + while p != end { + let digit = p[0] + if digit == asciiLowerU { // trailing 'u' + p += 1 + skipWhitespace() + return n + } + if digit < asciiZero || digit > asciiSeven { + skipWhitespace() + return n // not octal digit + } + let val = UInt64(digit - asciiZero) + if n > UInt64.max / 8 { + throw TextFormatDecodingError.malformedNumber + } + p += 1 + n = n * 8 + val + } + skipWhitespace() + return n + } + } else if c > asciiZero && c <= asciiNine { // 1...9 + var n = UInt64(c - asciiZero) + while p != end { + let digit = p[0] + if digit == asciiLowerU { // trailing 'u' + p += 1 + skipWhitespace() + return n + } + if digit < asciiZero || digit > asciiNine { + skipWhitespace() + return n // not a digit + } + let val = UInt64(digit - asciiZero) + if n > UInt64.max / 10 || n * 10 > UInt64.max - val { + throw TextFormatDecodingError.malformedNumber + } + p += 1 + n = n * 10 + val + } + skipWhitespace() + return n + } + throw TextFormatDecodingError.malformedNumber + } + + internal mutating func nextSInt() throws -> Int64 { + if p == end { + throw TextFormatDecodingError.malformedNumber + } + let c = p[0] + if c == asciiMinus { // - + p += 1 + // character after '-' must be digit + let digit = p[0] + if digit < asciiZero || digit > asciiNine { + throw TextFormatDecodingError.malformedNumber + } + let n = try nextUInt() + let limit: UInt64 = 0x8000000000000000 // -Int64.min + if n >= limit { + if n > limit { + // Too large negative number + throw TextFormatDecodingError.malformedNumber + } else { + return Int64.min // Special case for Int64.min + } + } + return -Int64(bitPattern: n) + } else { + let n = try nextUInt() + if n > UInt64(bitPattern: Int64.max) { + throw TextFormatDecodingError.malformedNumber + } + return Int64(bitPattern: n) + } + } + + internal mutating func nextStringValue() throws -> String { + var result: String + skipWhitespace() + if p == end { + throw TextFormatDecodingError.malformedText + } + let c = p[0] + if c != asciiSingleQuote && c != asciiDoubleQuote { + throw TextFormatDecodingError.malformedText + } + p += 1 + if let s = parseStringSegment(terminator: c) { + result = s + } else { + throw TextFormatDecodingError.malformedText + } + + while true { + if p == end { + return result + } + let c = p[0] + if c != asciiSingleQuote && c != asciiDoubleQuote { + return result + } + p += 1 + if let s = parseStringSegment(terminator: c) { + result.append(s) + } else { + throw TextFormatDecodingError.malformedText + } + } + } + + /// Protobuf Text Format allows a single bytes field to + /// contain multiple quoted strings. The values + /// are separately decoded and then concatenated: + /// field1: "bytes" 'more bytes' + /// "and even more bytes" + internal mutating func nextBytesValue() throws -> Data { + // Get the first string's contents + var result: Data + skipWhitespace() + if p == end { + throw TextFormatDecodingError.malformedText + } + let c = p[0] + if c != asciiSingleQuote && c != asciiDoubleQuote { + throw TextFormatDecodingError.malformedText + } + p += 1 + var sawBackslash = false + let n = try validateAndCountBytesFromString(terminator: c, sawBackslash: &sawBackslash) + if sawBackslash { + result = Data(count: n) + parseBytesFromString(terminator: c, into: &result) + } else { + result = Data(bytes: p, count: n) + p += n + 1 // Skip string body + close quote + } + + // If there are more strings, decode them + // and append to the result: + while true { + skipWhitespace() + if p == end { + return result + } + let c = p[0] + if c != asciiSingleQuote && c != asciiDoubleQuote { + return result + } + p += 1 + var sawBackslash = false + let n = try validateAndCountBytesFromString(terminator: c, sawBackslash: &sawBackslash) + if sawBackslash { + var b = Data(count: n) + parseBytesFromString(terminator: c, into: &b) + result.append(b) + } else { + result.append(Data(bytes: p, count: n)) + p += n + 1 // Skip string body + close quote + } + } + } + + // Tries to identify a sequence of UTF8 characters + // that represent a numeric floating-point value. + private mutating func tryParseFloatString() -> Double? { + guard p != end else {return nil} + let start = p + var c = p[0] + if c == asciiMinus { + p += 1 + guard p != end else {p = start; return nil} + c = p[0] + } + switch c { + case asciiZero: // '0' as first character is not allowed followed by digit + p += 1 + guard p != end else {break} + c = p[0] + if c >= asciiZero && c <= asciiNine { + p = start + return nil + } + case asciiPeriod: // '.' as first char only if followed by digit + p += 1 + guard p != end else {p = start; return nil} + c = p[0] + if c < asciiZero || c > asciiNine { + p = start + return nil + } + case asciiOne...asciiNine: + break + default: + p = start + return nil + } + loop: while p != end { + let c = p[0] + switch c { + case asciiZero...asciiNine, + asciiPeriod, + asciiPlus, + asciiMinus, + asciiLowerE, + asciiUpperE: // 0...9, ., +, -, e, E + p += 1 + case asciiLowerF: // f + // proto1 allowed floats to be suffixed with 'f' + let d = doubleParser.utf8ToDouble(bytes: UnsafeRawBufferPointer(start: start, count: p - start)) + // Just skip the 'f' + p += 1 + skipWhitespace() + return d + default: + break loop + } + } + let d = doubleParser.utf8ToDouble(bytes: UnsafeRawBufferPointer(start: start, count: p - start)) + skipWhitespace() + return d + } + + // Skip specified characters if they all match + private mutating func skipOptionalCharacters(bytes: [UInt8]) { + let start = p + for b in bytes { + if p == end || p[0] != b { + p = start + return + } + p += 1 + } + } + + // Skip following keyword if it matches (case-insensitively) + // the given keyword (specified as a series of bytes). + private mutating func skipOptionalKeyword(bytes: [UInt8]) -> Bool { + let start = p + for b in bytes { + if p == end { + p = start + return false + } + var c = p[0] + if c >= asciiUpperA && c <= asciiUpperZ { + // Convert to lower case + // (Protobuf text keywords are case insensitive) + c += asciiLowerA - asciiUpperA + } + if c != b { + p = start + return false + } + p += 1 + } + if p == end { + return true + } + let c = p[0] + if ((c >= asciiUpperA && c <= asciiUpperZ) + || (c >= asciiLowerA && c <= asciiLowerZ)) { + p = start + return false + } + skipWhitespace() + return true + } + + // If the next token is the identifier "nan", return true. + private mutating func skipOptionalNaN() -> Bool { + return skipOptionalKeyword(bytes: + [asciiLowerN, asciiLowerA, asciiLowerN]) + } + + // If the next token is a recognized spelling of "infinity", + // return Float.infinity or -Float.infinity + private mutating func skipOptionalInfinity() -> Float? { + if p == end { + return nil + } + let c = p[0] + let negated: Bool + if c == asciiMinus { + negated = true + p += 1 + } else { + negated = false + } + let inf = [asciiLowerI, asciiLowerN, asciiLowerF] + let infinity = [asciiLowerI, asciiLowerN, asciiLowerF, asciiLowerI, + asciiLowerN, asciiLowerI, asciiLowerT, asciiLowerY] + if (skipOptionalKeyword(bytes: inf) + || skipOptionalKeyword(bytes: infinity)) { + return negated ? -Float.infinity : Float.infinity + } + return nil + } + + internal mutating func nextFloat() throws -> Float { + if let d = tryParseFloatString() { + return Float(d) + } + if skipOptionalNaN() { + return Float.nan + } + if let inf = skipOptionalInfinity() { + return inf + } + throw TextFormatDecodingError.malformedNumber + } + + internal mutating func nextDouble() throws -> Double { + if let d = tryParseFloatString() { + return d + } + if skipOptionalNaN() { + return Double.nan + } + if let inf = skipOptionalInfinity() { + return Double(inf) + } + throw TextFormatDecodingError.malformedNumber + } + + internal mutating func nextBool() throws -> Bool { + skipWhitespace() + if p == end { + throw TextFormatDecodingError.malformedText + } + let c = p[0] + p += 1 + let result: Bool + switch c { + case asciiZero: + result = false + case asciiOne: + result = true + case asciiLowerF, asciiUpperF: + if p != end { + let alse = [asciiLowerA, asciiLowerL, asciiLowerS, asciiLowerE] + skipOptionalCharacters(bytes: alse) + } + result = false + case asciiLowerT, asciiUpperT: + if p != end { + let rue = [asciiLowerR, asciiLowerU, asciiLowerE] + skipOptionalCharacters(bytes: rue) + } + result = true + default: + throw TextFormatDecodingError.malformedText + } + if p == end { + return result + } + switch p[0] { + case asciiSpace, + asciiTab, + asciiNewLine, + asciiCarriageReturn, + asciiHash, + asciiComma, + asciiSemicolon, + asciiCloseSquareBracket, + asciiCloseCurlyBracket, + asciiCloseAngleBracket: + skipWhitespace() + return result + default: + throw TextFormatDecodingError.malformedText + } + } + + internal mutating func nextOptionalEnumName() throws -> UnsafeRawBufferPointer? { + skipWhitespace() + if p == end { + throw TextFormatDecodingError.malformedText + } + switch p[0] { + case asciiLowerA...asciiLowerZ, asciiUpperA...asciiUpperZ: + return parseUTF8Identifier() + default: + return nil + } + } + + /// Any URLs are syntactically (almost) identical to extension + /// keys, so we share the code for those. + internal mutating func nextOptionalAnyURL() throws -> String? { + return try nextOptionalExtensionKey() + } + + /// Returns next extension key or nil if end-of-input or + /// if next token is not an extension key. + /// + /// Throws an error if the next token starts with '[' but + /// cannot be parsed as an extension key. + /// + /// Note: This accepts / characters to support Any URL parsing. + /// Technically, Any URLs can contain / characters and extension + /// key names cannot. But in practice, accepting / chracters for + /// extension keys works fine, since the result just gets rejected + /// when the key is looked up. + internal mutating func nextOptionalExtensionKey() throws -> String? { + skipWhitespace() + if p == end { + return nil + } + if p[0] == asciiOpenSquareBracket { // [ + p += 1 + if let s = parseExtensionKey() { + if p == end || p[0] != asciiCloseSquareBracket { + throw TextFormatDecodingError.malformedText + } + // Skip ] + p += 1 + skipWhitespace() + return s + } else { + throw TextFormatDecodingError.malformedText + } + } + return nil + } + + /// Returns text of next regular key or nil if end-of-input. + /// This considers an extension key [keyname] to be an + /// error, so call nextOptionalExtensionKey first if you + /// want to handle extension keys. + /// + /// This is only used by map parsing; we should be able to + /// rework that to use nextFieldNumber instead. + internal mutating func nextKey() throws -> String? { + skipWhitespace() + if p == end { + return nil + } + let c = p[0] + switch c { + case asciiOpenSquareBracket: // [ + throw TextFormatDecodingError.malformedText + case asciiLowerA...asciiLowerZ, + asciiUpperA...asciiUpperZ, + asciiOne...asciiNine: // a...z, A...Z, 1...9 + return parseIdentifier() + default: + throw TextFormatDecodingError.malformedText + } + } + + /// Parse a field name, look it up, and return the corresponding + /// field number. + /// + /// returns nil at end-of-input + /// + /// Throws if field name cannot be parsed or if field name is + /// unknown. + /// + /// This function accounts for as much as 2/3 of the total run + /// time of the entire parse. + internal mutating func nextFieldNumber(names: _NameMap) throws -> Int? { + if p == end { + return nil + } + let c = p[0] + switch c { + case asciiLowerA...asciiLowerZ, + asciiUpperA...asciiUpperZ: // a...z, A...Z + let key = parseUTF8Identifier() + if let fieldNumber = names.number(forProtoName: key) { + return fieldNumber + } else { + throw TextFormatDecodingError.unknownField + } + case asciiOne...asciiNine: // 1-9 (field numbers are 123, not 0123) + var fieldNum = Int(c) - Int(asciiZero) + p += 1 + while p != end { + let c = p[0] + if c >= asciiZero && c <= asciiNine { + fieldNum = fieldNum &* 10 &+ (Int(c) - Int(asciiZero)) + } else { + break + } + p += 1 + } + skipWhitespace() + if names.names(for: fieldNum) != nil { + return fieldNum + } else { + // It was a number that isn't a known field. + // The C++ version (TextFormat::Parser::ParserImpl::ConsumeField()), + // supports an option to file or skip the field's value (this is true + // of unknown names or numbers). + throw TextFormatDecodingError.unknownField + } + default: + break + } + throw TextFormatDecodingError.malformedText + } + + private mutating func skipRequiredCharacter(_ c: UInt8) throws { + skipWhitespace() + if p != end && p[0] == c { + p += 1 + skipWhitespace() + } else { + throw TextFormatDecodingError.malformedText + } + } + + internal mutating func skipRequiredComma() throws { + try skipRequiredCharacter(asciiComma) + } + + internal mutating func skipRequiredColon() throws { + try skipRequiredCharacter(asciiColon) + } + + private mutating func skipOptionalCharacter(_ c: UInt8) -> Bool { + if p != end && p[0] == c { + p += 1 + skipWhitespace() + return true + } + return false + } + + internal mutating func skipOptionalColon() -> Bool { + return skipOptionalCharacter(asciiColon) + } + + internal mutating func skipOptionalEndArray() -> Bool { + return skipOptionalCharacter(asciiCloseSquareBracket) + } + + internal mutating func skipOptionalBeginArray() -> Bool { + return skipOptionalCharacter(asciiOpenSquareBracket) + } + + internal mutating func skipOptionalObjectEnd(_ c: UInt8) -> Bool { + return skipOptionalCharacter(c) + } + + internal mutating func skipOptionalSeparator() { + if p != end { + let c = p[0] + if c == asciiComma || c == asciiSemicolon { // comma or semicolon + p += 1 + skipWhitespace() + } + } + } + + /// Returns the character that should end this field. + /// E.g., if object starts with "{", returns "}" + internal mutating func skipObjectStart() throws -> UInt8 { + if p != end { + let c = p[0] + p += 1 + skipWhitespace() + switch c { + case asciiOpenCurlyBracket: // { + return asciiCloseCurlyBracket // } + case asciiOpenAngleBracket: // < + return asciiCloseAngleBracket // > + default: + break + } + } + throw TextFormatDecodingError.malformedText + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/TimeUtils.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/TimeUtils.swift new file mode 100644 index 0000000..8ae3790 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/TimeUtils.swift @@ -0,0 +1,53 @@ +// Sources/SwiftProtobuf/TimeUtils.swift - Generally useful time/calendar functions +// +// Copyright (c) 2014 - 2017 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Generally useful time/calendar functions and constants +/// +// ----------------------------------------------------------------------------- + +let minutesPerDay: Int32 = 1440 +let minutesPerHour: Int32 = 60 +let secondsPerDay: Int32 = 86400 +let secondsPerHour: Int32 = 3600 +let secondsPerMinute: Int32 = 60 +let nanosPerSecond: Int32 = 1000000000 + +internal func timeOfDayFromSecondsSince1970(seconds: Int64) -> (hh: Int32, mm: Int32, ss: Int32) { + let secondsSinceMidnight = Int32(mod(seconds, Int64(secondsPerDay))) + let ss = mod(secondsSinceMidnight, secondsPerMinute) + let mm = mod(div(secondsSinceMidnight, secondsPerMinute), minutesPerHour) + let hh = Int32(div(secondsSinceMidnight, secondsPerHour)) + + return (hh: hh, mm: mm, ss: ss) +} + +internal func julianDayNumberFromSecondsSince1970(seconds: Int64) -> Int64 { + // January 1, 1970 is Julian Day Number 2440588. + // See http://aa.usno.navy.mil/faq/docs/JD_Formula.php + return div(seconds + 2440588 * Int64(secondsPerDay), Int64(secondsPerDay)) +} + +internal func gregorianDateFromSecondsSince1970(seconds: Int64) -> (YY: Int32, MM: Int32, DD: Int32) { + // The following implements Richards' algorithm (see the Wikipedia article + // for "Julian day"). + // If you touch this code, please test it exhaustively by playing with + // Test_Timestamp.testJSON_range. + + let JJ = julianDayNumberFromSecondsSince1970(seconds: seconds) + let f = JJ + 1401 + div(div(4 * JJ + 274277, 146097) * 3, 4) - 38 + let e = 4 * f + 3 + let g = Int64(div(mod(e, 1461), 4)) + let h = 5 * g + 2 + let DD = div(mod(h, 153), 5) + 1 + let MM = mod(div(h, 153) + 2, 12) + 1 + let YY = div(e, 1461) - 4716 + div(12 + 2 - MM, 12) + + return (YY: Int32(YY), MM: Int32(MM), DD: Int32(DD)) +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/UnknownStorage.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/UnknownStorage.swift new file mode 100644 index 0000000..d1b74f4 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/UnknownStorage.swift @@ -0,0 +1,46 @@ +// Sources/SwiftProtobuf/UnknownStorage.swift - Handling unknown fields +// +// Copyright (c) 2014 - 2016 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Proto2 binary coding requires storing and recoding of unknown fields. +/// This simple support class handles that requirement. A property of this type +/// is compiled into every proto2 message. +/// +// ----------------------------------------------------------------------------- + +import Foundation + +/// Contains any unknown fields in a decoded message; that is, fields that were +/// sent on the wire but were not recognized by the generated message +/// implementation or were valid field numbers but with mismatching wire +/// formats (for example, a field encoded as a varint when a fixed32 integer +/// was expected). +public struct UnknownStorage: Equatable { + /// The raw protocol buffer binary-encoded bytes that represent the unknown + /// fields of a decoded message. + public private(set) var data = Data() + +#if !swift(>=4.1) + public static func ==(lhs: UnknownStorage, rhs: UnknownStorage) -> Bool { + return lhs.data == rhs.data + } +#endif + + public init() {} + + internal mutating func append(protobufData: Data) { + data.append(protobufData) + } + + public func traverse(visitor: inout V) throws { + if !data.isEmpty { + try visitor.visitUnknown(bytes: data) + } + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/UnsafeBufferPointer+Shims.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/UnsafeBufferPointer+Shims.swift new file mode 100644 index 0000000..21d0b7d --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/UnsafeBufferPointer+Shims.swift @@ -0,0 +1,37 @@ +// Sources/SwiftProtobuf/UnsafeBufferPointer+Shims.swift - Shims for UnsafeBufferPointer +// +// Copyright (c) 2019 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Shims for UnsafeBufferPointer +/// +// ----------------------------------------------------------------------------- + + +extension UnsafeMutableBufferPointer { + #if !swift(>=4.2) + internal static func allocate(capacity: Int) -> UnsafeMutableBufferPointer { + let pointer = UnsafeMutablePointer.allocate(capacity: capacity) + return UnsafeMutableBufferPointer(start: pointer, count: capacity) + } + #endif + + #if !swift(>=4.1) + internal func deallocate() { + self.baseAddress?.deallocate(capacity: self.count) + } + #endif +} + +extension UnsafeMutableRawBufferPointer { + #if !swift(>=4.1) + internal func copyMemory(from source: C) where C.Element == UInt8 { + self.copyBytes(from: source) + } + #endif +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/UnsafeRawPointer+Shims.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/UnsafeRawPointer+Shims.swift new file mode 100644 index 0000000..687fec6 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/UnsafeRawPointer+Shims.swift @@ -0,0 +1,45 @@ +// Sources/SwiftProtobuf/UnsafeRawPointer+Shims.swift - Shims for UnsafeRawPointer and friends +// +// Copyright (c) 2019 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Shims for UnsafeRawPointer and friends. +/// +// ----------------------------------------------------------------------------- + + +extension UnsafeRawPointer { + /// A shim subscript for UnsafeRawPointer aiming to maintain code consistency. + /// + /// We can remove this shim when we rewrite the code to use buffer pointers. + internal subscript(_ offset: Int) -> UInt8 { + get { + return self.load(fromByteOffset: offset, as: UInt8.self) + } + } +} + +extension UnsafeMutableRawPointer { + /// A shim subscript for UnsafeMutableRawPointer aiming to maintain code consistency. + /// + /// We can remove this shim when we rewrite the code to use buffer pointers. + internal subscript(_ offset: Int) -> UInt8 { + get { + return self.load(fromByteOffset: offset, as: UInt8.self) + } + set { + self.storeBytes(of: newValue, toByteOffset: offset, as: UInt8.self) + } + } + + #if !swift(>=4.1) + internal mutating func copyMemory(from source: UnsafeRawPointer, byteCount: Int) { + self.copyBytes(from: source, count: byteCount) + } + #endif +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Varint.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Varint.swift new file mode 100644 index 0000000..bb38ba5 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Varint.swift @@ -0,0 +1,108 @@ +// Sources/SwiftProtobuf/Varint.swift - Varint encoding/decoding helpers +// +// Copyright (c) 2014 - 2016 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Helper functions to varint-encode and decode integers. +/// +// ----------------------------------------------------------------------------- + + +/// Contains helper methods to varint-encode and decode integers. +internal enum Varint { + + /// Computes the number of bytes that would be needed to store a 32-bit varint. + /// + /// - Parameter value: The number whose varint size should be calculated. + /// - Returns: The size, in bytes, of the 32-bit varint. + static func encodedSize(of value: UInt32) -> Int { + if (value & (~0 << 7)) == 0 { + return 1 + } + if (value & (~0 << 14)) == 0 { + return 2 + } + if (value & (~0 << 21)) == 0 { + return 3 + } + if (value & (~0 << 28)) == 0 { + return 4 + } + return 5 + } + + /// Computes the number of bytes that would be needed to store a signed 32-bit varint, if it were + /// treated as an unsigned integer with the same bit pattern. + /// + /// - Parameter value: The number whose varint size should be calculated. + /// - Returns: The size, in bytes, of the 32-bit varint. + static func encodedSize(of value: Int32) -> Int { + if value >= 0 { + return encodedSize(of: UInt32(bitPattern: value)) + } else { + // Must sign-extend. + return encodedSize(of: Int64(value)) + } + } + + /// Computes the number of bytes that would be needed to store a 64-bit varint. + /// + /// - Parameter value: The number whose varint size should be calculated. + /// - Returns: The size, in bytes, of the 64-bit varint. + static func encodedSize(of value: Int64) -> Int { + // Handle two common special cases up front. + if (value & (~0 << 7)) == 0 { + return 1 + } + if value < 0 { + return 10 + } + + // Divide and conquer the remaining eight cases. + var value = value + var n = 2 + + if (value & (~0 << 35)) != 0 { + n += 4 + value >>= 28 + } + if (value & (~0 << 21)) != 0 { + n += 2 + value >>= 14 + } + if (value & (~0 << 14)) != 0 { + n += 1 + } + return n + } + + /// Computes the number of bytes that would be needed to store an unsigned 64-bit varint, if it + /// were treated as a signed integer witht he same bit pattern. + /// + /// - Parameter value: The number whose varint size should be calculated. + /// - Returns: The size, in bytes, of the 64-bit varint. + static func encodedSize(of value: UInt64) -> Int { + return encodedSize(of: Int64(bitPattern: value)) + } + + /// Counts the number of distinct varints in a packed byte buffer. + static func countVarintsInBuffer(start: UnsafeRawPointer, count: Int) -> Int { + // We don't need to decode all the varints to count how many there + // are. Just observe that every varint has exactly one byte with + // value < 128. So we just count those... + var n = 0 + var ints = 0 + while n < count { + if start.load(fromByteOffset: n, as: UInt8.self) < 128 { + ints += 1 + } + n += 1 + } + return ints + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Version.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Version.swift new file mode 100644 index 0000000..1c3e642 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Version.swift @@ -0,0 +1,28 @@ +// Sources/SwiftProtobuf/Version.swift - Runtime Version info +// +// Copyright (c) 2014 - 2017 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// A interface for exposing the version of the runtime. +/// +// ----------------------------------------------------------------------------- + +import Foundation + +// Expose version information about the library. +public struct Version { + /// Major version. + public static let major = 1 + /// Minor version. + public static let minor = 12 + /// Revision number. + public static let revision = 0 + + /// String form of the version number. + public static let versionString = "\(major).\(minor).\(revision)" +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Visitor.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Visitor.swift new file mode 100644 index 0000000..78958e4 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/Visitor.swift @@ -0,0 +1,725 @@ +// Sources/SwiftProtobuf/Visitor.swift - Basic serialization machinery +// +// Copyright (c) 2014 - 2016 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Protocol for traversing the object tree. +/// +/// This is used by: +/// = Protobuf serialization +/// = JSON serialization (with some twists to account for specialty JSON +/// encodings) +/// = Protobuf text serialization +/// = Hashable computation +/// +/// Conceptually, serializers create visitor objects that are +/// then passed recursively to every message and field via generated +/// 'traverse' methods. The details get a little involved due to +/// the need to allow particular messages to override particular +/// behaviors for specific encodings, but the general idea is quite simple. +/// +// ----------------------------------------------------------------------------- + +import Foundation + +/// This is the key interface used by the generated `traverse()` methods +/// used for serialization. It is implemented by each serialization protocol: +/// Protobuf Binary, Protobuf Text, JSON, and the Hash encoder. +public protocol Visitor { + + /// Called for each non-repeated float field + /// + /// A default implementation is provided that just widens the value + /// and calls `visitSingularDoubleField` + mutating func visitSingularFloatField(value: Float, fieldNumber: Int) throws + + /// Called for each non-repeated double field + /// + /// There is no default implementation. This must be implemented. + mutating func visitSingularDoubleField(value: Double, fieldNumber: Int) throws + + /// Called for each non-repeated int32 field + /// + /// A default implementation is provided that just widens the value + /// and calls `visitSingularInt64Field` + mutating func visitSingularInt32Field(value: Int32, fieldNumber: Int) throws + + /// Called for each non-repeated int64 field + /// + /// There is no default implementation. This must be implemented. + mutating func visitSingularInt64Field(value: Int64, fieldNumber: Int) throws + + /// Called for each non-repeated uint32 field + /// + /// A default implementation is provided that just widens the value + /// and calls `visitSingularUInt64Field` + mutating func visitSingularUInt32Field(value: UInt32, fieldNumber: Int) throws + + /// Called for each non-repeated uint64 field + /// + /// There is no default implementation. This must be implemented. + mutating func visitSingularUInt64Field(value: UInt64, fieldNumber: Int) throws + + /// Called for each non-repeated sint32 field + /// + /// A default implementation is provided that just forwards to + /// `visitSingularInt32Field` + mutating func visitSingularSInt32Field(value: Int32, fieldNumber: Int) throws + + /// Called for each non-repeated sint64 field + /// + /// A default implementation is provided that just forwards to + /// `visitSingularInt64Field` + mutating func visitSingularSInt64Field(value: Int64, fieldNumber: Int) throws + + /// Called for each non-repeated fixed32 field + /// + /// A default implementation is provided that just forwards to + /// `visitSingularUInt32Field` + mutating func visitSingularFixed32Field(value: UInt32, fieldNumber: Int) throws + + /// Called for each non-repeated fixed64 field + /// + /// A default implementation is provided that just forwards to + /// `visitSingularUInt64Field` + mutating func visitSingularFixed64Field(value: UInt64, fieldNumber: Int) throws + + /// Called for each non-repeated sfixed32 field + /// + /// A default implementation is provided that just forwards to + /// `visitSingularInt32Field` + mutating func visitSingularSFixed32Field(value: Int32, fieldNumber: Int) throws + + /// Called for each non-repeated sfixed64 field + /// + /// A default implementation is provided that just forwards to + /// `visitSingularInt64Field` + mutating func visitSingularSFixed64Field(value: Int64, fieldNumber: Int) throws + + /// Called for each non-repeated bool field + /// + /// There is no default implementation. This must be implemented. + mutating func visitSingularBoolField(value: Bool, fieldNumber: Int) throws + + /// Called for each non-repeated string field + /// + /// There is no default implementation. This must be implemented. + mutating func visitSingularStringField(value: String, fieldNumber: Int) throws + + /// Called for each non-repeated bytes field + /// + /// There is no default implementation. This must be implemented. + mutating func visitSingularBytesField(value: Data, fieldNumber: Int) throws + + /// Called for each non-repeated enum field + /// + /// There is no default implementation. This must be implemented. + mutating func visitSingularEnumField(value: E, fieldNumber: Int) throws + + /// Called for each non-repeated nested message field. + /// + /// There is no default implementation. This must be implemented. + mutating func visitSingularMessageField(value: M, fieldNumber: Int) throws + + /// Called for each non-repeated proto2 group field. + /// + /// A default implementation is provided that simply forwards to + /// `visitSingularMessageField`. Implementors who need to handle groups + /// differently than nested messages can override this and provide distinct + /// implementations. + mutating func visitSingularGroupField(value: G, fieldNumber: Int) throws + + // Called for each non-packed repeated float field. + /// The method is called once with the complete array of values for + /// the field. + /// + /// A default implementation is provided that simply calls + /// `visitSingularFloatField` once for each item in the array. + mutating func visitRepeatedFloatField(value: [Float], fieldNumber: Int) throws + + // Called for each non-packed repeated double field. + /// The method is called once with the complete array of values for + /// the field. + /// + /// A default implementation is provided that simply calls + /// `visitSingularDoubleField` once for each item in the array. + mutating func visitRepeatedDoubleField(value: [Double], fieldNumber: Int) throws + + // Called for each non-packed repeated int32 field. + /// The method is called once with the complete array of values for + /// the field. + /// + /// A default implementation is provided that simply calls + /// `visitSingularInt32Field` once for each item in the array. + mutating func visitRepeatedInt32Field(value: [Int32], fieldNumber: Int) throws + + // Called for each non-packed repeated int64 field. + /// The method is called once with the complete array of values for + /// the field. + /// + /// A default implementation is provided that simply calls + /// `visitSingularInt64Field` once for each item in the array. + mutating func visitRepeatedInt64Field(value: [Int64], fieldNumber: Int) throws + + // Called for each non-packed repeated uint32 field. + /// The method is called once with the complete array of values for + /// the field. + /// + /// A default implementation is provided that simply calls + /// `visitSingularUInt32Field` once for each item in the array. + mutating func visitRepeatedUInt32Field(value: [UInt32], fieldNumber: Int) throws + + // Called for each non-packed repeated uint64 field. + /// The method is called once with the complete array of values for + /// the field. + /// + /// A default implementation is provided that simply calls + /// `visitSingularUInt64Field` once for each item in the array. + mutating func visitRepeatedUInt64Field(value: [UInt64], fieldNumber: Int) throws + + // Called for each non-packed repeated sint32 field. + /// The method is called once with the complete array of values for + /// the field. + /// + /// A default implementation is provided that simply calls + /// `visitSingularSInt32Field` once for each item in the array. + mutating func visitRepeatedSInt32Field(value: [Int32], fieldNumber: Int) throws + + // Called for each non-packed repeated sint64 field. + /// The method is called once with the complete array of values for + /// the field. + /// + /// A default implementation is provided that simply calls + /// `visitSingularSInt64Field` once for each item in the array. + mutating func visitRepeatedSInt64Field(value: [Int64], fieldNumber: Int) throws + + // Called for each non-packed repeated fixed32 field. + /// The method is called once with the complete array of values for + /// the field. + /// + /// A default implementation is provided that simply calls + /// `visitSingularFixed32Field` once for each item in the array. + mutating func visitRepeatedFixed32Field(value: [UInt32], fieldNumber: Int) throws + + // Called for each non-packed repeated fixed64 field. + /// The method is called once with the complete array of values for + /// the field. + /// + /// A default implementation is provided that simply calls + /// `visitSingularFixed64Field` once for each item in the array. + mutating func visitRepeatedFixed64Field(value: [UInt64], fieldNumber: Int) throws + + // Called for each non-packed repeated sfixed32 field. + /// The method is called once with the complete array of values for + /// the field. + /// + /// A default implementation is provided that simply calls + /// `visitSingularSFixed32Field` once for each item in the array. + mutating func visitRepeatedSFixed32Field(value: [Int32], fieldNumber: Int) throws + + // Called for each non-packed repeated sfixed64 field. + /// The method is called once with the complete array of values for + /// the field. + /// + /// A default implementation is provided that simply calls + /// `visitSingularSFixed64Field` once for each item in the array. + mutating func visitRepeatedSFixed64Field(value: [Int64], fieldNumber: Int) throws + + // Called for each non-packed repeated bool field. + /// The method is called once with the complete array of values for + /// the field. + /// + /// A default implementation is provided that simply calls + /// `visitSingularBoolField` once for each item in the array. + mutating func visitRepeatedBoolField(value: [Bool], fieldNumber: Int) throws + + // Called for each non-packed repeated string field. + /// The method is called once with the complete array of values for + /// the field. + /// + /// A default implementation is provided that simply calls + /// `visitSingularStringField` once for each item in the array. + mutating func visitRepeatedStringField(value: [String], fieldNumber: Int) throws + + // Called for each non-packed repeated bytes field. + /// The method is called once with the complete array of values for + /// the field. + /// + /// A default implementation is provided that simply calls + /// `visitSingularBytesField` once for each item in the array. + mutating func visitRepeatedBytesField(value: [Data], fieldNumber: Int) throws + + /// Called for each repeated, unpacked enum field. + /// The method is called once with the complete array of values for + /// the field. + /// + /// A default implementation is provided that simply calls + /// `visitSingularEnumField` once for each item in the array. + mutating func visitRepeatedEnumField(value: [E], fieldNumber: Int) throws + + /// Called for each repeated nested message field. The method is called once + /// with the complete array of values for the field. + /// + /// A default implementation is provided that simply calls + /// `visitSingularMessageField` once for each item in the array. + mutating func visitRepeatedMessageField(value: [M], + fieldNumber: Int) throws + + /// Called for each repeated proto2 group field. + /// + /// A default implementation is provided that simply calls + /// `visitSingularGroupField` once for each item in the array. + mutating func visitRepeatedGroupField(value: [G], fieldNumber: Int) throws + + // Called for each packed, repeated float field. + /// + /// This is called once with the complete array of values for + /// the field. + /// + /// There is a default implementation that forwards to the non-packed + /// function. + mutating func visitPackedFloatField(value: [Float], fieldNumber: Int) throws + + // Called for each packed, repeated double field. + /// + /// This is called once with the complete array of values for + /// the field. + /// + /// There is a default implementation that forwards to the non-packed + /// function. + mutating func visitPackedDoubleField(value: [Double], fieldNumber: Int) throws + + // Called for each packed, repeated int32 field. + /// + /// This is called once with the complete array of values for + /// the field. + /// + /// There is a default implementation that forwards to the non-packed + /// function. + mutating func visitPackedInt32Field(value: [Int32], fieldNumber: Int) throws + + // Called for each packed, repeated int64 field. + /// + /// This is called once with the complete array of values for + /// the field. + /// + /// There is a default implementation that forwards to the non-packed + /// function. + mutating func visitPackedInt64Field(value: [Int64], fieldNumber: Int) throws + + // Called for each packed, repeated uint32 field. + /// + /// This is called once with the complete array of values for + /// the field. + /// + /// There is a default implementation that forwards to the non-packed + /// function. + mutating func visitPackedUInt32Field(value: [UInt32], fieldNumber: Int) throws + + // Called for each packed, repeated uint64 field. + /// + /// This is called once with the complete array of values for + /// the field. + /// + /// There is a default implementation that forwards to the non-packed + /// function. + mutating func visitPackedUInt64Field(value: [UInt64], fieldNumber: Int) throws + + // Called for each packed, repeated sint32 field. + /// + /// This is called once with the complete array of values for + /// the field. + /// + /// There is a default implementation that forwards to the non-packed + /// function. + mutating func visitPackedSInt32Field(value: [Int32], fieldNumber: Int) throws + + // Called for each packed, repeated sint64 field. + /// + /// This is called once with the complete array of values for + /// the field. + /// + /// There is a default implementation that forwards to the non-packed + /// function. + mutating func visitPackedSInt64Field(value: [Int64], fieldNumber: Int) throws + + // Called for each packed, repeated fixed32 field. + /// + /// This is called once with the complete array of values for + /// the field. + /// + /// There is a default implementation that forwards to the non-packed + /// function. + mutating func visitPackedFixed32Field(value: [UInt32], fieldNumber: Int) throws + + // Called for each packed, repeated fixed64 field. + /// + /// This is called once with the complete array of values for + /// the field. + /// + /// There is a default implementation that forwards to the non-packed + /// function. + mutating func visitPackedFixed64Field(value: [UInt64], fieldNumber: Int) throws + + // Called for each packed, repeated sfixed32 field. + /// + /// This is called once with the complete array of values for + /// the field. + /// + /// There is a default implementation that forwards to the non-packed + /// function. + mutating func visitPackedSFixed32Field(value: [Int32], fieldNumber: Int) throws + + // Called for each packed, repeated sfixed64 field. + /// + /// This is called once with the complete array of values for + /// the field. + /// + /// There is a default implementation that forwards to the non-packed + /// function. + mutating func visitPackedSFixed64Field(value: [Int64], fieldNumber: Int) throws + + // Called for each packed, repeated bool field. + /// + /// This is called once with the complete array of values for + /// the field. + /// + /// There is a default implementation that forwards to the non-packed + /// function. + mutating func visitPackedBoolField(value: [Bool], fieldNumber: Int) throws + + /// Called for each repeated, packed enum field. + /// The method is called once with the complete array of values for + /// the field. + /// + /// A default implementation is provided that simply forwards to + /// `visitRepeatedEnumField`. Implementors who need to handle packed fields + /// differently than unpacked fields can override this and provide distinct + /// implementations. + mutating func visitPackedEnumField(value: [E], fieldNumber: Int) throws + + /// Called for each map field with primitive values. The method is + /// called once with the complete dictionary of keys/values for the + /// field. + /// + /// There is no default implementation. This must be implemented. + mutating func visitMapField( + fieldType: _ProtobufMap.Type, + value: _ProtobufMap.BaseType, + fieldNumber: Int) throws + + /// Called for each map field with enum values. The method is called + /// once with the complete dictionary of keys/values for the field. + /// + /// There is no default implementation. This must be implemented. + mutating func visitMapField( + fieldType: _ProtobufEnumMap.Type, + value: _ProtobufEnumMap.BaseType, + fieldNumber: Int) throws where ValueType.RawValue == Int + + /// Called for each map field with message values. The method is + /// called once with the complete dictionary of keys/values for the + /// field. + /// + /// There is no default implementation. This must be implemented. + mutating func visitMapField( + fieldType: _ProtobufMessageMap.Type, + value: _ProtobufMessageMap.BaseType, + fieldNumber: Int) throws + + /// Called for each extension range. + mutating func visitExtensionFields(fields: ExtensionFieldValueSet, start: Int, end: Int) throws + + /// Called for each extension range. + mutating func visitExtensionFieldsAsMessageSet( + fields: ExtensionFieldValueSet, + start: Int, + end: Int) throws + + /// Called with the raw bytes that represent any unknown fields. + mutating func visitUnknown(bytes: Data) throws +} + +/// Forwarding default implementations of some visitor methods, for convenience. +extension Visitor { + + // Default definitions of numeric serializations. + // + // The 32-bit versions widen and delegate to 64-bit versions. + // The specialized integer codings delegate to standard Int/UInt. + // + // These "just work" for Hash and Text formats. Most of these work + // for JSON (32-bit integers are overridden to suppress quoting), + // and a few even work for Protobuf Binary (thanks to varint coding + // which erases the size difference between 32-bit and 64-bit ints). + + public mutating func visitSingularFloatField(value: Float, fieldNumber: Int) throws { + try visitSingularDoubleField(value: Double(value), fieldNumber: fieldNumber) + } + public mutating func visitSingularInt32Field(value: Int32, fieldNumber: Int) throws { + try visitSingularInt64Field(value: Int64(value), fieldNumber: fieldNumber) + } + public mutating func visitSingularUInt32Field(value: UInt32, fieldNumber: Int) throws { + try visitSingularUInt64Field(value: UInt64(value), fieldNumber: fieldNumber) + } + public mutating func visitSingularSInt32Field(value: Int32, fieldNumber: Int) throws { + try visitSingularInt32Field(value: value, fieldNumber: fieldNumber) + } + public mutating func visitSingularSInt64Field(value: Int64, fieldNumber: Int) throws { + try visitSingularInt64Field(value: value, fieldNumber: fieldNumber) + } + public mutating func visitSingularFixed32Field(value: UInt32, fieldNumber: Int) throws { + try visitSingularUInt32Field(value: value, fieldNumber: fieldNumber) + } + public mutating func visitSingularFixed64Field(value: UInt64, fieldNumber: Int) throws { + try visitSingularUInt64Field(value: value, fieldNumber: fieldNumber) + } + public mutating func visitSingularSFixed32Field(value: Int32, fieldNumber: Int) throws { + try visitSingularInt32Field(value: value, fieldNumber: fieldNumber) + } + public mutating func visitSingularSFixed64Field(value: Int64, fieldNumber: Int) throws { + try visitSingularInt64Field(value: value, fieldNumber: fieldNumber) + } + + // Default definitions of repeated serializations that just iterate and + // invoke the singular encoding. These "just work" for Protobuf Binary (encoder + // and size visitor), Protobuf Text, and Hash visitors. JSON format stores + // repeated values differently from singular, so overrides these. + + public mutating func visitRepeatedFloatField(value: [Float], fieldNumber: Int) throws { + assert(!value.isEmpty) + for v in value { + try visitSingularFloatField(value: v, fieldNumber: fieldNumber) + } + } + + public mutating func visitRepeatedDoubleField(value: [Double], fieldNumber: Int) throws { + assert(!value.isEmpty) + for v in value { + try visitSingularDoubleField(value: v, fieldNumber: fieldNumber) + } + } + + public mutating func visitRepeatedInt32Field(value: [Int32], fieldNumber: Int) throws { + assert(!value.isEmpty) + for v in value { + try visitSingularInt32Field(value: v, fieldNumber: fieldNumber) + } + } + + public mutating func visitRepeatedInt64Field(value: [Int64], fieldNumber: Int) throws { + assert(!value.isEmpty) + for v in value { + try visitSingularInt64Field(value: v, fieldNumber: fieldNumber) + } + } + + public mutating func visitRepeatedUInt32Field(value: [UInt32], fieldNumber: Int) throws { + assert(!value.isEmpty) + for v in value { + try visitSingularUInt32Field(value: v, fieldNumber: fieldNumber) + } + } + + public mutating func visitRepeatedUInt64Field(value: [UInt64], fieldNumber: Int) throws { + assert(!value.isEmpty) + for v in value { + try visitSingularUInt64Field(value: v, fieldNumber: fieldNumber) + } + } + + public mutating func visitRepeatedSInt32Field(value: [Int32], fieldNumber: Int) throws { + assert(!value.isEmpty) + for v in value { + try visitSingularSInt32Field(value: v, fieldNumber: fieldNumber) + } + } + + public mutating func visitRepeatedSInt64Field(value: [Int64], fieldNumber: Int) throws { + assert(!value.isEmpty) + for v in value { + try visitSingularSInt64Field(value: v, fieldNumber: fieldNumber) + } + } + + public mutating func visitRepeatedFixed32Field(value: [UInt32], fieldNumber: Int) throws { + assert(!value.isEmpty) + for v in value { + try visitSingularFixed32Field(value: v, fieldNumber: fieldNumber) + } + } + + public mutating func visitRepeatedFixed64Field(value: [UInt64], fieldNumber: Int) throws { + assert(!value.isEmpty) + for v in value { + try visitSingularFixed64Field(value: v, fieldNumber: fieldNumber) + } + } + + public mutating func visitRepeatedSFixed32Field(value: [Int32], fieldNumber: Int) throws { + assert(!value.isEmpty) + for v in value { + try visitSingularSFixed32Field(value: v, fieldNumber: fieldNumber) + } + } + + public mutating func visitRepeatedSFixed64Field(value: [Int64], fieldNumber: Int) throws { + assert(!value.isEmpty) + for v in value { + try visitSingularSFixed64Field(value: v, fieldNumber: fieldNumber) + } + } + + public mutating func visitRepeatedBoolField(value: [Bool], fieldNumber: Int) throws { + assert(!value.isEmpty) + for v in value { + try visitSingularBoolField(value: v, fieldNumber: fieldNumber) + } + } + + public mutating func visitRepeatedStringField(value: [String], fieldNumber: Int) throws { + assert(!value.isEmpty) + for v in value { + try visitSingularStringField(value: v, fieldNumber: fieldNumber) + } + } + + public mutating func visitRepeatedBytesField(value: [Data], fieldNumber: Int) throws { + assert(!value.isEmpty) + for v in value { + try visitSingularBytesField(value: v, fieldNumber: fieldNumber) + } + } + + public mutating func visitRepeatedEnumField(value: [E], fieldNumber: Int) throws { + assert(!value.isEmpty) + for v in value { + try visitSingularEnumField(value: v, fieldNumber: fieldNumber) + } + } + + public mutating func visitRepeatedMessageField(value: [M], fieldNumber: Int) throws { + assert(!value.isEmpty) + for v in value { + try visitSingularMessageField(value: v, fieldNumber: fieldNumber) + } + } + + public mutating func visitRepeatedGroupField(value: [G], fieldNumber: Int) throws { + assert(!value.isEmpty) + for v in value { + try visitSingularGroupField(value: v, fieldNumber: fieldNumber) + } + } + + // Default definitions of packed serialization just defer to the + // repeated implementation. This works for Hash and JSON visitors + // (which do not distinguish packed vs. non-packed) but are + // overridden by Protobuf Binary and Text. + + public mutating func visitPackedFloatField(value: [Float], fieldNumber: Int) throws { + assert(!value.isEmpty) + try visitRepeatedFloatField(value: value, fieldNumber: fieldNumber) + } + + public mutating func visitPackedDoubleField(value: [Double], fieldNumber: Int) throws { + assert(!value.isEmpty) + try visitRepeatedDoubleField(value: value, fieldNumber: fieldNumber) + } + + public mutating func visitPackedInt32Field(value: [Int32], fieldNumber: Int) throws { + assert(!value.isEmpty) + try visitRepeatedInt32Field(value: value, fieldNumber: fieldNumber) + } + + public mutating func visitPackedInt64Field(value: [Int64], fieldNumber: Int) throws { + assert(!value.isEmpty) + try visitRepeatedInt64Field(value: value, fieldNumber: fieldNumber) + } + + public mutating func visitPackedUInt32Field(value: [UInt32], fieldNumber: Int) throws { + assert(!value.isEmpty) + try visitRepeatedUInt32Field(value: value, fieldNumber: fieldNumber) + } + + public mutating func visitPackedUInt64Field(value: [UInt64], fieldNumber: Int) throws { + assert(!value.isEmpty) + try visitRepeatedUInt64Field(value: value, fieldNumber: fieldNumber) + } + + public mutating func visitPackedSInt32Field(value: [Int32], fieldNumber: Int) throws { + assert(!value.isEmpty) + try visitPackedInt32Field(value: value, fieldNumber: fieldNumber) + } + + public mutating func visitPackedSInt64Field(value: [Int64], fieldNumber: Int) throws { + assert(!value.isEmpty) + try visitPackedInt64Field(value: value, fieldNumber: fieldNumber) + } + + public mutating func visitPackedFixed32Field(value: [UInt32], fieldNumber: Int) throws { + assert(!value.isEmpty) + try visitPackedUInt32Field(value: value, fieldNumber: fieldNumber) + } + + public mutating func visitPackedFixed64Field(value: [UInt64], fieldNumber: Int) throws { + assert(!value.isEmpty) + try visitPackedUInt64Field(value: value, fieldNumber: fieldNumber) + } + + public mutating func visitPackedSFixed32Field(value: [Int32], fieldNumber: Int) throws { + assert(!value.isEmpty) + try visitPackedInt32Field(value: value, fieldNumber: fieldNumber) + } + + public mutating func visitPackedSFixed64Field(value: [Int64], fieldNumber: Int) throws { + assert(!value.isEmpty) + try visitPackedInt64Field(value: value, fieldNumber: fieldNumber) + } + + public mutating func visitPackedBoolField(value: [Bool], fieldNumber: Int) throws { + assert(!value.isEmpty) + try visitRepeatedBoolField(value: value, fieldNumber: fieldNumber) + } + + public mutating func visitPackedEnumField(value: [E], + fieldNumber: Int) throws { + assert(!value.isEmpty) + try visitRepeatedEnumField(value: value, fieldNumber: fieldNumber) + } + + // Default handling for Groups is to treat them just like messages. + // This works for Text and Hash, but is overridden by Protobuf Binary + // format (which has a different encoding for groups) and JSON + // (which explicitly ignores all groups). + + public mutating func visitSingularGroupField(value: G, + fieldNumber: Int) throws { + try visitSingularMessageField(value: value, fieldNumber: fieldNumber) + } + + // Default handling of Extensions as a MessageSet to handing them just + // as plain extensions. Formats that what custom behavior can override + // it. + + public mutating func visitExtensionFieldsAsMessageSet( + fields: ExtensionFieldValueSet, + start: Int, + end: Int) throws { + try visitExtensionFields(fields: fields, start: start, end: end) + } + + // Default handling for Extensions is to forward the traverse to + // the ExtensionFieldValueSet. Formats that don't care about extensions + // can override to avoid it. + + /// Called for each extension range. + public mutating func visitExtensionFields(fields: ExtensionFieldValueSet, start: Int, end: Int) throws { + try fields.traverse(visitor: &self, start: start, end: end) + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/WireFormat.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/WireFormat.swift new file mode 100644 index 0000000..ea28c40 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/WireFormat.swift @@ -0,0 +1,70 @@ +// Sources/SwiftProtobuf/WireFormat.swift - Describes proto wire formats +// +// Copyright (c) 2014 - 2016 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Types related to binary wire formats of encoded values. +/// +// ----------------------------------------------------------------------------- + +/// Denotes the wire format by which a value is encoded in binary form. +internal enum WireFormat: UInt8 { + case varint = 0 + case fixed64 = 1 + case lengthDelimited = 2 + case startGroup = 3 + case endGroup = 4 + case fixed32 = 5 +} + +extension WireFormat { + /// Information about the "MessageSet" format. Used when a Message has + /// the message_set_wire_format option enabled. + /// + /// Writing in MessageSet form means instead of writing the Extesions + /// normally as a simple fields, each gets written wrapped in a group: + /// repeated group Item = 1 { + /// required int32 type_id = 2; + /// required bytes message = 3; + /// } + /// Where the field number is the type_id, and the message is serilaized + /// into the bytes. + /// + /// The handling of unknown fields is ill defined. In proto1, they were + /// dropped. In the C++ for proto2, since it stores them in the unknowns + /// storage, if preserves any that are length delimited data (since that's + /// how the message also goes out). While the C++ is parsing, where the + /// unknowns fall in the flow of the group, sorta decides what happens. + /// Since it is ill defined, currently SwiftProtobuf will reflect out + /// anything set in the unknownStorage. During parsing, unknowns on the + /// message are preserved, but unknowns within the group are dropped (like + /// map items). Any extension in the MessageSet that isn't in the Regisry + /// being used at parse time will remain in a group and go into the + /// Messages's unknown fields (this way it reflects back out correctly). + internal enum MessageSet { + + enum FieldNumbers { + static let item = 1; + static let typeId = 2; + static let message = 3; + } + + enum Tags { + static let itemStart = FieldTag(fieldNumber: FieldNumbers.item, wireFormat: .startGroup) + static let itemEnd = FieldTag(fieldNumber: FieldNumbers.item, wireFormat: .endGroup) + static let typeId = FieldTag(fieldNumber: FieldNumbers.typeId, wireFormat: .varint) + static let message = FieldTag(fieldNumber: FieldNumbers.message, wireFormat: .lengthDelimited) + } + + // The size of all the tags needed to write out an Extension in MessageSet format. + static let itemTagsEncodedSize = + Tags.itemStart.encodedSize + Tags.itemEnd.encodedSize + + Tags.typeId.encodedSize + + Tags.message.encodedSize + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/ZigZag.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/ZigZag.swift new file mode 100644 index 0000000..f838ac6 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/ZigZag.swift @@ -0,0 +1,66 @@ +// Sources/SwiftProtobuf/ZigZag.swift - ZigZag encoding/decoding helpers +// +// Copyright (c) 2014 - 2016 Apple Inc. and the project authors +// Licensed under Apache License v2.0 with Runtime Library Exception +// +// See LICENSE.txt for license information: +// https://github.com/apple/swift-protobuf/blob/master/LICENSE.txt +// +// ----------------------------------------------------------------------------- +/// +/// Helper functions to ZigZag encode and decode signed integers. +/// +// ----------------------------------------------------------------------------- + + +/// Contains helper methods to ZigZag encode and decode signed integers. +internal enum ZigZag { + + /// Return a 32-bit ZigZag-encoded value. + /// + /// ZigZag encodes signed integers into values that can be efficiently encoded with varint. + /// (Otherwise, negative values must be sign-extended to 64 bits to be varint encoded, always + /// taking 10 bytes on the wire.) + /// + /// - Parameter value: A signed 32-bit integer. + /// - Returns: An unsigned 32-bit integer representing the ZigZag-encoded value. + static func encoded(_ value: Int32) -> UInt32 { + return UInt32(bitPattern: (value << 1) ^ (value >> 31)) + } + + /// Return a 64-bit ZigZag-encoded value. + /// + /// ZigZag encodes signed integers into values that can be efficiently encoded with varint. + /// (Otherwise, negative values must be sign-extended to 64 bits to be varint encoded, always + /// taking 10 bytes on the wire.) + /// + /// - Parameter value: A signed 64-bit integer. + /// - Returns: An unsigned 64-bit integer representing the ZigZag-encoded value. + static func encoded(_ value: Int64) -> UInt64 { + return UInt64(bitPattern: (value << 1) ^ (value >> 63)) + } + + /// Return a 32-bit ZigZag-decoded value. + /// + /// ZigZag enocdes signed integers into values that can be efficiently encoded with varint. + /// (Otherwise, negative values must be sign-extended to 64 bits to be varint encoded, always + /// taking 10 bytes on the wire.) + /// + /// - Parameter value: An unsigned 32-bit ZagZag-encoded integer. + /// - Returns: The signed 32-bit decoded value. + static func decoded(_ value: UInt32) -> Int32 { + return Int32(value >> 1) ^ -Int32(value & 1) + } + + /// Return a 64-bit ZigZag-decoded value. + /// + /// ZigZag enocdes signed integers into values that can be efficiently encoded with varint. + /// (Otherwise, negative values must be sign-extended to 64 bits to be varint encoded, always + /// taking 10 bytes on the wire.) + /// + /// - Parameter value: An unsigned 64-bit ZigZag-encoded integer. + /// - Returns: The signed 64-bit decoded value. + static func decoded(_ value: UInt64) -> Int64 { + return Int64(value >> 1) ^ -Int64(value & 1) + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/any.pb.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/any.pb.swift new file mode 100644 index 0000000..f1e80c8 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/any.pb.swift @@ -0,0 +1,241 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: google/protobuf/any.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import Foundation + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +/// `Any` contains an arbitrary serialized protocol buffer message along with a +/// URL that describes the type of the serialized message. +/// +/// Protobuf library provides support to pack/unpack Any values in the form +/// of utility functions or additional generated methods of the Any type. +/// +/// Example 1: Pack and unpack a message in C++. +/// +/// Foo foo = ...; +/// Any any; +/// any.PackFrom(foo); +/// ... +/// if (any.UnpackTo(&foo)) { +/// ... +/// } +/// +/// Example 2: Pack and unpack a message in Java. +/// +/// Foo foo = ...; +/// Any any = Any.pack(foo); +/// ... +/// if (any.is(Foo.class)) { +/// foo = any.unpack(Foo.class); +/// } +/// +/// Example 3: Pack and unpack a message in Python. +/// +/// foo = Foo(...) +/// any = Any() +/// any.Pack(foo) +/// ... +/// if any.Is(Foo.DESCRIPTOR): +/// any.Unpack(foo) +/// ... +/// +/// Example 4: Pack and unpack a message in Go +/// +/// foo := &pb.Foo{...} +/// any, err := anypb.New(foo) +/// if err != nil { +/// ... +/// } +/// ... +/// foo := &pb.Foo{} +/// if err := any.UnmarshalTo(foo); err != nil { +/// ... +/// } +/// +/// The pack methods provided by protobuf library will by default use +/// 'type.googleapis.com/full.type.name' as the type URL and the unpack +/// methods only use the fully qualified type name after the last '/' +/// in the type URL, for example "foo.bar.com/x/y.z" will yield type +/// name "y.z". +/// +/// +/// JSON +/// ==== +/// The JSON representation of an `Any` value uses the regular +/// representation of the deserialized, embedded message, with an +/// additional field `@type` which contains the type URL. Example: +/// +/// package google.profile; +/// message Person { +/// string first_name = 1; +/// string last_name = 2; +/// } +/// +/// { +/// "@type": "type.googleapis.com/google.profile.Person", +/// "firstName": , +/// "lastName": +/// } +/// +/// If the embedded message type is well-known and has a custom JSON +/// representation, that representation will be embedded adding a field +/// `value` which holds the custom JSON in addition to the `@type` +/// field. Example (for message [google.protobuf.Duration][]): +/// +/// { +/// "@type": "type.googleapis.com/google.protobuf.Duration", +/// "value": "1.212s" +/// } +public struct Google_Protobuf_Any { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// A URL/resource name that uniquely identifies the type of the serialized + /// protocol buffer message. This string must contain at least + /// one "/" character. The last segment of the URL's path must represent + /// the fully qualified name of the type (as in + /// `path/google.protobuf.Duration`). The name should be in a canonical form + /// (e.g., leading "." is not accepted). + /// + /// In practice, teams usually precompile into the binary all types that they + /// expect it to use in the context of Any. However, for URLs which use the + /// scheme `http`, `https`, or no scheme, one can optionally set up a type + /// server that maps type URLs to message definitions as follows: + /// + /// * If no scheme is provided, `https` is assumed. + /// * An HTTP GET on the URL must yield a [google.protobuf.Type][] + /// value in binary format, or produce an error. + /// * Applications are allowed to cache lookup results based on the + /// URL, or have them precompiled into a binary to avoid any + /// lookup. Therefore, binary compatibility needs to be preserved + /// on changes to types. (Use versioned type names to manage + /// breaking changes.) + /// + /// Note: this functionality is not currently available in the official + /// protobuf release, and it is not used for type URLs beginning with + /// type.googleapis.com. + /// + /// Schemes other than `http`, `https` (or the empty scheme) might be + /// used with implementation specific semantics. + public var typeURL: String { + get {return _storage._typeURL} + set {_uniqueStorage()._typeURL = newValue} + } + + /// Must be a valid serialized protocol buffer of the above specified type. + public var value: Data { + get {return _storage._value} + set {_uniqueStorage()._value = newValue} + } + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + internal var _storage = _StorageClass.defaultInstance +} + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "google.protobuf" + +extension Google_Protobuf_Any: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".Any" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "type_url"), + 2: .same(proto: "value"), + ] + + typealias _StorageClass = AnyMessageStorage + + internal mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + + public mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &_storage._typeURL) }() + case 2: try { try decoder.decodeSingularBytesField(value: &_storage._value) }() + default: break + } + } + } + } + + public func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + try _storage.preTraverse() + if !_storage._typeURL.isEmpty { + try visitor.visitSingularStringField(value: _storage._typeURL, fieldNumber: 1) + } + if !_storage._value.isEmpty { + try visitor.visitSingularBytesField(value: _storage._value, fieldNumber: 2) + } + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_Any, rhs: Google_Protobuf_Any) -> Bool { + if lhs._storage !== rhs._storage { + let storagesAreEqual: Bool = lhs._storage.isEqualTo(other: rhs._storage) + if !storagesAreEqual {return false} + } + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/api.pb.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/api.pb.swift new file mode 100644 index 0000000..98fc8ee --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/api.pb.swift @@ -0,0 +1,424 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: google/protobuf/api.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import Foundation + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +/// Api is a light-weight descriptor for an API Interface. +/// +/// Interfaces are also described as "protocol buffer services" in some contexts, +/// such as by the "service" keyword in a .proto file, but they are different +/// from API Services, which represent a concrete implementation of an interface +/// as opposed to simply a description of methods and bindings. They are also +/// sometimes simply referred to as "APIs" in other contexts, such as the name of +/// this message itself. See https://cloud.google.com/apis/design/glossary for +/// detailed terminology. +public struct Google_Protobuf_Api { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The fully qualified name of this interface, including package name + /// followed by the interface's simple name. + public var name: String = String() + + /// The methods of this interface, in unspecified order. + public var methods: [Google_Protobuf_Method] = [] + + /// Any metadata attached to the interface. + public var options: [Google_Protobuf_Option] = [] + + /// A version string for this interface. If specified, must have the form + /// `major-version.minor-version`, as in `1.10`. If the minor version is + /// omitted, it defaults to zero. If the entire version field is empty, the + /// major version is derived from the package name, as outlined below. If the + /// field is not empty, the version in the package name will be verified to be + /// consistent with what is provided here. + /// + /// The versioning schema uses [semantic + /// versioning](http://semver.org) where the major version number + /// indicates a breaking change and the minor version an additive, + /// non-breaking change. Both version numbers are signals to users + /// what to expect from different versions, and should be carefully + /// chosen based on the product plan. + /// + /// The major version is also reflected in the package name of the + /// interface, which must end in `v`, as in + /// `google.feature.v1`. For major versions 0 and 1, the suffix can + /// be omitted. Zero major versions must only be used for + /// experimental, non-GA interfaces. + public var version: String = String() + + /// Source context for the protocol buffer service represented by this + /// message. + public var sourceContext: Google_Protobuf_SourceContext { + get {return _sourceContext ?? Google_Protobuf_SourceContext()} + set {_sourceContext = newValue} + } + /// Returns true if `sourceContext` has been explicitly set. + public var hasSourceContext: Bool {return self._sourceContext != nil} + /// Clears the value of `sourceContext`. Subsequent reads from it will return its default value. + public mutating func clearSourceContext() {self._sourceContext = nil} + + /// Included interfaces. See [Mixin][]. + public var mixins: [Google_Protobuf_Mixin] = [] + + /// The source syntax of the service. + public var syntax: Google_Protobuf_Syntax = .proto2 + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + fileprivate var _sourceContext: Google_Protobuf_SourceContext? = nil +} + +/// Method represents a method of an API interface. +public struct Google_Protobuf_Method { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The simple name of this method. + public var name: String = String() + + /// A URL of the input message type. + public var requestTypeURL: String = String() + + /// If true, the request is streamed. + public var requestStreaming: Bool = false + + /// The URL of the output message type. + public var responseTypeURL: String = String() + + /// If true, the response is streamed. + public var responseStreaming: Bool = false + + /// Any metadata attached to the method. + public var options: [Google_Protobuf_Option] = [] + + /// The source syntax of this method. + public var syntax: Google_Protobuf_Syntax = .proto2 + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + +/// Declares an API Interface to be included in this interface. The including +/// interface must redeclare all the methods from the included interface, but +/// documentation and options are inherited as follows: +/// +/// - If after comment and whitespace stripping, the documentation +/// string of the redeclared method is empty, it will be inherited +/// from the original method. +/// +/// - Each annotation belonging to the service config (http, +/// visibility) which is not set in the redeclared method will be +/// inherited. +/// +/// - If an http annotation is inherited, the path pattern will be +/// modified as follows. Any version prefix will be replaced by the +/// version of the including interface plus the [root][] path if +/// specified. +/// +/// Example of a simple mixin: +/// +/// package google.acl.v1; +/// service AccessControl { +/// // Get the underlying ACL object. +/// rpc GetAcl(GetAclRequest) returns (Acl) { +/// option (google.api.http).get = "/v1/{resource=**}:getAcl"; +/// } +/// } +/// +/// package google.storage.v2; +/// service Storage { +/// rpc GetAcl(GetAclRequest) returns (Acl); +/// +/// // Get a data record. +/// rpc GetData(GetDataRequest) returns (Data) { +/// option (google.api.http).get = "/v2/{resource=**}"; +/// } +/// } +/// +/// Example of a mixin configuration: +/// +/// apis: +/// - name: google.storage.v2.Storage +/// mixins: +/// - name: google.acl.v1.AccessControl +/// +/// The mixin construct implies that all methods in `AccessControl` are +/// also declared with same name and request/response types in +/// `Storage`. A documentation generator or annotation processor will +/// see the effective `Storage.GetAcl` method after inheriting +/// documentation and annotations as follows: +/// +/// service Storage { +/// // Get the underlying ACL object. +/// rpc GetAcl(GetAclRequest) returns (Acl) { +/// option (google.api.http).get = "/v2/{resource=**}:getAcl"; +/// } +/// ... +/// } +/// +/// Note how the version in the path pattern changed from `v1` to `v2`. +/// +/// If the `root` field in the mixin is specified, it should be a +/// relative path under which inherited HTTP paths are placed. Example: +/// +/// apis: +/// - name: google.storage.v2.Storage +/// mixins: +/// - name: google.acl.v1.AccessControl +/// root: acls +/// +/// This implies the following inherited HTTP annotation: +/// +/// service Storage { +/// // Get the underlying ACL object. +/// rpc GetAcl(GetAclRequest) returns (Acl) { +/// option (google.api.http).get = "/v2/acls/{resource=**}:getAcl"; +/// } +/// ... +/// } +public struct Google_Protobuf_Mixin { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The fully qualified name of the interface which is included. + public var name: String = String() + + /// If non-empty specifies a path under which inherited HTTP paths + /// are rooted. + public var root: String = String() + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "google.protobuf" + +extension Google_Protobuf_Api: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".Api" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "name"), + 2: .same(proto: "methods"), + 3: .same(proto: "options"), + 4: .same(proto: "version"), + 5: .standard(proto: "source_context"), + 6: .same(proto: "mixins"), + 7: .same(proto: "syntax"), + ] + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self.name) }() + case 2: try { try decoder.decodeRepeatedMessageField(value: &self.methods) }() + case 3: try { try decoder.decodeRepeatedMessageField(value: &self.options) }() + case 4: try { try decoder.decodeSingularStringField(value: &self.version) }() + case 5: try { try decoder.decodeSingularMessageField(value: &self._sourceContext) }() + case 6: try { try decoder.decodeRepeatedMessageField(value: &self.mixins) }() + case 7: try { try decoder.decodeSingularEnumField(value: &self.syntax) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.name.isEmpty { + try visitor.visitSingularStringField(value: self.name, fieldNumber: 1) + } + if !self.methods.isEmpty { + try visitor.visitRepeatedMessageField(value: self.methods, fieldNumber: 2) + } + if !self.options.isEmpty { + try visitor.visitRepeatedMessageField(value: self.options, fieldNumber: 3) + } + if !self.version.isEmpty { + try visitor.visitSingularStringField(value: self.version, fieldNumber: 4) + } + if let v = self._sourceContext { + try visitor.visitSingularMessageField(value: v, fieldNumber: 5) + } + if !self.mixins.isEmpty { + try visitor.visitRepeatedMessageField(value: self.mixins, fieldNumber: 6) + } + if self.syntax != .proto2 { + try visitor.visitSingularEnumField(value: self.syntax, fieldNumber: 7) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_Api, rhs: Google_Protobuf_Api) -> Bool { + if lhs.name != rhs.name {return false} + if lhs.methods != rhs.methods {return false} + if lhs.options != rhs.options {return false} + if lhs.version != rhs.version {return false} + if lhs._sourceContext != rhs._sourceContext {return false} + if lhs.mixins != rhs.mixins {return false} + if lhs.syntax != rhs.syntax {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Google_Protobuf_Method: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".Method" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "name"), + 2: .standard(proto: "request_type_url"), + 3: .standard(proto: "request_streaming"), + 4: .standard(proto: "response_type_url"), + 5: .standard(proto: "response_streaming"), + 6: .same(proto: "options"), + 7: .same(proto: "syntax"), + ] + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self.name) }() + case 2: try { try decoder.decodeSingularStringField(value: &self.requestTypeURL) }() + case 3: try { try decoder.decodeSingularBoolField(value: &self.requestStreaming) }() + case 4: try { try decoder.decodeSingularStringField(value: &self.responseTypeURL) }() + case 5: try { try decoder.decodeSingularBoolField(value: &self.responseStreaming) }() + case 6: try { try decoder.decodeRepeatedMessageField(value: &self.options) }() + case 7: try { try decoder.decodeSingularEnumField(value: &self.syntax) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.name.isEmpty { + try visitor.visitSingularStringField(value: self.name, fieldNumber: 1) + } + if !self.requestTypeURL.isEmpty { + try visitor.visitSingularStringField(value: self.requestTypeURL, fieldNumber: 2) + } + if self.requestStreaming != false { + try visitor.visitSingularBoolField(value: self.requestStreaming, fieldNumber: 3) + } + if !self.responseTypeURL.isEmpty { + try visitor.visitSingularStringField(value: self.responseTypeURL, fieldNumber: 4) + } + if self.responseStreaming != false { + try visitor.visitSingularBoolField(value: self.responseStreaming, fieldNumber: 5) + } + if !self.options.isEmpty { + try visitor.visitRepeatedMessageField(value: self.options, fieldNumber: 6) + } + if self.syntax != .proto2 { + try visitor.visitSingularEnumField(value: self.syntax, fieldNumber: 7) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_Method, rhs: Google_Protobuf_Method) -> Bool { + if lhs.name != rhs.name {return false} + if lhs.requestTypeURL != rhs.requestTypeURL {return false} + if lhs.requestStreaming != rhs.requestStreaming {return false} + if lhs.responseTypeURL != rhs.responseTypeURL {return false} + if lhs.responseStreaming != rhs.responseStreaming {return false} + if lhs.options != rhs.options {return false} + if lhs.syntax != rhs.syntax {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Google_Protobuf_Mixin: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".Mixin" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "name"), + 2: .same(proto: "root"), + ] + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self.name) }() + case 2: try { try decoder.decodeSingularStringField(value: &self.root) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.name.isEmpty { + try visitor.visitSingularStringField(value: self.name, fieldNumber: 1) + } + if !self.root.isEmpty { + try visitor.visitSingularStringField(value: self.root, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_Mixin, rhs: Google_Protobuf_Mixin) -> Bool { + if lhs.name != rhs.name {return false} + if lhs.root != rhs.root {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/descriptor.pb.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/descriptor.pb.swift new file mode 100644 index 0000000..a504aa4 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/descriptor.pb.swift @@ -0,0 +1,3836 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: google/protobuf/descriptor.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. +// +// The messages in this file describe the definitions found in .proto files. +// A valid .proto file can be translated directly to a FileDescriptorProto +// without any other information (e.g. without reading its imports). + +import Foundation + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +/// The protocol compiler can output a FileDescriptorSet containing the .proto +/// files it parses. +public struct Google_Protobuf_FileDescriptorSet { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + public var file: [Google_Protobuf_FileDescriptorProto] = [] + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + +/// Describes a complete .proto file. +public struct Google_Protobuf_FileDescriptorProto { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// file name, relative to root of source tree + public var name: String { + get {return _name ?? String()} + set {_name = newValue} + } + /// Returns true if `name` has been explicitly set. + public var hasName: Bool {return self._name != nil} + /// Clears the value of `name`. Subsequent reads from it will return its default value. + public mutating func clearName() {self._name = nil} + + /// e.g. "foo", "foo.bar", etc. + public var package: String { + get {return _package ?? String()} + set {_package = newValue} + } + /// Returns true if `package` has been explicitly set. + public var hasPackage: Bool {return self._package != nil} + /// Clears the value of `package`. Subsequent reads from it will return its default value. + public mutating func clearPackage() {self._package = nil} + + /// Names of files imported by this file. + public var dependency: [String] = [] + + /// Indexes of the public imported files in the dependency list above. + public var publicDependency: [Int32] = [] + + /// Indexes of the weak imported files in the dependency list. + /// For Google-internal migration only. Do not use. + public var weakDependency: [Int32] = [] + + /// All top-level definitions in this file. + public var messageType: [Google_Protobuf_DescriptorProto] = [] + + public var enumType: [Google_Protobuf_EnumDescriptorProto] = [] + + public var service: [Google_Protobuf_ServiceDescriptorProto] = [] + + public var `extension`: [Google_Protobuf_FieldDescriptorProto] = [] + + public var options: Google_Protobuf_FileOptions { + get {return _options ?? Google_Protobuf_FileOptions()} + set {_options = newValue} + } + /// Returns true if `options` has been explicitly set. + public var hasOptions: Bool {return self._options != nil} + /// Clears the value of `options`. Subsequent reads from it will return its default value. + public mutating func clearOptions() {self._options = nil} + + /// This field contains optional information about the original source code. + /// You may safely remove this entire field without harming runtime + /// functionality of the descriptors -- the information is needed only by + /// development tools. + public var sourceCodeInfo: Google_Protobuf_SourceCodeInfo { + get {return _sourceCodeInfo ?? Google_Protobuf_SourceCodeInfo()} + set {_sourceCodeInfo = newValue} + } + /// Returns true if `sourceCodeInfo` has been explicitly set. + public var hasSourceCodeInfo: Bool {return self._sourceCodeInfo != nil} + /// Clears the value of `sourceCodeInfo`. Subsequent reads from it will return its default value. + public mutating func clearSourceCodeInfo() {self._sourceCodeInfo = nil} + + /// The syntax of the proto file. + /// The supported values are "proto2" and "proto3". + public var syntax: String { + get {return _syntax ?? String()} + set {_syntax = newValue} + } + /// Returns true if `syntax` has been explicitly set. + public var hasSyntax: Bool {return self._syntax != nil} + /// Clears the value of `syntax`. Subsequent reads from it will return its default value. + public mutating func clearSyntax() {self._syntax = nil} + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + fileprivate var _name: String? = nil + fileprivate var _package: String? = nil + fileprivate var _options: Google_Protobuf_FileOptions? = nil + fileprivate var _sourceCodeInfo: Google_Protobuf_SourceCodeInfo? = nil + fileprivate var _syntax: String? = nil +} + +/// Describes a message type. +public struct Google_Protobuf_DescriptorProto { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + public var name: String { + get {return _name ?? String()} + set {_name = newValue} + } + /// Returns true if `name` has been explicitly set. + public var hasName: Bool {return self._name != nil} + /// Clears the value of `name`. Subsequent reads from it will return its default value. + public mutating func clearName() {self._name = nil} + + public var field: [Google_Protobuf_FieldDescriptorProto] = [] + + public var `extension`: [Google_Protobuf_FieldDescriptorProto] = [] + + public var nestedType: [Google_Protobuf_DescriptorProto] = [] + + public var enumType: [Google_Protobuf_EnumDescriptorProto] = [] + + public var extensionRange: [Google_Protobuf_DescriptorProto.ExtensionRange] = [] + + public var oneofDecl: [Google_Protobuf_OneofDescriptorProto] = [] + + public var options: Google_Protobuf_MessageOptions { + get {return _options ?? Google_Protobuf_MessageOptions()} + set {_options = newValue} + } + /// Returns true if `options` has been explicitly set. + public var hasOptions: Bool {return self._options != nil} + /// Clears the value of `options`. Subsequent reads from it will return its default value. + public mutating func clearOptions() {self._options = nil} + + public var reservedRange: [Google_Protobuf_DescriptorProto.ReservedRange] = [] + + /// Reserved field names, which may not be used by fields in the same message. + /// A given name may only be reserved once. + public var reservedName: [String] = [] + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public struct ExtensionRange { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Inclusive. + public var start: Int32 { + get {return _start ?? 0} + set {_start = newValue} + } + /// Returns true if `start` has been explicitly set. + public var hasStart: Bool {return self._start != nil} + /// Clears the value of `start`. Subsequent reads from it will return its default value. + public mutating func clearStart() {self._start = nil} + + /// Exclusive. + public var end: Int32 { + get {return _end ?? 0} + set {_end = newValue} + } + /// Returns true if `end` has been explicitly set. + public var hasEnd: Bool {return self._end != nil} + /// Clears the value of `end`. Subsequent reads from it will return its default value. + public mutating func clearEnd() {self._end = nil} + + public var options: Google_Protobuf_ExtensionRangeOptions { + get {return _options ?? Google_Protobuf_ExtensionRangeOptions()} + set {_options = newValue} + } + /// Returns true if `options` has been explicitly set. + public var hasOptions: Bool {return self._options != nil} + /// Clears the value of `options`. Subsequent reads from it will return its default value. + public mutating func clearOptions() {self._options = nil} + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + fileprivate var _start: Int32? = nil + fileprivate var _end: Int32? = nil + fileprivate var _options: Google_Protobuf_ExtensionRangeOptions? = nil + } + + /// Range of reserved tag numbers. Reserved tag numbers may not be used by + /// fields or extension ranges in the same message. Reserved ranges may + /// not overlap. + public struct ReservedRange { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Inclusive. + public var start: Int32 { + get {return _start ?? 0} + set {_start = newValue} + } + /// Returns true if `start` has been explicitly set. + public var hasStart: Bool {return self._start != nil} + /// Clears the value of `start`. Subsequent reads from it will return its default value. + public mutating func clearStart() {self._start = nil} + + /// Exclusive. + public var end: Int32 { + get {return _end ?? 0} + set {_end = newValue} + } + /// Returns true if `end` has been explicitly set. + public var hasEnd: Bool {return self._end != nil} + /// Clears the value of `end`. Subsequent reads from it will return its default value. + public mutating func clearEnd() {self._end = nil} + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + fileprivate var _start: Int32? = nil + fileprivate var _end: Int32? = nil + } + + public init() {} + + fileprivate var _name: String? = nil + fileprivate var _options: Google_Protobuf_MessageOptions? = nil +} + +public struct Google_Protobuf_ExtensionRangeOptions: SwiftProtobuf.ExtensibleMessage { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The parser stores options it doesn't recognize here. See above. + public var uninterpretedOption: [Google_Protobuf_UninterpretedOption] = [] + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + public var _protobuf_extensionFieldValues = SwiftProtobuf.ExtensionFieldValueSet() +} + +/// Describes a field within a message. +public struct Google_Protobuf_FieldDescriptorProto { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + public var name: String { + get {return _storage._name ?? String()} + set {_uniqueStorage()._name = newValue} + } + /// Returns true if `name` has been explicitly set. + public var hasName: Bool {return _storage._name != nil} + /// Clears the value of `name`. Subsequent reads from it will return its default value. + public mutating func clearName() {_uniqueStorage()._name = nil} + + public var number: Int32 { + get {return _storage._number ?? 0} + set {_uniqueStorage()._number = newValue} + } + /// Returns true if `number` has been explicitly set. + public var hasNumber: Bool {return _storage._number != nil} + /// Clears the value of `number`. Subsequent reads from it will return its default value. + public mutating func clearNumber() {_uniqueStorage()._number = nil} + + public var label: Google_Protobuf_FieldDescriptorProto.Label { + get {return _storage._label ?? .optional} + set {_uniqueStorage()._label = newValue} + } + /// Returns true if `label` has been explicitly set. + public var hasLabel: Bool {return _storage._label != nil} + /// Clears the value of `label`. Subsequent reads from it will return its default value. + public mutating func clearLabel() {_uniqueStorage()._label = nil} + + /// If type_name is set, this need not be set. If both this and type_name + /// are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. + public var type: Google_Protobuf_FieldDescriptorProto.TypeEnum { + get {return _storage._type ?? .double} + set {_uniqueStorage()._type = newValue} + } + /// Returns true if `type` has been explicitly set. + public var hasType: Bool {return _storage._type != nil} + /// Clears the value of `type`. Subsequent reads from it will return its default value. + public mutating func clearType() {_uniqueStorage()._type = nil} + + /// For message and enum types, this is the name of the type. If the name + /// starts with a '.', it is fully-qualified. Otherwise, C++-like scoping + /// rules are used to find the type (i.e. first the nested types within this + /// message are searched, then within the parent, on up to the root + /// namespace). + public var typeName: String { + get {return _storage._typeName ?? String()} + set {_uniqueStorage()._typeName = newValue} + } + /// Returns true if `typeName` has been explicitly set. + public var hasTypeName: Bool {return _storage._typeName != nil} + /// Clears the value of `typeName`. Subsequent reads from it will return its default value. + public mutating func clearTypeName() {_uniqueStorage()._typeName = nil} + + /// For extensions, this is the name of the type being extended. It is + /// resolved in the same manner as type_name. + public var extendee: String { + get {return _storage._extendee ?? String()} + set {_uniqueStorage()._extendee = newValue} + } + /// Returns true if `extendee` has been explicitly set. + public var hasExtendee: Bool {return _storage._extendee != nil} + /// Clears the value of `extendee`. Subsequent reads from it will return its default value. + public mutating func clearExtendee() {_uniqueStorage()._extendee = nil} + + /// For numeric types, contains the original text representation of the value. + /// For booleans, "true" or "false". + /// For strings, contains the default text contents (not escaped in any way). + /// For bytes, contains the C escaped value. All bytes >= 128 are escaped. + /// TODO(kenton): Base-64 encode? + public var defaultValue: String { + get {return _storage._defaultValue ?? String()} + set {_uniqueStorage()._defaultValue = newValue} + } + /// Returns true if `defaultValue` has been explicitly set. + public var hasDefaultValue: Bool {return _storage._defaultValue != nil} + /// Clears the value of `defaultValue`. Subsequent reads from it will return its default value. + public mutating func clearDefaultValue() {_uniqueStorage()._defaultValue = nil} + + /// If set, gives the index of a oneof in the containing type's oneof_decl + /// list. This field is a member of that oneof. + public var oneofIndex: Int32 { + get {return _storage._oneofIndex ?? 0} + set {_uniqueStorage()._oneofIndex = newValue} + } + /// Returns true if `oneofIndex` has been explicitly set. + public var hasOneofIndex: Bool {return _storage._oneofIndex != nil} + /// Clears the value of `oneofIndex`. Subsequent reads from it will return its default value. + public mutating func clearOneofIndex() {_uniqueStorage()._oneofIndex = nil} + + /// JSON name of this field. The value is set by protocol compiler. If the + /// user has set a "json_name" option on this field, that option's value + /// will be used. Otherwise, it's deduced from the field's name by converting + /// it to camelCase. + public var jsonName: String { + get {return _storage._jsonName ?? String()} + set {_uniqueStorage()._jsonName = newValue} + } + /// Returns true if `jsonName` has been explicitly set. + public var hasJsonName: Bool {return _storage._jsonName != nil} + /// Clears the value of `jsonName`. Subsequent reads from it will return its default value. + public mutating func clearJsonName() {_uniqueStorage()._jsonName = nil} + + public var options: Google_Protobuf_FieldOptions { + get {return _storage._options ?? Google_Protobuf_FieldOptions()} + set {_uniqueStorage()._options = newValue} + } + /// Returns true if `options` has been explicitly set. + public var hasOptions: Bool {return _storage._options != nil} + /// Clears the value of `options`. Subsequent reads from it will return its default value. + public mutating func clearOptions() {_uniqueStorage()._options = nil} + + /// If true, this is a proto3 "optional". When a proto3 field is optional, it + /// tracks presence regardless of field type. + /// + /// When proto3_optional is true, this field must be belong to a oneof to + /// signal to old proto3 clients that presence is tracked for this field. This + /// oneof is known as a "synthetic" oneof, and this field must be its sole + /// member (each proto3 optional field gets its own synthetic oneof). Synthetic + /// oneofs exist in the descriptor only, and do not generate any API. Synthetic + /// oneofs must be ordered after all "real" oneofs. + /// + /// For message fields, proto3_optional doesn't create any semantic change, + /// since non-repeated message fields always track presence. However it still + /// indicates the semantic detail of whether the user wrote "optional" or not. + /// This can be useful for round-tripping the .proto file. For consistency we + /// give message fields a synthetic oneof also, even though it is not required + /// to track presence. This is especially important because the parser can't + /// tell if a field is a message or an enum, so it must always create a + /// synthetic oneof. + /// + /// Proto2 optional fields do not set this flag, because they already indicate + /// optional with `LABEL_OPTIONAL`. + public var proto3Optional: Bool { + get {return _storage._proto3Optional ?? false} + set {_uniqueStorage()._proto3Optional = newValue} + } + /// Returns true if `proto3Optional` has been explicitly set. + public var hasProto3Optional: Bool {return _storage._proto3Optional != nil} + /// Clears the value of `proto3Optional`. Subsequent reads from it will return its default value. + public mutating func clearProto3Optional() {_uniqueStorage()._proto3Optional = nil} + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public enum TypeEnum: SwiftProtobuf.Enum { + public typealias RawValue = Int + + /// 0 is reserved for errors. + /// Order is weird for historical reasons. + case double // = 1 + case float // = 2 + + /// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if + /// negative values are likely. + case int64 // = 3 + case uint64 // = 4 + + /// Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if + /// negative values are likely. + case int32 // = 5 + case fixed64 // = 6 + case fixed32 // = 7 + case bool // = 8 + case string // = 9 + + /// Tag-delimited aggregate. + /// Group type is deprecated and not supported in proto3. However, Proto3 + /// implementations should still be able to parse the group wire format and + /// treat group fields as unknown fields. + case group // = 10 + + /// Length-delimited aggregate. + case message // = 11 + + /// New in version 2. + case bytes // = 12 + case uint32 // = 13 + case `enum` // = 14 + case sfixed32 // = 15 + case sfixed64 // = 16 + + /// Uses ZigZag encoding. + case sint32 // = 17 + + /// Uses ZigZag encoding. + case sint64 // = 18 + + public init() { + self = .double + } + + public init?(rawValue: Int) { + switch rawValue { + case 1: self = .double + case 2: self = .float + case 3: self = .int64 + case 4: self = .uint64 + case 5: self = .int32 + case 6: self = .fixed64 + case 7: self = .fixed32 + case 8: self = .bool + case 9: self = .string + case 10: self = .group + case 11: self = .message + case 12: self = .bytes + case 13: self = .uint32 + case 14: self = .enum + case 15: self = .sfixed32 + case 16: self = .sfixed64 + case 17: self = .sint32 + case 18: self = .sint64 + default: return nil + } + } + + public var rawValue: Int { + switch self { + case .double: return 1 + case .float: return 2 + case .int64: return 3 + case .uint64: return 4 + case .int32: return 5 + case .fixed64: return 6 + case .fixed32: return 7 + case .bool: return 8 + case .string: return 9 + case .group: return 10 + case .message: return 11 + case .bytes: return 12 + case .uint32: return 13 + case .enum: return 14 + case .sfixed32: return 15 + case .sfixed64: return 16 + case .sint32: return 17 + case .sint64: return 18 + } + } + + } + + public enum Label: SwiftProtobuf.Enum { + public typealias RawValue = Int + + /// 0 is reserved for errors + case `optional` // = 1 + case `required` // = 2 + case repeated // = 3 + + public init() { + self = .optional + } + + public init?(rawValue: Int) { + switch rawValue { + case 1: self = .optional + case 2: self = .required + case 3: self = .repeated + default: return nil + } + } + + public var rawValue: Int { + switch self { + case .optional: return 1 + case .required: return 2 + case .repeated: return 3 + } + } + + } + + public init() {} + + fileprivate var _storage = _StorageClass.defaultInstance +} + +#if swift(>=4.2) + +extension Google_Protobuf_FieldDescriptorProto.TypeEnum: CaseIterable { + // Support synthesized by the compiler. +} + +extension Google_Protobuf_FieldDescriptorProto.Label: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// Describes a oneof. +public struct Google_Protobuf_OneofDescriptorProto { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + public var name: String { + get {return _name ?? String()} + set {_name = newValue} + } + /// Returns true if `name` has been explicitly set. + public var hasName: Bool {return self._name != nil} + /// Clears the value of `name`. Subsequent reads from it will return its default value. + public mutating func clearName() {self._name = nil} + + public var options: Google_Protobuf_OneofOptions { + get {return _options ?? Google_Protobuf_OneofOptions()} + set {_options = newValue} + } + /// Returns true if `options` has been explicitly set. + public var hasOptions: Bool {return self._options != nil} + /// Clears the value of `options`. Subsequent reads from it will return its default value. + public mutating func clearOptions() {self._options = nil} + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + fileprivate var _name: String? = nil + fileprivate var _options: Google_Protobuf_OneofOptions? = nil +} + +/// Describes an enum type. +public struct Google_Protobuf_EnumDescriptorProto { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + public var name: String { + get {return _name ?? String()} + set {_name = newValue} + } + /// Returns true if `name` has been explicitly set. + public var hasName: Bool {return self._name != nil} + /// Clears the value of `name`. Subsequent reads from it will return its default value. + public mutating func clearName() {self._name = nil} + + public var value: [Google_Protobuf_EnumValueDescriptorProto] = [] + + public var options: Google_Protobuf_EnumOptions { + get {return _options ?? Google_Protobuf_EnumOptions()} + set {_options = newValue} + } + /// Returns true if `options` has been explicitly set. + public var hasOptions: Bool {return self._options != nil} + /// Clears the value of `options`. Subsequent reads from it will return its default value. + public mutating func clearOptions() {self._options = nil} + + /// Range of reserved numeric values. Reserved numeric values may not be used + /// by enum values in the same enum declaration. Reserved ranges may not + /// overlap. + public var reservedRange: [Google_Protobuf_EnumDescriptorProto.EnumReservedRange] = [] + + /// Reserved enum value names, which may not be reused. A given name may only + /// be reserved once. + public var reservedName: [String] = [] + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + /// Range of reserved numeric values. Reserved values may not be used by + /// entries in the same enum. Reserved ranges may not overlap. + /// + /// Note that this is distinct from DescriptorProto.ReservedRange in that it + /// is inclusive such that it can appropriately represent the entire int32 + /// domain. + public struct EnumReservedRange { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Inclusive. + public var start: Int32 { + get {return _start ?? 0} + set {_start = newValue} + } + /// Returns true if `start` has been explicitly set. + public var hasStart: Bool {return self._start != nil} + /// Clears the value of `start`. Subsequent reads from it will return its default value. + public mutating func clearStart() {self._start = nil} + + /// Inclusive. + public var end: Int32 { + get {return _end ?? 0} + set {_end = newValue} + } + /// Returns true if `end` has been explicitly set. + public var hasEnd: Bool {return self._end != nil} + /// Clears the value of `end`. Subsequent reads from it will return its default value. + public mutating func clearEnd() {self._end = nil} + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + fileprivate var _start: Int32? = nil + fileprivate var _end: Int32? = nil + } + + public init() {} + + fileprivate var _name: String? = nil + fileprivate var _options: Google_Protobuf_EnumOptions? = nil +} + +/// Describes a value within an enum. +public struct Google_Protobuf_EnumValueDescriptorProto { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + public var name: String { + get {return _name ?? String()} + set {_name = newValue} + } + /// Returns true if `name` has been explicitly set. + public var hasName: Bool {return self._name != nil} + /// Clears the value of `name`. Subsequent reads from it will return its default value. + public mutating func clearName() {self._name = nil} + + public var number: Int32 { + get {return _number ?? 0} + set {_number = newValue} + } + /// Returns true if `number` has been explicitly set. + public var hasNumber: Bool {return self._number != nil} + /// Clears the value of `number`. Subsequent reads from it will return its default value. + public mutating func clearNumber() {self._number = nil} + + public var options: Google_Protobuf_EnumValueOptions { + get {return _options ?? Google_Protobuf_EnumValueOptions()} + set {_options = newValue} + } + /// Returns true if `options` has been explicitly set. + public var hasOptions: Bool {return self._options != nil} + /// Clears the value of `options`. Subsequent reads from it will return its default value. + public mutating func clearOptions() {self._options = nil} + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + fileprivate var _name: String? = nil + fileprivate var _number: Int32? = nil + fileprivate var _options: Google_Protobuf_EnumValueOptions? = nil +} + +/// Describes a service. +public struct Google_Protobuf_ServiceDescriptorProto { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + public var name: String { + get {return _name ?? String()} + set {_name = newValue} + } + /// Returns true if `name` has been explicitly set. + public var hasName: Bool {return self._name != nil} + /// Clears the value of `name`. Subsequent reads from it will return its default value. + public mutating func clearName() {self._name = nil} + + public var method: [Google_Protobuf_MethodDescriptorProto] = [] + + public var options: Google_Protobuf_ServiceOptions { + get {return _options ?? Google_Protobuf_ServiceOptions()} + set {_options = newValue} + } + /// Returns true if `options` has been explicitly set. + public var hasOptions: Bool {return self._options != nil} + /// Clears the value of `options`. Subsequent reads from it will return its default value. + public mutating func clearOptions() {self._options = nil} + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + fileprivate var _name: String? = nil + fileprivate var _options: Google_Protobuf_ServiceOptions? = nil +} + +/// Describes a method of a service. +public struct Google_Protobuf_MethodDescriptorProto { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + public var name: String { + get {return _name ?? String()} + set {_name = newValue} + } + /// Returns true if `name` has been explicitly set. + public var hasName: Bool {return self._name != nil} + /// Clears the value of `name`. Subsequent reads from it will return its default value. + public mutating func clearName() {self._name = nil} + + /// Input and output type names. These are resolved in the same way as + /// FieldDescriptorProto.type_name, but must refer to a message type. + public var inputType: String { + get {return _inputType ?? String()} + set {_inputType = newValue} + } + /// Returns true if `inputType` has been explicitly set. + public var hasInputType: Bool {return self._inputType != nil} + /// Clears the value of `inputType`. Subsequent reads from it will return its default value. + public mutating func clearInputType() {self._inputType = nil} + + public var outputType: String { + get {return _outputType ?? String()} + set {_outputType = newValue} + } + /// Returns true if `outputType` has been explicitly set. + public var hasOutputType: Bool {return self._outputType != nil} + /// Clears the value of `outputType`. Subsequent reads from it will return its default value. + public mutating func clearOutputType() {self._outputType = nil} + + public var options: Google_Protobuf_MethodOptions { + get {return _options ?? Google_Protobuf_MethodOptions()} + set {_options = newValue} + } + /// Returns true if `options` has been explicitly set. + public var hasOptions: Bool {return self._options != nil} + /// Clears the value of `options`. Subsequent reads from it will return its default value. + public mutating func clearOptions() {self._options = nil} + + /// Identifies if client streams multiple client messages + public var clientStreaming: Bool { + get {return _clientStreaming ?? false} + set {_clientStreaming = newValue} + } + /// Returns true if `clientStreaming` has been explicitly set. + public var hasClientStreaming: Bool {return self._clientStreaming != nil} + /// Clears the value of `clientStreaming`. Subsequent reads from it will return its default value. + public mutating func clearClientStreaming() {self._clientStreaming = nil} + + /// Identifies if server streams multiple server messages + public var serverStreaming: Bool { + get {return _serverStreaming ?? false} + set {_serverStreaming = newValue} + } + /// Returns true if `serverStreaming` has been explicitly set. + public var hasServerStreaming: Bool {return self._serverStreaming != nil} + /// Clears the value of `serverStreaming`. Subsequent reads from it will return its default value. + public mutating func clearServerStreaming() {self._serverStreaming = nil} + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + fileprivate var _name: String? = nil + fileprivate var _inputType: String? = nil + fileprivate var _outputType: String? = nil + fileprivate var _options: Google_Protobuf_MethodOptions? = nil + fileprivate var _clientStreaming: Bool? = nil + fileprivate var _serverStreaming: Bool? = nil +} + +public struct Google_Protobuf_FileOptions: SwiftProtobuf.ExtensibleMessage { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Sets the Java package where classes generated from this .proto will be + /// placed. By default, the proto package is used, but this is often + /// inappropriate because proto packages do not normally start with backwards + /// domain names. + public var javaPackage: String { + get {return _storage._javaPackage ?? String()} + set {_uniqueStorage()._javaPackage = newValue} + } + /// Returns true if `javaPackage` has been explicitly set. + public var hasJavaPackage: Bool {return _storage._javaPackage != nil} + /// Clears the value of `javaPackage`. Subsequent reads from it will return its default value. + public mutating func clearJavaPackage() {_uniqueStorage()._javaPackage = nil} + + /// If set, all the classes from the .proto file are wrapped in a single + /// outer class with the given name. This applies to both Proto1 + /// (equivalent to the old "--one_java_file" option) and Proto2 (where + /// a .proto always translates to a single class, but you may want to + /// explicitly choose the class name). + public var javaOuterClassname: String { + get {return _storage._javaOuterClassname ?? String()} + set {_uniqueStorage()._javaOuterClassname = newValue} + } + /// Returns true if `javaOuterClassname` has been explicitly set. + public var hasJavaOuterClassname: Bool {return _storage._javaOuterClassname != nil} + /// Clears the value of `javaOuterClassname`. Subsequent reads from it will return its default value. + public mutating func clearJavaOuterClassname() {_uniqueStorage()._javaOuterClassname = nil} + + /// If set true, then the Java code generator will generate a separate .java + /// file for each top-level message, enum, and service defined in the .proto + /// file. Thus, these types will *not* be nested inside the outer class + /// named by java_outer_classname. However, the outer class will still be + /// generated to contain the file's getDescriptor() method as well as any + /// top-level extensions defined in the file. + public var javaMultipleFiles: Bool { + get {return _storage._javaMultipleFiles ?? false} + set {_uniqueStorage()._javaMultipleFiles = newValue} + } + /// Returns true if `javaMultipleFiles` has been explicitly set. + public var hasJavaMultipleFiles: Bool {return _storage._javaMultipleFiles != nil} + /// Clears the value of `javaMultipleFiles`. Subsequent reads from it will return its default value. + public mutating func clearJavaMultipleFiles() {_uniqueStorage()._javaMultipleFiles = nil} + + /// This option does nothing. + public var javaGenerateEqualsAndHash: Bool { + get {return _storage._javaGenerateEqualsAndHash ?? false} + set {_uniqueStorage()._javaGenerateEqualsAndHash = newValue} + } + /// Returns true if `javaGenerateEqualsAndHash` has been explicitly set. + public var hasJavaGenerateEqualsAndHash: Bool {return _storage._javaGenerateEqualsAndHash != nil} + /// Clears the value of `javaGenerateEqualsAndHash`. Subsequent reads from it will return its default value. + public mutating func clearJavaGenerateEqualsAndHash() {_uniqueStorage()._javaGenerateEqualsAndHash = nil} + + /// If set true, then the Java2 code generator will generate code that + /// throws an exception whenever an attempt is made to assign a non-UTF-8 + /// byte sequence to a string field. + /// Message reflection will do the same. + /// However, an extension field still accepts non-UTF-8 byte sequences. + /// This option has no effect on when used with the lite runtime. + public var javaStringCheckUtf8: Bool { + get {return _storage._javaStringCheckUtf8 ?? false} + set {_uniqueStorage()._javaStringCheckUtf8 = newValue} + } + /// Returns true if `javaStringCheckUtf8` has been explicitly set. + public var hasJavaStringCheckUtf8: Bool {return _storage._javaStringCheckUtf8 != nil} + /// Clears the value of `javaStringCheckUtf8`. Subsequent reads from it will return its default value. + public mutating func clearJavaStringCheckUtf8() {_uniqueStorage()._javaStringCheckUtf8 = nil} + + public var optimizeFor: Google_Protobuf_FileOptions.OptimizeMode { + get {return _storage._optimizeFor ?? .speed} + set {_uniqueStorage()._optimizeFor = newValue} + } + /// Returns true if `optimizeFor` has been explicitly set. + public var hasOptimizeFor: Bool {return _storage._optimizeFor != nil} + /// Clears the value of `optimizeFor`. Subsequent reads from it will return its default value. + public mutating func clearOptimizeFor() {_uniqueStorage()._optimizeFor = nil} + + /// Sets the Go package where structs generated from this .proto will be + /// placed. If omitted, the Go package will be derived from the following: + /// - The basename of the package import path, if provided. + /// - Otherwise, the package statement in the .proto file, if present. + /// - Otherwise, the basename of the .proto file, without extension. + public var goPackage: String { + get {return _storage._goPackage ?? String()} + set {_uniqueStorage()._goPackage = newValue} + } + /// Returns true if `goPackage` has been explicitly set. + public var hasGoPackage: Bool {return _storage._goPackage != nil} + /// Clears the value of `goPackage`. Subsequent reads from it will return its default value. + public mutating func clearGoPackage() {_uniqueStorage()._goPackage = nil} + + /// Should generic services be generated in each language? "Generic" services + /// are not specific to any particular RPC system. They are generated by the + /// main code generators in each language (without additional plugins). + /// Generic services were the only kind of service generation supported by + /// early versions of google.protobuf. + /// + /// Generic services are now considered deprecated in favor of using plugins + /// that generate code specific to your particular RPC system. Therefore, + /// these default to false. Old code which depends on generic services should + /// explicitly set them to true. + public var ccGenericServices: Bool { + get {return _storage._ccGenericServices ?? false} + set {_uniqueStorage()._ccGenericServices = newValue} + } + /// Returns true if `ccGenericServices` has been explicitly set. + public var hasCcGenericServices: Bool {return _storage._ccGenericServices != nil} + /// Clears the value of `ccGenericServices`. Subsequent reads from it will return its default value. + public mutating func clearCcGenericServices() {_uniqueStorage()._ccGenericServices = nil} + + public var javaGenericServices: Bool { + get {return _storage._javaGenericServices ?? false} + set {_uniqueStorage()._javaGenericServices = newValue} + } + /// Returns true if `javaGenericServices` has been explicitly set. + public var hasJavaGenericServices: Bool {return _storage._javaGenericServices != nil} + /// Clears the value of `javaGenericServices`. Subsequent reads from it will return its default value. + public mutating func clearJavaGenericServices() {_uniqueStorage()._javaGenericServices = nil} + + public var pyGenericServices: Bool { + get {return _storage._pyGenericServices ?? false} + set {_uniqueStorage()._pyGenericServices = newValue} + } + /// Returns true if `pyGenericServices` has been explicitly set. + public var hasPyGenericServices: Bool {return _storage._pyGenericServices != nil} + /// Clears the value of `pyGenericServices`. Subsequent reads from it will return its default value. + public mutating func clearPyGenericServices() {_uniqueStorage()._pyGenericServices = nil} + + public var phpGenericServices: Bool { + get {return _storage._phpGenericServices ?? false} + set {_uniqueStorage()._phpGenericServices = newValue} + } + /// Returns true if `phpGenericServices` has been explicitly set. + public var hasPhpGenericServices: Bool {return _storage._phpGenericServices != nil} + /// Clears the value of `phpGenericServices`. Subsequent reads from it will return its default value. + public mutating func clearPhpGenericServices() {_uniqueStorage()._phpGenericServices = nil} + + /// Is this file deprecated? + /// Depending on the target platform, this can emit Deprecated annotations + /// for everything in the file, or it will be completely ignored; in the very + /// least, this is a formalization for deprecating files. + public var deprecated: Bool { + get {return _storage._deprecated ?? false} + set {_uniqueStorage()._deprecated = newValue} + } + /// Returns true if `deprecated` has been explicitly set. + public var hasDeprecated: Bool {return _storage._deprecated != nil} + /// Clears the value of `deprecated`. Subsequent reads from it will return its default value. + public mutating func clearDeprecated() {_uniqueStorage()._deprecated = nil} + + /// Enables the use of arenas for the proto messages in this file. This applies + /// only to generated classes for C++. + public var ccEnableArenas: Bool { + get {return _storage._ccEnableArenas ?? true} + set {_uniqueStorage()._ccEnableArenas = newValue} + } + /// Returns true if `ccEnableArenas` has been explicitly set. + public var hasCcEnableArenas: Bool {return _storage._ccEnableArenas != nil} + /// Clears the value of `ccEnableArenas`. Subsequent reads from it will return its default value. + public mutating func clearCcEnableArenas() {_uniqueStorage()._ccEnableArenas = nil} + + /// Sets the objective c class prefix which is prepended to all objective c + /// generated classes from this .proto. There is no default. + public var objcClassPrefix: String { + get {return _storage._objcClassPrefix ?? String()} + set {_uniqueStorage()._objcClassPrefix = newValue} + } + /// Returns true if `objcClassPrefix` has been explicitly set. + public var hasObjcClassPrefix: Bool {return _storage._objcClassPrefix != nil} + /// Clears the value of `objcClassPrefix`. Subsequent reads from it will return its default value. + public mutating func clearObjcClassPrefix() {_uniqueStorage()._objcClassPrefix = nil} + + /// Namespace for generated classes; defaults to the package. + public var csharpNamespace: String { + get {return _storage._csharpNamespace ?? String()} + set {_uniqueStorage()._csharpNamespace = newValue} + } + /// Returns true if `csharpNamespace` has been explicitly set. + public var hasCsharpNamespace: Bool {return _storage._csharpNamespace != nil} + /// Clears the value of `csharpNamespace`. Subsequent reads from it will return its default value. + public mutating func clearCsharpNamespace() {_uniqueStorage()._csharpNamespace = nil} + + /// By default Swift generators will take the proto package and CamelCase it + /// replacing '.' with underscore and use that to prefix the types/symbols + /// defined. When this options is provided, they will use this value instead + /// to prefix the types/symbols defined. + public var swiftPrefix: String { + get {return _storage._swiftPrefix ?? String()} + set {_uniqueStorage()._swiftPrefix = newValue} + } + /// Returns true if `swiftPrefix` has been explicitly set. + public var hasSwiftPrefix: Bool {return _storage._swiftPrefix != nil} + /// Clears the value of `swiftPrefix`. Subsequent reads from it will return its default value. + public mutating func clearSwiftPrefix() {_uniqueStorage()._swiftPrefix = nil} + + /// Sets the php class prefix which is prepended to all php generated classes + /// from this .proto. Default is empty. + public var phpClassPrefix: String { + get {return _storage._phpClassPrefix ?? String()} + set {_uniqueStorage()._phpClassPrefix = newValue} + } + /// Returns true if `phpClassPrefix` has been explicitly set. + public var hasPhpClassPrefix: Bool {return _storage._phpClassPrefix != nil} + /// Clears the value of `phpClassPrefix`. Subsequent reads from it will return its default value. + public mutating func clearPhpClassPrefix() {_uniqueStorage()._phpClassPrefix = nil} + + /// Use this option to change the namespace of php generated classes. Default + /// is empty. When this option is empty, the package name will be used for + /// determining the namespace. + public var phpNamespace: String { + get {return _storage._phpNamespace ?? String()} + set {_uniqueStorage()._phpNamespace = newValue} + } + /// Returns true if `phpNamespace` has been explicitly set. + public var hasPhpNamespace: Bool {return _storage._phpNamespace != nil} + /// Clears the value of `phpNamespace`. Subsequent reads from it will return its default value. + public mutating func clearPhpNamespace() {_uniqueStorage()._phpNamespace = nil} + + /// Use this option to change the namespace of php generated metadata classes. + /// Default is empty. When this option is empty, the proto file name will be + /// used for determining the namespace. + public var phpMetadataNamespace: String { + get {return _storage._phpMetadataNamespace ?? String()} + set {_uniqueStorage()._phpMetadataNamespace = newValue} + } + /// Returns true if `phpMetadataNamespace` has been explicitly set. + public var hasPhpMetadataNamespace: Bool {return _storage._phpMetadataNamespace != nil} + /// Clears the value of `phpMetadataNamespace`. Subsequent reads from it will return its default value. + public mutating func clearPhpMetadataNamespace() {_uniqueStorage()._phpMetadataNamespace = nil} + + /// Use this option to change the package of ruby generated classes. Default + /// is empty. When this option is not set, the package name will be used for + /// determining the ruby package. + public var rubyPackage: String { + get {return _storage._rubyPackage ?? String()} + set {_uniqueStorage()._rubyPackage = newValue} + } + /// Returns true if `rubyPackage` has been explicitly set. + public var hasRubyPackage: Bool {return _storage._rubyPackage != nil} + /// Clears the value of `rubyPackage`. Subsequent reads from it will return its default value. + public mutating func clearRubyPackage() {_uniqueStorage()._rubyPackage = nil} + + /// The parser stores options it doesn't recognize here. + /// See the documentation for the "Options" section above. + public var uninterpretedOption: [Google_Protobuf_UninterpretedOption] { + get {return _storage._uninterpretedOption} + set {_uniqueStorage()._uninterpretedOption = newValue} + } + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + /// Generated classes can be optimized for speed or code size. + public enum OptimizeMode: SwiftProtobuf.Enum { + public typealias RawValue = Int + + /// Generate complete code for parsing, serialization, + case speed // = 1 + + /// etc. + case codeSize // = 2 + + /// Generate code using MessageLite and the lite runtime. + case liteRuntime // = 3 + + public init() { + self = .speed + } + + public init?(rawValue: Int) { + switch rawValue { + case 1: self = .speed + case 2: self = .codeSize + case 3: self = .liteRuntime + default: return nil + } + } + + public var rawValue: Int { + switch self { + case .speed: return 1 + case .codeSize: return 2 + case .liteRuntime: return 3 + } + } + + } + + public init() {} + + public var _protobuf_extensionFieldValues = SwiftProtobuf.ExtensionFieldValueSet() + fileprivate var _storage = _StorageClass.defaultInstance +} + +#if swift(>=4.2) + +extension Google_Protobuf_FileOptions.OptimizeMode: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +public struct Google_Protobuf_MessageOptions: SwiftProtobuf.ExtensibleMessage { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Set true to use the old proto1 MessageSet wire format for extensions. + /// This is provided for backwards-compatibility with the MessageSet wire + /// format. You should not use this for any other reason: It's less + /// efficient, has fewer features, and is more complicated. + /// + /// The message must be defined exactly as follows: + /// message Foo { + /// option message_set_wire_format = true; + /// extensions 4 to max; + /// } + /// Note that the message cannot have any defined fields; MessageSets only + /// have extensions. + /// + /// All extensions of your type must be singular messages; e.g. they cannot + /// be int32s, enums, or repeated messages. + /// + /// Because this is an option, the above two restrictions are not enforced by + /// the protocol compiler. + public var messageSetWireFormat: Bool { + get {return _messageSetWireFormat ?? false} + set {_messageSetWireFormat = newValue} + } + /// Returns true if `messageSetWireFormat` has been explicitly set. + public var hasMessageSetWireFormat: Bool {return self._messageSetWireFormat != nil} + /// Clears the value of `messageSetWireFormat`. Subsequent reads from it will return its default value. + public mutating func clearMessageSetWireFormat() {self._messageSetWireFormat = nil} + + /// Disables the generation of the standard "descriptor()" accessor, which can + /// conflict with a field of the same name. This is meant to make migration + /// from proto1 easier; new code should avoid fields named "descriptor". + public var noStandardDescriptorAccessor: Bool { + get {return _noStandardDescriptorAccessor ?? false} + set {_noStandardDescriptorAccessor = newValue} + } + /// Returns true if `noStandardDescriptorAccessor` has been explicitly set. + public var hasNoStandardDescriptorAccessor: Bool {return self._noStandardDescriptorAccessor != nil} + /// Clears the value of `noStandardDescriptorAccessor`. Subsequent reads from it will return its default value. + public mutating func clearNoStandardDescriptorAccessor() {self._noStandardDescriptorAccessor = nil} + + /// Is this message deprecated? + /// Depending on the target platform, this can emit Deprecated annotations + /// for the message, or it will be completely ignored; in the very least, + /// this is a formalization for deprecating messages. + public var deprecated: Bool { + get {return _deprecated ?? false} + set {_deprecated = newValue} + } + /// Returns true if `deprecated` has been explicitly set. + public var hasDeprecated: Bool {return self._deprecated != nil} + /// Clears the value of `deprecated`. Subsequent reads from it will return its default value. + public mutating func clearDeprecated() {self._deprecated = nil} + + /// Whether the message is an automatically generated map entry type for the + /// maps field. + /// + /// For maps fields: + /// map map_field = 1; + /// The parsed descriptor looks like: + /// message MapFieldEntry { + /// option map_entry = true; + /// optional KeyType key = 1; + /// optional ValueType value = 2; + /// } + /// repeated MapFieldEntry map_field = 1; + /// + /// Implementations may choose not to generate the map_entry=true message, but + /// use a native map in the target language to hold the keys and values. + /// The reflection APIs in such implementations still need to work as + /// if the field is a repeated message field. + /// + /// NOTE: Do not set the option in .proto files. Always use the maps syntax + /// instead. The option should only be implicitly set by the proto compiler + /// parser. + public var mapEntry: Bool { + get {return _mapEntry ?? false} + set {_mapEntry = newValue} + } + /// Returns true if `mapEntry` has been explicitly set. + public var hasMapEntry: Bool {return self._mapEntry != nil} + /// Clears the value of `mapEntry`. Subsequent reads from it will return its default value. + public mutating func clearMapEntry() {self._mapEntry = nil} + + /// The parser stores options it doesn't recognize here. See above. + public var uninterpretedOption: [Google_Protobuf_UninterpretedOption] = [] + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + public var _protobuf_extensionFieldValues = SwiftProtobuf.ExtensionFieldValueSet() + fileprivate var _messageSetWireFormat: Bool? = nil + fileprivate var _noStandardDescriptorAccessor: Bool? = nil + fileprivate var _deprecated: Bool? = nil + fileprivate var _mapEntry: Bool? = nil +} + +public struct Google_Protobuf_FieldOptions: SwiftProtobuf.ExtensibleMessage { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The ctype option instructs the C++ code generator to use a different + /// representation of the field than it normally would. See the specific + /// options below. This option is not yet implemented in the open source + /// release -- sorry, we'll try to include it in a future version! + public var ctype: Google_Protobuf_FieldOptions.CType { + get {return _ctype ?? .string} + set {_ctype = newValue} + } + /// Returns true if `ctype` has been explicitly set. + public var hasCtype: Bool {return self._ctype != nil} + /// Clears the value of `ctype`. Subsequent reads from it will return its default value. + public mutating func clearCtype() {self._ctype = nil} + + /// The packed option can be enabled for repeated primitive fields to enable + /// a more efficient representation on the wire. Rather than repeatedly + /// writing the tag and type for each element, the entire array is encoded as + /// a single length-delimited blob. In proto3, only explicit setting it to + /// false will avoid using packed encoding. + public var packed: Bool { + get {return _packed ?? false} + set {_packed = newValue} + } + /// Returns true if `packed` has been explicitly set. + public var hasPacked: Bool {return self._packed != nil} + /// Clears the value of `packed`. Subsequent reads from it will return its default value. + public mutating func clearPacked() {self._packed = nil} + + /// The jstype option determines the JavaScript type used for values of the + /// field. The option is permitted only for 64 bit integral and fixed types + /// (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING + /// is represented as JavaScript string, which avoids loss of precision that + /// can happen when a large value is converted to a floating point JavaScript. + /// Specifying JS_NUMBER for the jstype causes the generated JavaScript code to + /// use the JavaScript "number" type. The behavior of the default option + /// JS_NORMAL is implementation dependent. + /// + /// This option is an enum to permit additional types to be added, e.g. + /// goog.math.Integer. + public var jstype: Google_Protobuf_FieldOptions.JSType { + get {return _jstype ?? .jsNormal} + set {_jstype = newValue} + } + /// Returns true if `jstype` has been explicitly set. + public var hasJstype: Bool {return self._jstype != nil} + /// Clears the value of `jstype`. Subsequent reads from it will return its default value. + public mutating func clearJstype() {self._jstype = nil} + + /// Should this field be parsed lazily? Lazy applies only to message-type + /// fields. It means that when the outer message is initially parsed, the + /// inner message's contents will not be parsed but instead stored in encoded + /// form. The inner message will actually be parsed when it is first accessed. + /// + /// This is only a hint. Implementations are free to choose whether to use + /// eager or lazy parsing regardless of the value of this option. However, + /// setting this option true suggests that the protocol author believes that + /// using lazy parsing on this field is worth the additional bookkeeping + /// overhead typically needed to implement it. + /// + /// This option does not affect the public interface of any generated code; + /// all method signatures remain the same. Furthermore, thread-safety of the + /// interface is not affected by this option; const methods remain safe to + /// call from multiple threads concurrently, while non-const methods continue + /// to require exclusive access. + /// + /// + /// Note that implementations may choose not to check required fields within + /// a lazy sub-message. That is, calling IsInitialized() on the outer message + /// may return true even if the inner message has missing required fields. + /// This is necessary because otherwise the inner message would have to be + /// parsed in order to perform the check, defeating the purpose of lazy + /// parsing. An implementation which chooses not to check required fields + /// must be consistent about it. That is, for any particular sub-message, the + /// implementation must either *always* check its required fields, or *never* + /// check its required fields, regardless of whether or not the message has + /// been parsed. + public var lazy: Bool { + get {return _lazy ?? false} + set {_lazy = newValue} + } + /// Returns true if `lazy` has been explicitly set. + public var hasLazy: Bool {return self._lazy != nil} + /// Clears the value of `lazy`. Subsequent reads from it will return its default value. + public mutating func clearLazy() {self._lazy = nil} + + /// Is this field deprecated? + /// Depending on the target platform, this can emit Deprecated annotations + /// for accessors, or it will be completely ignored; in the very least, this + /// is a formalization for deprecating fields. + public var deprecated: Bool { + get {return _deprecated ?? false} + set {_deprecated = newValue} + } + /// Returns true if `deprecated` has been explicitly set. + public var hasDeprecated: Bool {return self._deprecated != nil} + /// Clears the value of `deprecated`. Subsequent reads from it will return its default value. + public mutating func clearDeprecated() {self._deprecated = nil} + + /// For Google-internal migration only. Do not use. + public var weak: Bool { + get {return _weak ?? false} + set {_weak = newValue} + } + /// Returns true if `weak` has been explicitly set. + public var hasWeak: Bool {return self._weak != nil} + /// Clears the value of `weak`. Subsequent reads from it will return its default value. + public mutating func clearWeak() {self._weak = nil} + + /// The parser stores options it doesn't recognize here. See above. + public var uninterpretedOption: [Google_Protobuf_UninterpretedOption] = [] + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public enum CType: SwiftProtobuf.Enum { + public typealias RawValue = Int + + /// Default mode. + case string // = 0 + case cord // = 1 + case stringPiece // = 2 + + public init() { + self = .string + } + + public init?(rawValue: Int) { + switch rawValue { + case 0: self = .string + case 1: self = .cord + case 2: self = .stringPiece + default: return nil + } + } + + public var rawValue: Int { + switch self { + case .string: return 0 + case .cord: return 1 + case .stringPiece: return 2 + } + } + + } + + public enum JSType: SwiftProtobuf.Enum { + public typealias RawValue = Int + + /// Use the default type. + case jsNormal // = 0 + + /// Use JavaScript strings. + case jsString // = 1 + + /// Use JavaScript numbers. + case jsNumber // = 2 + + public init() { + self = .jsNormal + } + + public init?(rawValue: Int) { + switch rawValue { + case 0: self = .jsNormal + case 1: self = .jsString + case 2: self = .jsNumber + default: return nil + } + } + + public var rawValue: Int { + switch self { + case .jsNormal: return 0 + case .jsString: return 1 + case .jsNumber: return 2 + } + } + + } + + public init() {} + + public var _protobuf_extensionFieldValues = SwiftProtobuf.ExtensionFieldValueSet() + fileprivate var _ctype: Google_Protobuf_FieldOptions.CType? = nil + fileprivate var _packed: Bool? = nil + fileprivate var _jstype: Google_Protobuf_FieldOptions.JSType? = nil + fileprivate var _lazy: Bool? = nil + fileprivate var _deprecated: Bool? = nil + fileprivate var _weak: Bool? = nil +} + +#if swift(>=4.2) + +extension Google_Protobuf_FieldOptions.CType: CaseIterable { + // Support synthesized by the compiler. +} + +extension Google_Protobuf_FieldOptions.JSType: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +public struct Google_Protobuf_OneofOptions: SwiftProtobuf.ExtensibleMessage { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The parser stores options it doesn't recognize here. See above. + public var uninterpretedOption: [Google_Protobuf_UninterpretedOption] = [] + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + public var _protobuf_extensionFieldValues = SwiftProtobuf.ExtensionFieldValueSet() +} + +public struct Google_Protobuf_EnumOptions: SwiftProtobuf.ExtensibleMessage { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Set this option to true to allow mapping different tag names to the same + /// value. + public var allowAlias: Bool { + get {return _allowAlias ?? false} + set {_allowAlias = newValue} + } + /// Returns true if `allowAlias` has been explicitly set. + public var hasAllowAlias: Bool {return self._allowAlias != nil} + /// Clears the value of `allowAlias`. Subsequent reads from it will return its default value. + public mutating func clearAllowAlias() {self._allowAlias = nil} + + /// Is this enum deprecated? + /// Depending on the target platform, this can emit Deprecated annotations + /// for the enum, or it will be completely ignored; in the very least, this + /// is a formalization for deprecating enums. + public var deprecated: Bool { + get {return _deprecated ?? false} + set {_deprecated = newValue} + } + /// Returns true if `deprecated` has been explicitly set. + public var hasDeprecated: Bool {return self._deprecated != nil} + /// Clears the value of `deprecated`. Subsequent reads from it will return its default value. + public mutating func clearDeprecated() {self._deprecated = nil} + + /// The parser stores options it doesn't recognize here. See above. + public var uninterpretedOption: [Google_Protobuf_UninterpretedOption] = [] + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + public var _protobuf_extensionFieldValues = SwiftProtobuf.ExtensionFieldValueSet() + fileprivate var _allowAlias: Bool? = nil + fileprivate var _deprecated: Bool? = nil +} + +public struct Google_Protobuf_EnumValueOptions: SwiftProtobuf.ExtensibleMessage { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Is this enum value deprecated? + /// Depending on the target platform, this can emit Deprecated annotations + /// for the enum value, or it will be completely ignored; in the very least, + /// this is a formalization for deprecating enum values. + public var deprecated: Bool { + get {return _deprecated ?? false} + set {_deprecated = newValue} + } + /// Returns true if `deprecated` has been explicitly set. + public var hasDeprecated: Bool {return self._deprecated != nil} + /// Clears the value of `deprecated`. Subsequent reads from it will return its default value. + public mutating func clearDeprecated() {self._deprecated = nil} + + /// The parser stores options it doesn't recognize here. See above. + public var uninterpretedOption: [Google_Protobuf_UninterpretedOption] = [] + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + public var _protobuf_extensionFieldValues = SwiftProtobuf.ExtensionFieldValueSet() + fileprivate var _deprecated: Bool? = nil +} + +public struct Google_Protobuf_ServiceOptions: SwiftProtobuf.ExtensibleMessage { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Is this service deprecated? + /// Depending on the target platform, this can emit Deprecated annotations + /// for the service, or it will be completely ignored; in the very least, + /// this is a formalization for deprecating services. + public var deprecated: Bool { + get {return _deprecated ?? false} + set {_deprecated = newValue} + } + /// Returns true if `deprecated` has been explicitly set. + public var hasDeprecated: Bool {return self._deprecated != nil} + /// Clears the value of `deprecated`. Subsequent reads from it will return its default value. + public mutating func clearDeprecated() {self._deprecated = nil} + + /// The parser stores options it doesn't recognize here. See above. + public var uninterpretedOption: [Google_Protobuf_UninterpretedOption] = [] + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + public var _protobuf_extensionFieldValues = SwiftProtobuf.ExtensionFieldValueSet() + fileprivate var _deprecated: Bool? = nil +} + +public struct Google_Protobuf_MethodOptions: SwiftProtobuf.ExtensibleMessage { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Is this method deprecated? + /// Depending on the target platform, this can emit Deprecated annotations + /// for the method, or it will be completely ignored; in the very least, + /// this is a formalization for deprecating methods. + public var deprecated: Bool { + get {return _deprecated ?? false} + set {_deprecated = newValue} + } + /// Returns true if `deprecated` has been explicitly set. + public var hasDeprecated: Bool {return self._deprecated != nil} + /// Clears the value of `deprecated`. Subsequent reads from it will return its default value. + public mutating func clearDeprecated() {self._deprecated = nil} + + public var idempotencyLevel: Google_Protobuf_MethodOptions.IdempotencyLevel { + get {return _idempotencyLevel ?? .idempotencyUnknown} + set {_idempotencyLevel = newValue} + } + /// Returns true if `idempotencyLevel` has been explicitly set. + public var hasIdempotencyLevel: Bool {return self._idempotencyLevel != nil} + /// Clears the value of `idempotencyLevel`. Subsequent reads from it will return its default value. + public mutating func clearIdempotencyLevel() {self._idempotencyLevel = nil} + + /// The parser stores options it doesn't recognize here. See above. + public var uninterpretedOption: [Google_Protobuf_UninterpretedOption] = [] + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + /// Is this method side-effect-free (or safe in HTTP parlance), or idempotent, + /// or neither? HTTP based RPC implementation may choose GET verb for safe + /// methods, and PUT verb for idempotent methods instead of the default POST. + public enum IdempotencyLevel: SwiftProtobuf.Enum { + public typealias RawValue = Int + case idempotencyUnknown // = 0 + + /// implies idempotent + case noSideEffects // = 1 + + /// idempotent, but may have side effects + case idempotent // = 2 + + public init() { + self = .idempotencyUnknown + } + + public init?(rawValue: Int) { + switch rawValue { + case 0: self = .idempotencyUnknown + case 1: self = .noSideEffects + case 2: self = .idempotent + default: return nil + } + } + + public var rawValue: Int { + switch self { + case .idempotencyUnknown: return 0 + case .noSideEffects: return 1 + case .idempotent: return 2 + } + } + + } + + public init() {} + + public var _protobuf_extensionFieldValues = SwiftProtobuf.ExtensionFieldValueSet() + fileprivate var _deprecated: Bool? = nil + fileprivate var _idempotencyLevel: Google_Protobuf_MethodOptions.IdempotencyLevel? = nil +} + +#if swift(>=4.2) + +extension Google_Protobuf_MethodOptions.IdempotencyLevel: CaseIterable { + // Support synthesized by the compiler. +} + +#endif // swift(>=4.2) + +/// A message representing a option the parser does not recognize. This only +/// appears in options protos created by the compiler::Parser class. +/// DescriptorPool resolves these when building Descriptor objects. Therefore, +/// options protos in descriptor objects (e.g. returned by Descriptor::options(), +/// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions +/// in them. +public struct Google_Protobuf_UninterpretedOption { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + public var name: [Google_Protobuf_UninterpretedOption.NamePart] = [] + + /// The value of the uninterpreted option, in whatever type the tokenizer + /// identified it as during parsing. Exactly one of these should be set. + public var identifierValue: String { + get {return _identifierValue ?? String()} + set {_identifierValue = newValue} + } + /// Returns true if `identifierValue` has been explicitly set. + public var hasIdentifierValue: Bool {return self._identifierValue != nil} + /// Clears the value of `identifierValue`. Subsequent reads from it will return its default value. + public mutating func clearIdentifierValue() {self._identifierValue = nil} + + public var positiveIntValue: UInt64 { + get {return _positiveIntValue ?? 0} + set {_positiveIntValue = newValue} + } + /// Returns true if `positiveIntValue` has been explicitly set. + public var hasPositiveIntValue: Bool {return self._positiveIntValue != nil} + /// Clears the value of `positiveIntValue`. Subsequent reads from it will return its default value. + public mutating func clearPositiveIntValue() {self._positiveIntValue = nil} + + public var negativeIntValue: Int64 { + get {return _negativeIntValue ?? 0} + set {_negativeIntValue = newValue} + } + /// Returns true if `negativeIntValue` has been explicitly set. + public var hasNegativeIntValue: Bool {return self._negativeIntValue != nil} + /// Clears the value of `negativeIntValue`. Subsequent reads from it will return its default value. + public mutating func clearNegativeIntValue() {self._negativeIntValue = nil} + + public var doubleValue: Double { + get {return _doubleValue ?? 0} + set {_doubleValue = newValue} + } + /// Returns true if `doubleValue` has been explicitly set. + public var hasDoubleValue: Bool {return self._doubleValue != nil} + /// Clears the value of `doubleValue`. Subsequent reads from it will return its default value. + public mutating func clearDoubleValue() {self._doubleValue = nil} + + public var stringValue: Data { + get {return _stringValue ?? Data()} + set {_stringValue = newValue} + } + /// Returns true if `stringValue` has been explicitly set. + public var hasStringValue: Bool {return self._stringValue != nil} + /// Clears the value of `stringValue`. Subsequent reads from it will return its default value. + public mutating func clearStringValue() {self._stringValue = nil} + + public var aggregateValue: String { + get {return _aggregateValue ?? String()} + set {_aggregateValue = newValue} + } + /// Returns true if `aggregateValue` has been explicitly set. + public var hasAggregateValue: Bool {return self._aggregateValue != nil} + /// Clears the value of `aggregateValue`. Subsequent reads from it will return its default value. + public mutating func clearAggregateValue() {self._aggregateValue = nil} + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + /// The name of the uninterpreted option. Each string represents a segment in + /// a dot-separated name. is_extension is true iff a segment represents an + /// extension (denoted with parentheses in options specs in .proto files). + /// E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents + /// "foo.(bar.baz).qux". + public struct NamePart { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + public var namePart: String { + get {return _namePart ?? String()} + set {_namePart = newValue} + } + /// Returns true if `namePart` has been explicitly set. + public var hasNamePart: Bool {return self._namePart != nil} + /// Clears the value of `namePart`. Subsequent reads from it will return its default value. + public mutating func clearNamePart() {self._namePart = nil} + + public var isExtension: Bool { + get {return _isExtension ?? false} + set {_isExtension = newValue} + } + /// Returns true if `isExtension` has been explicitly set. + public var hasIsExtension: Bool {return self._isExtension != nil} + /// Clears the value of `isExtension`. Subsequent reads from it will return its default value. + public mutating func clearIsExtension() {self._isExtension = nil} + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + fileprivate var _namePart: String? = nil + fileprivate var _isExtension: Bool? = nil + } + + public init() {} + + fileprivate var _identifierValue: String? = nil + fileprivate var _positiveIntValue: UInt64? = nil + fileprivate var _negativeIntValue: Int64? = nil + fileprivate var _doubleValue: Double? = nil + fileprivate var _stringValue: Data? = nil + fileprivate var _aggregateValue: String? = nil +} + +/// Encapsulates information about the original source file from which a +/// FileDescriptorProto was generated. +public struct Google_Protobuf_SourceCodeInfo { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// A Location identifies a piece of source code in a .proto file which + /// corresponds to a particular definition. This information is intended + /// to be useful to IDEs, code indexers, documentation generators, and similar + /// tools. + /// + /// For example, say we have a file like: + /// message Foo { + /// optional string foo = 1; + /// } + /// Let's look at just the field definition: + /// optional string foo = 1; + /// ^ ^^ ^^ ^ ^^^ + /// a bc de f ghi + /// We have the following locations: + /// span path represents + /// [a,i) [ 4, 0, 2, 0 ] The whole field definition. + /// [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). + /// [c,d) [ 4, 0, 2, 0, 5 ] The type (string). + /// [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). + /// [g,h) [ 4, 0, 2, 0, 3 ] The number (1). + /// + /// Notes: + /// - A location may refer to a repeated field itself (i.e. not to any + /// particular index within it). This is used whenever a set of elements are + /// logically enclosed in a single code segment. For example, an entire + /// extend block (possibly containing multiple extension definitions) will + /// have an outer location whose path refers to the "extensions" repeated + /// field without an index. + /// - Multiple locations may have the same path. This happens when a single + /// logical declaration is spread out across multiple places. The most + /// obvious example is the "extend" block again -- there may be multiple + /// extend blocks in the same scope, each of which will have the same path. + /// - A location's span is not always a subset of its parent's span. For + /// example, the "extendee" of an extension declaration appears at the + /// beginning of the "extend" block and is shared by all extensions within + /// the block. + /// - Just because a location's span is a subset of some other location's span + /// does not mean that it is a descendant. For example, a "group" defines + /// both a type and a field in a single declaration. Thus, the locations + /// corresponding to the type and field and their components will overlap. + /// - Code which tries to interpret locations should probably be designed to + /// ignore those that it doesn't understand, as more types of locations could + /// be recorded in the future. + public var location: [Google_Protobuf_SourceCodeInfo.Location] = [] + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public struct Location { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Identifies which part of the FileDescriptorProto was defined at this + /// location. + /// + /// Each element is a field number or an index. They form a path from + /// the root FileDescriptorProto to the place where the definition. For + /// example, this path: + /// [ 4, 3, 2, 7, 1 ] + /// refers to: + /// file.message_type(3) // 4, 3 + /// .field(7) // 2, 7 + /// .name() // 1 + /// This is because FileDescriptorProto.message_type has field number 4: + /// repeated DescriptorProto message_type = 4; + /// and DescriptorProto.field has field number 2: + /// repeated FieldDescriptorProto field = 2; + /// and FieldDescriptorProto.name has field number 1: + /// optional string name = 1; + /// + /// Thus, the above path gives the location of a field name. If we removed + /// the last element: + /// [ 4, 3, 2, 7 ] + /// this path refers to the whole field declaration (from the beginning + /// of the label to the terminating semicolon). + public var path: [Int32] = [] + + /// Always has exactly three or four elements: start line, start column, + /// end line (optional, otherwise assumed same as start line), end column. + /// These are packed into a single field for efficiency. Note that line + /// and column numbers are zero-based -- typically you will want to add + /// 1 to each before displaying to a user. + public var span: [Int32] = [] + + /// If this SourceCodeInfo represents a complete declaration, these are any + /// comments appearing before and after the declaration which appear to be + /// attached to the declaration. + /// + /// A series of line comments appearing on consecutive lines, with no other + /// tokens appearing on those lines, will be treated as a single comment. + /// + /// leading_detached_comments will keep paragraphs of comments that appear + /// before (but not connected to) the current element. Each paragraph, + /// separated by empty lines, will be one comment element in the repeated + /// field. + /// + /// Only the comment content is provided; comment markers (e.g. //) are + /// stripped out. For block comments, leading whitespace and an asterisk + /// will be stripped from the beginning of each line other than the first. + /// Newlines are included in the output. + /// + /// Examples: + /// + /// optional int32 foo = 1; // Comment attached to foo. + /// // Comment attached to bar. + /// optional int32 bar = 2; + /// + /// optional string baz = 3; + /// // Comment attached to baz. + /// // Another line attached to baz. + /// + /// // Comment attached to qux. + /// // + /// // Another line attached to qux. + /// optional double qux = 4; + /// + /// // Detached comment for corge. This is not leading or trailing comments + /// // to qux or corge because there are blank lines separating it from + /// // both. + /// + /// // Detached comment for corge paragraph 2. + /// + /// optional string corge = 5; + /// /* Block comment attached + /// * to corge. Leading asterisks + /// * will be removed. */ + /// /* Block comment attached to + /// * grault. */ + /// optional int32 grault = 6; + /// + /// // ignored detached comments. + public var leadingComments: String { + get {return _leadingComments ?? String()} + set {_leadingComments = newValue} + } + /// Returns true if `leadingComments` has been explicitly set. + public var hasLeadingComments: Bool {return self._leadingComments != nil} + /// Clears the value of `leadingComments`. Subsequent reads from it will return its default value. + public mutating func clearLeadingComments() {self._leadingComments = nil} + + public var trailingComments: String { + get {return _trailingComments ?? String()} + set {_trailingComments = newValue} + } + /// Returns true if `trailingComments` has been explicitly set. + public var hasTrailingComments: Bool {return self._trailingComments != nil} + /// Clears the value of `trailingComments`. Subsequent reads from it will return its default value. + public mutating func clearTrailingComments() {self._trailingComments = nil} + + public var leadingDetachedComments: [String] = [] + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + fileprivate var _leadingComments: String? = nil + fileprivate var _trailingComments: String? = nil + } + + public init() {} +} + +/// Describes the relationship between generated code and its original source +/// file. A GeneratedCodeInfo message is associated with only one generated +/// source file, but may contain references to different source .proto files. +public struct Google_Protobuf_GeneratedCodeInfo { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// An Annotation connects some span of text in generated code to an element + /// of its generating .proto file. + public var annotation: [Google_Protobuf_GeneratedCodeInfo.Annotation] = [] + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public struct Annotation { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Identifies the element in the original source .proto file. This field + /// is formatted the same as SourceCodeInfo.Location.path. + public var path: [Int32] = [] + + /// Identifies the filesystem path to the original source .proto. + public var sourceFile: String { + get {return _sourceFile ?? String()} + set {_sourceFile = newValue} + } + /// Returns true if `sourceFile` has been explicitly set. + public var hasSourceFile: Bool {return self._sourceFile != nil} + /// Clears the value of `sourceFile`. Subsequent reads from it will return its default value. + public mutating func clearSourceFile() {self._sourceFile = nil} + + /// Identifies the starting offset in bytes in the generated code + /// that relates to the identified object. + public var begin: Int32 { + get {return _begin ?? 0} + set {_begin = newValue} + } + /// Returns true if `begin` has been explicitly set. + public var hasBegin: Bool {return self._begin != nil} + /// Clears the value of `begin`. Subsequent reads from it will return its default value. + public mutating func clearBegin() {self._begin = nil} + + /// Identifies the ending offset in bytes in the generated code that + /// relates to the identified offset. The end offset should be one past + /// the last relevant byte (so the length of the text = end - begin). + public var end: Int32 { + get {return _end ?? 0} + set {_end = newValue} + } + /// Returns true if `end` has been explicitly set. + public var hasEnd: Bool {return self._end != nil} + /// Clears the value of `end`. Subsequent reads from it will return its default value. + public mutating func clearEnd() {self._end = nil} + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + fileprivate var _sourceFile: String? = nil + fileprivate var _begin: Int32? = nil + fileprivate var _end: Int32? = nil + } + + public init() {} +} + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "google.protobuf" + +extension Google_Protobuf_FileDescriptorSet: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".FileDescriptorSet" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "file"), + ] + + public var isInitialized: Bool { + if !SwiftProtobuf.Internal.areAllInitialized(self.file) {return false} + return true + } + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeRepeatedMessageField(value: &self.file) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.file.isEmpty { + try visitor.visitRepeatedMessageField(value: self.file, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_FileDescriptorSet, rhs: Google_Protobuf_FileDescriptorSet) -> Bool { + if lhs.file != rhs.file {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Google_Protobuf_FileDescriptorProto: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".FileDescriptorProto" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "name"), + 2: .same(proto: "package"), + 3: .same(proto: "dependency"), + 10: .standard(proto: "public_dependency"), + 11: .standard(proto: "weak_dependency"), + 4: .standard(proto: "message_type"), + 5: .standard(proto: "enum_type"), + 6: .same(proto: "service"), + 7: .same(proto: "extension"), + 8: .same(proto: "options"), + 9: .standard(proto: "source_code_info"), + 12: .same(proto: "syntax"), + ] + + public var isInitialized: Bool { + if !SwiftProtobuf.Internal.areAllInitialized(self.messageType) {return false} + if !SwiftProtobuf.Internal.areAllInitialized(self.enumType) {return false} + if !SwiftProtobuf.Internal.areAllInitialized(self.service) {return false} + if !SwiftProtobuf.Internal.areAllInitialized(self.`extension`) {return false} + if let v = self._options, !v.isInitialized {return false} + return true + } + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self._name) }() + case 2: try { try decoder.decodeSingularStringField(value: &self._package) }() + case 3: try { try decoder.decodeRepeatedStringField(value: &self.dependency) }() + case 4: try { try decoder.decodeRepeatedMessageField(value: &self.messageType) }() + case 5: try { try decoder.decodeRepeatedMessageField(value: &self.enumType) }() + case 6: try { try decoder.decodeRepeatedMessageField(value: &self.service) }() + case 7: try { try decoder.decodeRepeatedMessageField(value: &self.`extension`) }() + case 8: try { try decoder.decodeSingularMessageField(value: &self._options) }() + case 9: try { try decoder.decodeSingularMessageField(value: &self._sourceCodeInfo) }() + case 10: try { try decoder.decodeRepeatedInt32Field(value: &self.publicDependency) }() + case 11: try { try decoder.decodeRepeatedInt32Field(value: &self.weakDependency) }() + case 12: try { try decoder.decodeSingularStringField(value: &self._syntax) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if let v = self._name { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if let v = self._package { + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + } + if !self.dependency.isEmpty { + try visitor.visitRepeatedStringField(value: self.dependency, fieldNumber: 3) + } + if !self.messageType.isEmpty { + try visitor.visitRepeatedMessageField(value: self.messageType, fieldNumber: 4) + } + if !self.enumType.isEmpty { + try visitor.visitRepeatedMessageField(value: self.enumType, fieldNumber: 5) + } + if !self.service.isEmpty { + try visitor.visitRepeatedMessageField(value: self.service, fieldNumber: 6) + } + if !self.`extension`.isEmpty { + try visitor.visitRepeatedMessageField(value: self.`extension`, fieldNumber: 7) + } + if let v = self._options { + try visitor.visitSingularMessageField(value: v, fieldNumber: 8) + } + if let v = self._sourceCodeInfo { + try visitor.visitSingularMessageField(value: v, fieldNumber: 9) + } + if !self.publicDependency.isEmpty { + try visitor.visitRepeatedInt32Field(value: self.publicDependency, fieldNumber: 10) + } + if !self.weakDependency.isEmpty { + try visitor.visitRepeatedInt32Field(value: self.weakDependency, fieldNumber: 11) + } + if let v = self._syntax { + try visitor.visitSingularStringField(value: v, fieldNumber: 12) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_FileDescriptorProto, rhs: Google_Protobuf_FileDescriptorProto) -> Bool { + if lhs._name != rhs._name {return false} + if lhs._package != rhs._package {return false} + if lhs.dependency != rhs.dependency {return false} + if lhs.publicDependency != rhs.publicDependency {return false} + if lhs.weakDependency != rhs.weakDependency {return false} + if lhs.messageType != rhs.messageType {return false} + if lhs.enumType != rhs.enumType {return false} + if lhs.service != rhs.service {return false} + if lhs.`extension` != rhs.`extension` {return false} + if lhs._options != rhs._options {return false} + if lhs._sourceCodeInfo != rhs._sourceCodeInfo {return false} + if lhs._syntax != rhs._syntax {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Google_Protobuf_DescriptorProto: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".DescriptorProto" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "name"), + 2: .same(proto: "field"), + 6: .same(proto: "extension"), + 3: .standard(proto: "nested_type"), + 4: .standard(proto: "enum_type"), + 5: .standard(proto: "extension_range"), + 8: .standard(proto: "oneof_decl"), + 7: .same(proto: "options"), + 9: .standard(proto: "reserved_range"), + 10: .standard(proto: "reserved_name"), + ] + + public var isInitialized: Bool { + if !SwiftProtobuf.Internal.areAllInitialized(self.field) {return false} + if !SwiftProtobuf.Internal.areAllInitialized(self.`extension`) {return false} + if !SwiftProtobuf.Internal.areAllInitialized(self.nestedType) {return false} + if !SwiftProtobuf.Internal.areAllInitialized(self.enumType) {return false} + if !SwiftProtobuf.Internal.areAllInitialized(self.extensionRange) {return false} + if !SwiftProtobuf.Internal.areAllInitialized(self.oneofDecl) {return false} + if let v = self._options, !v.isInitialized {return false} + return true + } + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self._name) }() + case 2: try { try decoder.decodeRepeatedMessageField(value: &self.field) }() + case 3: try { try decoder.decodeRepeatedMessageField(value: &self.nestedType) }() + case 4: try { try decoder.decodeRepeatedMessageField(value: &self.enumType) }() + case 5: try { try decoder.decodeRepeatedMessageField(value: &self.extensionRange) }() + case 6: try { try decoder.decodeRepeatedMessageField(value: &self.`extension`) }() + case 7: try { try decoder.decodeSingularMessageField(value: &self._options) }() + case 8: try { try decoder.decodeRepeatedMessageField(value: &self.oneofDecl) }() + case 9: try { try decoder.decodeRepeatedMessageField(value: &self.reservedRange) }() + case 10: try { try decoder.decodeRepeatedStringField(value: &self.reservedName) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if let v = self._name { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if !self.field.isEmpty { + try visitor.visitRepeatedMessageField(value: self.field, fieldNumber: 2) + } + if !self.nestedType.isEmpty { + try visitor.visitRepeatedMessageField(value: self.nestedType, fieldNumber: 3) + } + if !self.enumType.isEmpty { + try visitor.visitRepeatedMessageField(value: self.enumType, fieldNumber: 4) + } + if !self.extensionRange.isEmpty { + try visitor.visitRepeatedMessageField(value: self.extensionRange, fieldNumber: 5) + } + if !self.`extension`.isEmpty { + try visitor.visitRepeatedMessageField(value: self.`extension`, fieldNumber: 6) + } + if let v = self._options { + try visitor.visitSingularMessageField(value: v, fieldNumber: 7) + } + if !self.oneofDecl.isEmpty { + try visitor.visitRepeatedMessageField(value: self.oneofDecl, fieldNumber: 8) + } + if !self.reservedRange.isEmpty { + try visitor.visitRepeatedMessageField(value: self.reservedRange, fieldNumber: 9) + } + if !self.reservedName.isEmpty { + try visitor.visitRepeatedStringField(value: self.reservedName, fieldNumber: 10) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_DescriptorProto, rhs: Google_Protobuf_DescriptorProto) -> Bool { + if lhs._name != rhs._name {return false} + if lhs.field != rhs.field {return false} + if lhs.`extension` != rhs.`extension` {return false} + if lhs.nestedType != rhs.nestedType {return false} + if lhs.enumType != rhs.enumType {return false} + if lhs.extensionRange != rhs.extensionRange {return false} + if lhs.oneofDecl != rhs.oneofDecl {return false} + if lhs._options != rhs._options {return false} + if lhs.reservedRange != rhs.reservedRange {return false} + if lhs.reservedName != rhs.reservedName {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Google_Protobuf_DescriptorProto.ExtensionRange: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = Google_Protobuf_DescriptorProto.protoMessageName + ".ExtensionRange" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "start"), + 2: .same(proto: "end"), + 3: .same(proto: "options"), + ] + + public var isInitialized: Bool { + if let v = self._options, !v.isInitialized {return false} + return true + } + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularInt32Field(value: &self._start) }() + case 2: try { try decoder.decodeSingularInt32Field(value: &self._end) }() + case 3: try { try decoder.decodeSingularMessageField(value: &self._options) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if let v = self._start { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 1) + } + if let v = self._end { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 2) + } + if let v = self._options { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_DescriptorProto.ExtensionRange, rhs: Google_Protobuf_DescriptorProto.ExtensionRange) -> Bool { + if lhs._start != rhs._start {return false} + if lhs._end != rhs._end {return false} + if lhs._options != rhs._options {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Google_Protobuf_DescriptorProto.ReservedRange: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = Google_Protobuf_DescriptorProto.protoMessageName + ".ReservedRange" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "start"), + 2: .same(proto: "end"), + ] + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularInt32Field(value: &self._start) }() + case 2: try { try decoder.decodeSingularInt32Field(value: &self._end) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if let v = self._start { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 1) + } + if let v = self._end { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_DescriptorProto.ReservedRange, rhs: Google_Protobuf_DescriptorProto.ReservedRange) -> Bool { + if lhs._start != rhs._start {return false} + if lhs._end != rhs._end {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Google_Protobuf_ExtensionRangeOptions: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".ExtensionRangeOptions" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 999: .standard(proto: "uninterpreted_option"), + ] + + public var isInitialized: Bool { + if !_protobuf_extensionFieldValues.isInitialized {return false} + if !SwiftProtobuf.Internal.areAllInitialized(self.uninterpretedOption) {return false} + return true + } + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 999: try { try decoder.decodeRepeatedMessageField(value: &self.uninterpretedOption) }() + case 1000..<536870912: + try { try decoder.decodeExtensionField(values: &_protobuf_extensionFieldValues, messageType: Google_Protobuf_ExtensionRangeOptions.self, fieldNumber: fieldNumber) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.uninterpretedOption.isEmpty { + try visitor.visitRepeatedMessageField(value: self.uninterpretedOption, fieldNumber: 999) + } + try visitor.visitExtensionFields(fields: _protobuf_extensionFieldValues, start: 1000, end: 536870912) + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_ExtensionRangeOptions, rhs: Google_Protobuf_ExtensionRangeOptions) -> Bool { + if lhs.uninterpretedOption != rhs.uninterpretedOption {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + if lhs._protobuf_extensionFieldValues != rhs._protobuf_extensionFieldValues {return false} + return true + } +} + +extension Google_Protobuf_FieldDescriptorProto: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".FieldDescriptorProto" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "name"), + 3: .same(proto: "number"), + 4: .same(proto: "label"), + 5: .same(proto: "type"), + 6: .standard(proto: "type_name"), + 2: .same(proto: "extendee"), + 7: .standard(proto: "default_value"), + 9: .standard(proto: "oneof_index"), + 10: .standard(proto: "json_name"), + 8: .same(proto: "options"), + 17: .standard(proto: "proto3_optional"), + ] + + fileprivate class _StorageClass { + var _name: String? = nil + var _number: Int32? = nil + var _label: Google_Protobuf_FieldDescriptorProto.Label? = nil + var _type: Google_Protobuf_FieldDescriptorProto.TypeEnum? = nil + var _typeName: String? = nil + var _extendee: String? = nil + var _defaultValue: String? = nil + var _oneofIndex: Int32? = nil + var _jsonName: String? = nil + var _options: Google_Protobuf_FieldOptions? = nil + var _proto3Optional: Bool? = nil + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _name = source._name + _number = source._number + _label = source._label + _type = source._type + _typeName = source._typeName + _extendee = source._extendee + _defaultValue = source._defaultValue + _oneofIndex = source._oneofIndex + _jsonName = source._jsonName + _options = source._options + _proto3Optional = source._proto3Optional + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + + public var isInitialized: Bool { + return withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if let v = _storage._options, !v.isInitialized {return false} + return true + } + } + + public mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &_storage._name) }() + case 2: try { try decoder.decodeSingularStringField(value: &_storage._extendee) }() + case 3: try { try decoder.decodeSingularInt32Field(value: &_storage._number) }() + case 4: try { try decoder.decodeSingularEnumField(value: &_storage._label) }() + case 5: try { try decoder.decodeSingularEnumField(value: &_storage._type) }() + case 6: try { try decoder.decodeSingularStringField(value: &_storage._typeName) }() + case 7: try { try decoder.decodeSingularStringField(value: &_storage._defaultValue) }() + case 8: try { try decoder.decodeSingularMessageField(value: &_storage._options) }() + case 9: try { try decoder.decodeSingularInt32Field(value: &_storage._oneofIndex) }() + case 10: try { try decoder.decodeSingularStringField(value: &_storage._jsonName) }() + case 17: try { try decoder.decodeSingularBoolField(value: &_storage._proto3Optional) }() + default: break + } + } + } + } + + public func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if let v = _storage._name { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if let v = _storage._extendee { + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + } + if let v = _storage._number { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 3) + } + if let v = _storage._label { + try visitor.visitSingularEnumField(value: v, fieldNumber: 4) + } + if let v = _storage._type { + try visitor.visitSingularEnumField(value: v, fieldNumber: 5) + } + if let v = _storage._typeName { + try visitor.visitSingularStringField(value: v, fieldNumber: 6) + } + if let v = _storage._defaultValue { + try visitor.visitSingularStringField(value: v, fieldNumber: 7) + } + if let v = _storage._options { + try visitor.visitSingularMessageField(value: v, fieldNumber: 8) + } + if let v = _storage._oneofIndex { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 9) + } + if let v = _storage._jsonName { + try visitor.visitSingularStringField(value: v, fieldNumber: 10) + } + if let v = _storage._proto3Optional { + try visitor.visitSingularBoolField(value: v, fieldNumber: 17) + } + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_FieldDescriptorProto, rhs: Google_Protobuf_FieldDescriptorProto) -> Bool { + if lhs._storage !== rhs._storage { + let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let rhs_storage = _args.1 + if _storage._name != rhs_storage._name {return false} + if _storage._number != rhs_storage._number {return false} + if _storage._label != rhs_storage._label {return false} + if _storage._type != rhs_storage._type {return false} + if _storage._typeName != rhs_storage._typeName {return false} + if _storage._extendee != rhs_storage._extendee {return false} + if _storage._defaultValue != rhs_storage._defaultValue {return false} + if _storage._oneofIndex != rhs_storage._oneofIndex {return false} + if _storage._jsonName != rhs_storage._jsonName {return false} + if _storage._options != rhs_storage._options {return false} + if _storage._proto3Optional != rhs_storage._proto3Optional {return false} + return true + } + if !storagesAreEqual {return false} + } + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Google_Protobuf_FieldDescriptorProto.TypeEnum: SwiftProtobuf._ProtoNameProviding { + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "TYPE_DOUBLE"), + 2: .same(proto: "TYPE_FLOAT"), + 3: .same(proto: "TYPE_INT64"), + 4: .same(proto: "TYPE_UINT64"), + 5: .same(proto: "TYPE_INT32"), + 6: .same(proto: "TYPE_FIXED64"), + 7: .same(proto: "TYPE_FIXED32"), + 8: .same(proto: "TYPE_BOOL"), + 9: .same(proto: "TYPE_STRING"), + 10: .same(proto: "TYPE_GROUP"), + 11: .same(proto: "TYPE_MESSAGE"), + 12: .same(proto: "TYPE_BYTES"), + 13: .same(proto: "TYPE_UINT32"), + 14: .same(proto: "TYPE_ENUM"), + 15: .same(proto: "TYPE_SFIXED32"), + 16: .same(proto: "TYPE_SFIXED64"), + 17: .same(proto: "TYPE_SINT32"), + 18: .same(proto: "TYPE_SINT64"), + ] +} + +extension Google_Protobuf_FieldDescriptorProto.Label: SwiftProtobuf._ProtoNameProviding { + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "LABEL_OPTIONAL"), + 2: .same(proto: "LABEL_REQUIRED"), + 3: .same(proto: "LABEL_REPEATED"), + ] +} + +extension Google_Protobuf_OneofDescriptorProto: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".OneofDescriptorProto" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "name"), + 2: .same(proto: "options"), + ] + + public var isInitialized: Bool { + if let v = self._options, !v.isInitialized {return false} + return true + } + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self._name) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._options) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if let v = self._name { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if let v = self._options { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_OneofDescriptorProto, rhs: Google_Protobuf_OneofDescriptorProto) -> Bool { + if lhs._name != rhs._name {return false} + if lhs._options != rhs._options {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Google_Protobuf_EnumDescriptorProto: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".EnumDescriptorProto" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "name"), + 2: .same(proto: "value"), + 3: .same(proto: "options"), + 4: .standard(proto: "reserved_range"), + 5: .standard(proto: "reserved_name"), + ] + + public var isInitialized: Bool { + if !SwiftProtobuf.Internal.areAllInitialized(self.value) {return false} + if let v = self._options, !v.isInitialized {return false} + return true + } + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self._name) }() + case 2: try { try decoder.decodeRepeatedMessageField(value: &self.value) }() + case 3: try { try decoder.decodeSingularMessageField(value: &self._options) }() + case 4: try { try decoder.decodeRepeatedMessageField(value: &self.reservedRange) }() + case 5: try { try decoder.decodeRepeatedStringField(value: &self.reservedName) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if let v = self._name { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if !self.value.isEmpty { + try visitor.visitRepeatedMessageField(value: self.value, fieldNumber: 2) + } + if let v = self._options { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } + if !self.reservedRange.isEmpty { + try visitor.visitRepeatedMessageField(value: self.reservedRange, fieldNumber: 4) + } + if !self.reservedName.isEmpty { + try visitor.visitRepeatedStringField(value: self.reservedName, fieldNumber: 5) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_EnumDescriptorProto, rhs: Google_Protobuf_EnumDescriptorProto) -> Bool { + if lhs._name != rhs._name {return false} + if lhs.value != rhs.value {return false} + if lhs._options != rhs._options {return false} + if lhs.reservedRange != rhs.reservedRange {return false} + if lhs.reservedName != rhs.reservedName {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Google_Protobuf_EnumDescriptorProto.EnumReservedRange: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = Google_Protobuf_EnumDescriptorProto.protoMessageName + ".EnumReservedRange" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "start"), + 2: .same(proto: "end"), + ] + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularInt32Field(value: &self._start) }() + case 2: try { try decoder.decodeSingularInt32Field(value: &self._end) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if let v = self._start { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 1) + } + if let v = self._end { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_EnumDescriptorProto.EnumReservedRange, rhs: Google_Protobuf_EnumDescriptorProto.EnumReservedRange) -> Bool { + if lhs._start != rhs._start {return false} + if lhs._end != rhs._end {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Google_Protobuf_EnumValueDescriptorProto: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".EnumValueDescriptorProto" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "name"), + 2: .same(proto: "number"), + 3: .same(proto: "options"), + ] + + public var isInitialized: Bool { + if let v = self._options, !v.isInitialized {return false} + return true + } + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self._name) }() + case 2: try { try decoder.decodeSingularInt32Field(value: &self._number) }() + case 3: try { try decoder.decodeSingularMessageField(value: &self._options) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if let v = self._name { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if let v = self._number { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 2) + } + if let v = self._options { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_EnumValueDescriptorProto, rhs: Google_Protobuf_EnumValueDescriptorProto) -> Bool { + if lhs._name != rhs._name {return false} + if lhs._number != rhs._number {return false} + if lhs._options != rhs._options {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Google_Protobuf_ServiceDescriptorProto: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".ServiceDescriptorProto" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "name"), + 2: .same(proto: "method"), + 3: .same(proto: "options"), + ] + + public var isInitialized: Bool { + if !SwiftProtobuf.Internal.areAllInitialized(self.method) {return false} + if let v = self._options, !v.isInitialized {return false} + return true + } + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self._name) }() + case 2: try { try decoder.decodeRepeatedMessageField(value: &self.method) }() + case 3: try { try decoder.decodeSingularMessageField(value: &self._options) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if let v = self._name { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if !self.method.isEmpty { + try visitor.visitRepeatedMessageField(value: self.method, fieldNumber: 2) + } + if let v = self._options { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_ServiceDescriptorProto, rhs: Google_Protobuf_ServiceDescriptorProto) -> Bool { + if lhs._name != rhs._name {return false} + if lhs.method != rhs.method {return false} + if lhs._options != rhs._options {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Google_Protobuf_MethodDescriptorProto: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".MethodDescriptorProto" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "name"), + 2: .standard(proto: "input_type"), + 3: .standard(proto: "output_type"), + 4: .same(proto: "options"), + 5: .standard(proto: "client_streaming"), + 6: .standard(proto: "server_streaming"), + ] + + public var isInitialized: Bool { + if let v = self._options, !v.isInitialized {return false} + return true + } + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self._name) }() + case 2: try { try decoder.decodeSingularStringField(value: &self._inputType) }() + case 3: try { try decoder.decodeSingularStringField(value: &self._outputType) }() + case 4: try { try decoder.decodeSingularMessageField(value: &self._options) }() + case 5: try { try decoder.decodeSingularBoolField(value: &self._clientStreaming) }() + case 6: try { try decoder.decodeSingularBoolField(value: &self._serverStreaming) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if let v = self._name { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if let v = self._inputType { + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + } + if let v = self._outputType { + try visitor.visitSingularStringField(value: v, fieldNumber: 3) + } + if let v = self._options { + try visitor.visitSingularMessageField(value: v, fieldNumber: 4) + } + if let v = self._clientStreaming { + try visitor.visitSingularBoolField(value: v, fieldNumber: 5) + } + if let v = self._serverStreaming { + try visitor.visitSingularBoolField(value: v, fieldNumber: 6) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_MethodDescriptorProto, rhs: Google_Protobuf_MethodDescriptorProto) -> Bool { + if lhs._name != rhs._name {return false} + if lhs._inputType != rhs._inputType {return false} + if lhs._outputType != rhs._outputType {return false} + if lhs._options != rhs._options {return false} + if lhs._clientStreaming != rhs._clientStreaming {return false} + if lhs._serverStreaming != rhs._serverStreaming {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Google_Protobuf_FileOptions: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".FileOptions" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "java_package"), + 8: .standard(proto: "java_outer_classname"), + 10: .standard(proto: "java_multiple_files"), + 20: .standard(proto: "java_generate_equals_and_hash"), + 27: .standard(proto: "java_string_check_utf8"), + 9: .standard(proto: "optimize_for"), + 11: .standard(proto: "go_package"), + 16: .standard(proto: "cc_generic_services"), + 17: .standard(proto: "java_generic_services"), + 18: .standard(proto: "py_generic_services"), + 42: .standard(proto: "php_generic_services"), + 23: .same(proto: "deprecated"), + 31: .standard(proto: "cc_enable_arenas"), + 36: .standard(proto: "objc_class_prefix"), + 37: .standard(proto: "csharp_namespace"), + 39: .standard(proto: "swift_prefix"), + 40: .standard(proto: "php_class_prefix"), + 41: .standard(proto: "php_namespace"), + 44: .standard(proto: "php_metadata_namespace"), + 45: .standard(proto: "ruby_package"), + 999: .standard(proto: "uninterpreted_option"), + ] + + fileprivate class _StorageClass { + var _javaPackage: String? = nil + var _javaOuterClassname: String? = nil + var _javaMultipleFiles: Bool? = nil + var _javaGenerateEqualsAndHash: Bool? = nil + var _javaStringCheckUtf8: Bool? = nil + var _optimizeFor: Google_Protobuf_FileOptions.OptimizeMode? = nil + var _goPackage: String? = nil + var _ccGenericServices: Bool? = nil + var _javaGenericServices: Bool? = nil + var _pyGenericServices: Bool? = nil + var _phpGenericServices: Bool? = nil + var _deprecated: Bool? = nil + var _ccEnableArenas: Bool? = nil + var _objcClassPrefix: String? = nil + var _csharpNamespace: String? = nil + var _swiftPrefix: String? = nil + var _phpClassPrefix: String? = nil + var _phpNamespace: String? = nil + var _phpMetadataNamespace: String? = nil + var _rubyPackage: String? = nil + var _uninterpretedOption: [Google_Protobuf_UninterpretedOption] = [] + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _javaPackage = source._javaPackage + _javaOuterClassname = source._javaOuterClassname + _javaMultipleFiles = source._javaMultipleFiles + _javaGenerateEqualsAndHash = source._javaGenerateEqualsAndHash + _javaStringCheckUtf8 = source._javaStringCheckUtf8 + _optimizeFor = source._optimizeFor + _goPackage = source._goPackage + _ccGenericServices = source._ccGenericServices + _javaGenericServices = source._javaGenericServices + _pyGenericServices = source._pyGenericServices + _phpGenericServices = source._phpGenericServices + _deprecated = source._deprecated + _ccEnableArenas = source._ccEnableArenas + _objcClassPrefix = source._objcClassPrefix + _csharpNamespace = source._csharpNamespace + _swiftPrefix = source._swiftPrefix + _phpClassPrefix = source._phpClassPrefix + _phpNamespace = source._phpNamespace + _phpMetadataNamespace = source._phpMetadataNamespace + _rubyPackage = source._rubyPackage + _uninterpretedOption = source._uninterpretedOption + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + + public var isInitialized: Bool { + if !_protobuf_extensionFieldValues.isInitialized {return false} + return withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if !SwiftProtobuf.Internal.areAllInitialized(_storage._uninterpretedOption) {return false} + return true + } + } + + public mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &_storage._javaPackage) }() + case 8: try { try decoder.decodeSingularStringField(value: &_storage._javaOuterClassname) }() + case 9: try { try decoder.decodeSingularEnumField(value: &_storage._optimizeFor) }() + case 10: try { try decoder.decodeSingularBoolField(value: &_storage._javaMultipleFiles) }() + case 11: try { try decoder.decodeSingularStringField(value: &_storage._goPackage) }() + case 16: try { try decoder.decodeSingularBoolField(value: &_storage._ccGenericServices) }() + case 17: try { try decoder.decodeSingularBoolField(value: &_storage._javaGenericServices) }() + case 18: try { try decoder.decodeSingularBoolField(value: &_storage._pyGenericServices) }() + case 20: try { try decoder.decodeSingularBoolField(value: &_storage._javaGenerateEqualsAndHash) }() + case 23: try { try decoder.decodeSingularBoolField(value: &_storage._deprecated) }() + case 27: try { try decoder.decodeSingularBoolField(value: &_storage._javaStringCheckUtf8) }() + case 31: try { try decoder.decodeSingularBoolField(value: &_storage._ccEnableArenas) }() + case 36: try { try decoder.decodeSingularStringField(value: &_storage._objcClassPrefix) }() + case 37: try { try decoder.decodeSingularStringField(value: &_storage._csharpNamespace) }() + case 39: try { try decoder.decodeSingularStringField(value: &_storage._swiftPrefix) }() + case 40: try { try decoder.decodeSingularStringField(value: &_storage._phpClassPrefix) }() + case 41: try { try decoder.decodeSingularStringField(value: &_storage._phpNamespace) }() + case 42: try { try decoder.decodeSingularBoolField(value: &_storage._phpGenericServices) }() + case 44: try { try decoder.decodeSingularStringField(value: &_storage._phpMetadataNamespace) }() + case 45: try { try decoder.decodeSingularStringField(value: &_storage._rubyPackage) }() + case 999: try { try decoder.decodeRepeatedMessageField(value: &_storage._uninterpretedOption) }() + case 1000..<536870912: + try { try decoder.decodeExtensionField(values: &_protobuf_extensionFieldValues, messageType: Google_Protobuf_FileOptions.self, fieldNumber: fieldNumber) }() + default: break + } + } + } + } + + public func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if let v = _storage._javaPackage { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if let v = _storage._javaOuterClassname { + try visitor.visitSingularStringField(value: v, fieldNumber: 8) + } + if let v = _storage._optimizeFor { + try visitor.visitSingularEnumField(value: v, fieldNumber: 9) + } + if let v = _storage._javaMultipleFiles { + try visitor.visitSingularBoolField(value: v, fieldNumber: 10) + } + if let v = _storage._goPackage { + try visitor.visitSingularStringField(value: v, fieldNumber: 11) + } + if let v = _storage._ccGenericServices { + try visitor.visitSingularBoolField(value: v, fieldNumber: 16) + } + if let v = _storage._javaGenericServices { + try visitor.visitSingularBoolField(value: v, fieldNumber: 17) + } + if let v = _storage._pyGenericServices { + try visitor.visitSingularBoolField(value: v, fieldNumber: 18) + } + if let v = _storage._javaGenerateEqualsAndHash { + try visitor.visitSingularBoolField(value: v, fieldNumber: 20) + } + if let v = _storage._deprecated { + try visitor.visitSingularBoolField(value: v, fieldNumber: 23) + } + if let v = _storage._javaStringCheckUtf8 { + try visitor.visitSingularBoolField(value: v, fieldNumber: 27) + } + if let v = _storage._ccEnableArenas { + try visitor.visitSingularBoolField(value: v, fieldNumber: 31) + } + if let v = _storage._objcClassPrefix { + try visitor.visitSingularStringField(value: v, fieldNumber: 36) + } + if let v = _storage._csharpNamespace { + try visitor.visitSingularStringField(value: v, fieldNumber: 37) + } + if let v = _storage._swiftPrefix { + try visitor.visitSingularStringField(value: v, fieldNumber: 39) + } + if let v = _storage._phpClassPrefix { + try visitor.visitSingularStringField(value: v, fieldNumber: 40) + } + if let v = _storage._phpNamespace { + try visitor.visitSingularStringField(value: v, fieldNumber: 41) + } + if let v = _storage._phpGenericServices { + try visitor.visitSingularBoolField(value: v, fieldNumber: 42) + } + if let v = _storage._phpMetadataNamespace { + try visitor.visitSingularStringField(value: v, fieldNumber: 44) + } + if let v = _storage._rubyPackage { + try visitor.visitSingularStringField(value: v, fieldNumber: 45) + } + if !_storage._uninterpretedOption.isEmpty { + try visitor.visitRepeatedMessageField(value: _storage._uninterpretedOption, fieldNumber: 999) + } + try visitor.visitExtensionFields(fields: _protobuf_extensionFieldValues, start: 1000, end: 536870912) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_FileOptions, rhs: Google_Protobuf_FileOptions) -> Bool { + if lhs._storage !== rhs._storage { + let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let rhs_storage = _args.1 + if _storage._javaPackage != rhs_storage._javaPackage {return false} + if _storage._javaOuterClassname != rhs_storage._javaOuterClassname {return false} + if _storage._javaMultipleFiles != rhs_storage._javaMultipleFiles {return false} + if _storage._javaGenerateEqualsAndHash != rhs_storage._javaGenerateEqualsAndHash {return false} + if _storage._javaStringCheckUtf8 != rhs_storage._javaStringCheckUtf8 {return false} + if _storage._optimizeFor != rhs_storage._optimizeFor {return false} + if _storage._goPackage != rhs_storage._goPackage {return false} + if _storage._ccGenericServices != rhs_storage._ccGenericServices {return false} + if _storage._javaGenericServices != rhs_storage._javaGenericServices {return false} + if _storage._pyGenericServices != rhs_storage._pyGenericServices {return false} + if _storage._phpGenericServices != rhs_storage._phpGenericServices {return false} + if _storage._deprecated != rhs_storage._deprecated {return false} + if _storage._ccEnableArenas != rhs_storage._ccEnableArenas {return false} + if _storage._objcClassPrefix != rhs_storage._objcClassPrefix {return false} + if _storage._csharpNamespace != rhs_storage._csharpNamespace {return false} + if _storage._swiftPrefix != rhs_storage._swiftPrefix {return false} + if _storage._phpClassPrefix != rhs_storage._phpClassPrefix {return false} + if _storage._phpNamespace != rhs_storage._phpNamespace {return false} + if _storage._phpMetadataNamespace != rhs_storage._phpMetadataNamespace {return false} + if _storage._rubyPackage != rhs_storage._rubyPackage {return false} + if _storage._uninterpretedOption != rhs_storage._uninterpretedOption {return false} + return true + } + if !storagesAreEqual {return false} + } + if lhs.unknownFields != rhs.unknownFields {return false} + if lhs._protobuf_extensionFieldValues != rhs._protobuf_extensionFieldValues {return false} + return true + } +} + +extension Google_Protobuf_FileOptions.OptimizeMode: SwiftProtobuf._ProtoNameProviding { + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "SPEED"), + 2: .same(proto: "CODE_SIZE"), + 3: .same(proto: "LITE_RUNTIME"), + ] +} + +extension Google_Protobuf_MessageOptions: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".MessageOptions" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "message_set_wire_format"), + 2: .standard(proto: "no_standard_descriptor_accessor"), + 3: .same(proto: "deprecated"), + 7: .standard(proto: "map_entry"), + 999: .standard(proto: "uninterpreted_option"), + ] + + public var isInitialized: Bool { + if !_protobuf_extensionFieldValues.isInitialized {return false} + if !SwiftProtobuf.Internal.areAllInitialized(self.uninterpretedOption) {return false} + return true + } + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularBoolField(value: &self._messageSetWireFormat) }() + case 2: try { try decoder.decodeSingularBoolField(value: &self._noStandardDescriptorAccessor) }() + case 3: try { try decoder.decodeSingularBoolField(value: &self._deprecated) }() + case 7: try { try decoder.decodeSingularBoolField(value: &self._mapEntry) }() + case 999: try { try decoder.decodeRepeatedMessageField(value: &self.uninterpretedOption) }() + case 1000..<536870912: + try { try decoder.decodeExtensionField(values: &_protobuf_extensionFieldValues, messageType: Google_Protobuf_MessageOptions.self, fieldNumber: fieldNumber) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if let v = self._messageSetWireFormat { + try visitor.visitSingularBoolField(value: v, fieldNumber: 1) + } + if let v = self._noStandardDescriptorAccessor { + try visitor.visitSingularBoolField(value: v, fieldNumber: 2) + } + if let v = self._deprecated { + try visitor.visitSingularBoolField(value: v, fieldNumber: 3) + } + if let v = self._mapEntry { + try visitor.visitSingularBoolField(value: v, fieldNumber: 7) + } + if !self.uninterpretedOption.isEmpty { + try visitor.visitRepeatedMessageField(value: self.uninterpretedOption, fieldNumber: 999) + } + try visitor.visitExtensionFields(fields: _protobuf_extensionFieldValues, start: 1000, end: 536870912) + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_MessageOptions, rhs: Google_Protobuf_MessageOptions) -> Bool { + if lhs._messageSetWireFormat != rhs._messageSetWireFormat {return false} + if lhs._noStandardDescriptorAccessor != rhs._noStandardDescriptorAccessor {return false} + if lhs._deprecated != rhs._deprecated {return false} + if lhs._mapEntry != rhs._mapEntry {return false} + if lhs.uninterpretedOption != rhs.uninterpretedOption {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + if lhs._protobuf_extensionFieldValues != rhs._protobuf_extensionFieldValues {return false} + return true + } +} + +extension Google_Protobuf_FieldOptions: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".FieldOptions" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "ctype"), + 2: .same(proto: "packed"), + 6: .same(proto: "jstype"), + 5: .same(proto: "lazy"), + 3: .same(proto: "deprecated"), + 10: .same(proto: "weak"), + 999: .standard(proto: "uninterpreted_option"), + ] + + public var isInitialized: Bool { + if !_protobuf_extensionFieldValues.isInitialized {return false} + if !SwiftProtobuf.Internal.areAllInitialized(self.uninterpretedOption) {return false} + return true + } + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularEnumField(value: &self._ctype) }() + case 2: try { try decoder.decodeSingularBoolField(value: &self._packed) }() + case 3: try { try decoder.decodeSingularBoolField(value: &self._deprecated) }() + case 5: try { try decoder.decodeSingularBoolField(value: &self._lazy) }() + case 6: try { try decoder.decodeSingularEnumField(value: &self._jstype) }() + case 10: try { try decoder.decodeSingularBoolField(value: &self._weak) }() + case 999: try { try decoder.decodeRepeatedMessageField(value: &self.uninterpretedOption) }() + case 1000..<536870912: + try { try decoder.decodeExtensionField(values: &_protobuf_extensionFieldValues, messageType: Google_Protobuf_FieldOptions.self, fieldNumber: fieldNumber) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if let v = self._ctype { + try visitor.visitSingularEnumField(value: v, fieldNumber: 1) + } + if let v = self._packed { + try visitor.visitSingularBoolField(value: v, fieldNumber: 2) + } + if let v = self._deprecated { + try visitor.visitSingularBoolField(value: v, fieldNumber: 3) + } + if let v = self._lazy { + try visitor.visitSingularBoolField(value: v, fieldNumber: 5) + } + if let v = self._jstype { + try visitor.visitSingularEnumField(value: v, fieldNumber: 6) + } + if let v = self._weak { + try visitor.visitSingularBoolField(value: v, fieldNumber: 10) + } + if !self.uninterpretedOption.isEmpty { + try visitor.visitRepeatedMessageField(value: self.uninterpretedOption, fieldNumber: 999) + } + try visitor.visitExtensionFields(fields: _protobuf_extensionFieldValues, start: 1000, end: 536870912) + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_FieldOptions, rhs: Google_Protobuf_FieldOptions) -> Bool { + if lhs._ctype != rhs._ctype {return false} + if lhs._packed != rhs._packed {return false} + if lhs._jstype != rhs._jstype {return false} + if lhs._lazy != rhs._lazy {return false} + if lhs._deprecated != rhs._deprecated {return false} + if lhs._weak != rhs._weak {return false} + if lhs.uninterpretedOption != rhs.uninterpretedOption {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + if lhs._protobuf_extensionFieldValues != rhs._protobuf_extensionFieldValues {return false} + return true + } +} + +extension Google_Protobuf_FieldOptions.CType: SwiftProtobuf._ProtoNameProviding { + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "STRING"), + 1: .same(proto: "CORD"), + 2: .same(proto: "STRING_PIECE"), + ] +} + +extension Google_Protobuf_FieldOptions.JSType: SwiftProtobuf._ProtoNameProviding { + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "JS_NORMAL"), + 1: .same(proto: "JS_STRING"), + 2: .same(proto: "JS_NUMBER"), + ] +} + +extension Google_Protobuf_OneofOptions: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".OneofOptions" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 999: .standard(proto: "uninterpreted_option"), + ] + + public var isInitialized: Bool { + if !_protobuf_extensionFieldValues.isInitialized {return false} + if !SwiftProtobuf.Internal.areAllInitialized(self.uninterpretedOption) {return false} + return true + } + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 999: try { try decoder.decodeRepeatedMessageField(value: &self.uninterpretedOption) }() + case 1000..<536870912: + try { try decoder.decodeExtensionField(values: &_protobuf_extensionFieldValues, messageType: Google_Protobuf_OneofOptions.self, fieldNumber: fieldNumber) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.uninterpretedOption.isEmpty { + try visitor.visitRepeatedMessageField(value: self.uninterpretedOption, fieldNumber: 999) + } + try visitor.visitExtensionFields(fields: _protobuf_extensionFieldValues, start: 1000, end: 536870912) + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_OneofOptions, rhs: Google_Protobuf_OneofOptions) -> Bool { + if lhs.uninterpretedOption != rhs.uninterpretedOption {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + if lhs._protobuf_extensionFieldValues != rhs._protobuf_extensionFieldValues {return false} + return true + } +} + +extension Google_Protobuf_EnumOptions: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".EnumOptions" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 2: .standard(proto: "allow_alias"), + 3: .same(proto: "deprecated"), + 999: .standard(proto: "uninterpreted_option"), + ] + + public var isInitialized: Bool { + if !_protobuf_extensionFieldValues.isInitialized {return false} + if !SwiftProtobuf.Internal.areAllInitialized(self.uninterpretedOption) {return false} + return true + } + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 2: try { try decoder.decodeSingularBoolField(value: &self._allowAlias) }() + case 3: try { try decoder.decodeSingularBoolField(value: &self._deprecated) }() + case 999: try { try decoder.decodeRepeatedMessageField(value: &self.uninterpretedOption) }() + case 1000..<536870912: + try { try decoder.decodeExtensionField(values: &_protobuf_extensionFieldValues, messageType: Google_Protobuf_EnumOptions.self, fieldNumber: fieldNumber) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if let v = self._allowAlias { + try visitor.visitSingularBoolField(value: v, fieldNumber: 2) + } + if let v = self._deprecated { + try visitor.visitSingularBoolField(value: v, fieldNumber: 3) + } + if !self.uninterpretedOption.isEmpty { + try visitor.visitRepeatedMessageField(value: self.uninterpretedOption, fieldNumber: 999) + } + try visitor.visitExtensionFields(fields: _protobuf_extensionFieldValues, start: 1000, end: 536870912) + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_EnumOptions, rhs: Google_Protobuf_EnumOptions) -> Bool { + if lhs._allowAlias != rhs._allowAlias {return false} + if lhs._deprecated != rhs._deprecated {return false} + if lhs.uninterpretedOption != rhs.uninterpretedOption {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + if lhs._protobuf_extensionFieldValues != rhs._protobuf_extensionFieldValues {return false} + return true + } +} + +extension Google_Protobuf_EnumValueOptions: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".EnumValueOptions" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "deprecated"), + 999: .standard(proto: "uninterpreted_option"), + ] + + public var isInitialized: Bool { + if !_protobuf_extensionFieldValues.isInitialized {return false} + if !SwiftProtobuf.Internal.areAllInitialized(self.uninterpretedOption) {return false} + return true + } + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularBoolField(value: &self._deprecated) }() + case 999: try { try decoder.decodeRepeatedMessageField(value: &self.uninterpretedOption) }() + case 1000..<536870912: + try { try decoder.decodeExtensionField(values: &_protobuf_extensionFieldValues, messageType: Google_Protobuf_EnumValueOptions.self, fieldNumber: fieldNumber) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if let v = self._deprecated { + try visitor.visitSingularBoolField(value: v, fieldNumber: 1) + } + if !self.uninterpretedOption.isEmpty { + try visitor.visitRepeatedMessageField(value: self.uninterpretedOption, fieldNumber: 999) + } + try visitor.visitExtensionFields(fields: _protobuf_extensionFieldValues, start: 1000, end: 536870912) + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_EnumValueOptions, rhs: Google_Protobuf_EnumValueOptions) -> Bool { + if lhs._deprecated != rhs._deprecated {return false} + if lhs.uninterpretedOption != rhs.uninterpretedOption {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + if lhs._protobuf_extensionFieldValues != rhs._protobuf_extensionFieldValues {return false} + return true + } +} + +extension Google_Protobuf_ServiceOptions: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".ServiceOptions" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 33: .same(proto: "deprecated"), + 999: .standard(proto: "uninterpreted_option"), + ] + + public var isInitialized: Bool { + if !_protobuf_extensionFieldValues.isInitialized {return false} + if !SwiftProtobuf.Internal.areAllInitialized(self.uninterpretedOption) {return false} + return true + } + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 33: try { try decoder.decodeSingularBoolField(value: &self._deprecated) }() + case 999: try { try decoder.decodeRepeatedMessageField(value: &self.uninterpretedOption) }() + case 1000..<536870912: + try { try decoder.decodeExtensionField(values: &_protobuf_extensionFieldValues, messageType: Google_Protobuf_ServiceOptions.self, fieldNumber: fieldNumber) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if let v = self._deprecated { + try visitor.visitSingularBoolField(value: v, fieldNumber: 33) + } + if !self.uninterpretedOption.isEmpty { + try visitor.visitRepeatedMessageField(value: self.uninterpretedOption, fieldNumber: 999) + } + try visitor.visitExtensionFields(fields: _protobuf_extensionFieldValues, start: 1000, end: 536870912) + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_ServiceOptions, rhs: Google_Protobuf_ServiceOptions) -> Bool { + if lhs._deprecated != rhs._deprecated {return false} + if lhs.uninterpretedOption != rhs.uninterpretedOption {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + if lhs._protobuf_extensionFieldValues != rhs._protobuf_extensionFieldValues {return false} + return true + } +} + +extension Google_Protobuf_MethodOptions: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".MethodOptions" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 33: .same(proto: "deprecated"), + 34: .standard(proto: "idempotency_level"), + 999: .standard(proto: "uninterpreted_option"), + ] + + public var isInitialized: Bool { + if !_protobuf_extensionFieldValues.isInitialized {return false} + if !SwiftProtobuf.Internal.areAllInitialized(self.uninterpretedOption) {return false} + return true + } + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 33: try { try decoder.decodeSingularBoolField(value: &self._deprecated) }() + case 34: try { try decoder.decodeSingularEnumField(value: &self._idempotencyLevel) }() + case 999: try { try decoder.decodeRepeatedMessageField(value: &self.uninterpretedOption) }() + case 1000..<536870912: + try { try decoder.decodeExtensionField(values: &_protobuf_extensionFieldValues, messageType: Google_Protobuf_MethodOptions.self, fieldNumber: fieldNumber) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if let v = self._deprecated { + try visitor.visitSingularBoolField(value: v, fieldNumber: 33) + } + if let v = self._idempotencyLevel { + try visitor.visitSingularEnumField(value: v, fieldNumber: 34) + } + if !self.uninterpretedOption.isEmpty { + try visitor.visitRepeatedMessageField(value: self.uninterpretedOption, fieldNumber: 999) + } + try visitor.visitExtensionFields(fields: _protobuf_extensionFieldValues, start: 1000, end: 536870912) + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_MethodOptions, rhs: Google_Protobuf_MethodOptions) -> Bool { + if lhs._deprecated != rhs._deprecated {return false} + if lhs._idempotencyLevel != rhs._idempotencyLevel {return false} + if lhs.uninterpretedOption != rhs.uninterpretedOption {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + if lhs._protobuf_extensionFieldValues != rhs._protobuf_extensionFieldValues {return false} + return true + } +} + +extension Google_Protobuf_MethodOptions.IdempotencyLevel: SwiftProtobuf._ProtoNameProviding { + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "IDEMPOTENCY_UNKNOWN"), + 1: .same(proto: "NO_SIDE_EFFECTS"), + 2: .same(proto: "IDEMPOTENT"), + ] +} + +extension Google_Protobuf_UninterpretedOption: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".UninterpretedOption" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 2: .same(proto: "name"), + 3: .standard(proto: "identifier_value"), + 4: .standard(proto: "positive_int_value"), + 5: .standard(proto: "negative_int_value"), + 6: .standard(proto: "double_value"), + 7: .standard(proto: "string_value"), + 8: .standard(proto: "aggregate_value"), + ] + + public var isInitialized: Bool { + if !SwiftProtobuf.Internal.areAllInitialized(self.name) {return false} + return true + } + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 2: try { try decoder.decodeRepeatedMessageField(value: &self.name) }() + case 3: try { try decoder.decodeSingularStringField(value: &self._identifierValue) }() + case 4: try { try decoder.decodeSingularUInt64Field(value: &self._positiveIntValue) }() + case 5: try { try decoder.decodeSingularInt64Field(value: &self._negativeIntValue) }() + case 6: try { try decoder.decodeSingularDoubleField(value: &self._doubleValue) }() + case 7: try { try decoder.decodeSingularBytesField(value: &self._stringValue) }() + case 8: try { try decoder.decodeSingularStringField(value: &self._aggregateValue) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.name.isEmpty { + try visitor.visitRepeatedMessageField(value: self.name, fieldNumber: 2) + } + if let v = self._identifierValue { + try visitor.visitSingularStringField(value: v, fieldNumber: 3) + } + if let v = self._positiveIntValue { + try visitor.visitSingularUInt64Field(value: v, fieldNumber: 4) + } + if let v = self._negativeIntValue { + try visitor.visitSingularInt64Field(value: v, fieldNumber: 5) + } + if let v = self._doubleValue { + try visitor.visitSingularDoubleField(value: v, fieldNumber: 6) + } + if let v = self._stringValue { + try visitor.visitSingularBytesField(value: v, fieldNumber: 7) + } + if let v = self._aggregateValue { + try visitor.visitSingularStringField(value: v, fieldNumber: 8) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_UninterpretedOption, rhs: Google_Protobuf_UninterpretedOption) -> Bool { + if lhs.name != rhs.name {return false} + if lhs._identifierValue != rhs._identifierValue {return false} + if lhs._positiveIntValue != rhs._positiveIntValue {return false} + if lhs._negativeIntValue != rhs._negativeIntValue {return false} + if lhs._doubleValue != rhs._doubleValue {return false} + if lhs._stringValue != rhs._stringValue {return false} + if lhs._aggregateValue != rhs._aggregateValue {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Google_Protobuf_UninterpretedOption.NamePart: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = Google_Protobuf_UninterpretedOption.protoMessageName + ".NamePart" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "name_part"), + 2: .standard(proto: "is_extension"), + ] + + public var isInitialized: Bool { + if self._namePart == nil {return false} + if self._isExtension == nil {return false} + return true + } + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self._namePart) }() + case 2: try { try decoder.decodeSingularBoolField(value: &self._isExtension) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if let v = self._namePart { + try visitor.visitSingularStringField(value: v, fieldNumber: 1) + } + if let v = self._isExtension { + try visitor.visitSingularBoolField(value: v, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_UninterpretedOption.NamePart, rhs: Google_Protobuf_UninterpretedOption.NamePart) -> Bool { + if lhs._namePart != rhs._namePart {return false} + if lhs._isExtension != rhs._isExtension {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Google_Protobuf_SourceCodeInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".SourceCodeInfo" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "location"), + ] + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeRepeatedMessageField(value: &self.location) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.location.isEmpty { + try visitor.visitRepeatedMessageField(value: self.location, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_SourceCodeInfo, rhs: Google_Protobuf_SourceCodeInfo) -> Bool { + if lhs.location != rhs.location {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Google_Protobuf_SourceCodeInfo.Location: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = Google_Protobuf_SourceCodeInfo.protoMessageName + ".Location" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "path"), + 2: .same(proto: "span"), + 3: .standard(proto: "leading_comments"), + 4: .standard(proto: "trailing_comments"), + 6: .standard(proto: "leading_detached_comments"), + ] + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeRepeatedInt32Field(value: &self.path) }() + case 2: try { try decoder.decodeRepeatedInt32Field(value: &self.span) }() + case 3: try { try decoder.decodeSingularStringField(value: &self._leadingComments) }() + case 4: try { try decoder.decodeSingularStringField(value: &self._trailingComments) }() + case 6: try { try decoder.decodeRepeatedStringField(value: &self.leadingDetachedComments) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.path.isEmpty { + try visitor.visitPackedInt32Field(value: self.path, fieldNumber: 1) + } + if !self.span.isEmpty { + try visitor.visitPackedInt32Field(value: self.span, fieldNumber: 2) + } + if let v = self._leadingComments { + try visitor.visitSingularStringField(value: v, fieldNumber: 3) + } + if let v = self._trailingComments { + try visitor.visitSingularStringField(value: v, fieldNumber: 4) + } + if !self.leadingDetachedComments.isEmpty { + try visitor.visitRepeatedStringField(value: self.leadingDetachedComments, fieldNumber: 6) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_SourceCodeInfo.Location, rhs: Google_Protobuf_SourceCodeInfo.Location) -> Bool { + if lhs.path != rhs.path {return false} + if lhs.span != rhs.span {return false} + if lhs._leadingComments != rhs._leadingComments {return false} + if lhs._trailingComments != rhs._trailingComments {return false} + if lhs.leadingDetachedComments != rhs.leadingDetachedComments {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Google_Protobuf_GeneratedCodeInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".GeneratedCodeInfo" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "annotation"), + ] + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeRepeatedMessageField(value: &self.annotation) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.annotation.isEmpty { + try visitor.visitRepeatedMessageField(value: self.annotation, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_GeneratedCodeInfo, rhs: Google_Protobuf_GeneratedCodeInfo) -> Bool { + if lhs.annotation != rhs.annotation {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Google_Protobuf_GeneratedCodeInfo.Annotation: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = Google_Protobuf_GeneratedCodeInfo.protoMessageName + ".Annotation" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "path"), + 2: .standard(proto: "source_file"), + 3: .same(proto: "begin"), + 4: .same(proto: "end"), + ] + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeRepeatedInt32Field(value: &self.path) }() + case 2: try { try decoder.decodeSingularStringField(value: &self._sourceFile) }() + case 3: try { try decoder.decodeSingularInt32Field(value: &self._begin) }() + case 4: try { try decoder.decodeSingularInt32Field(value: &self._end) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.path.isEmpty { + try visitor.visitPackedInt32Field(value: self.path, fieldNumber: 1) + } + if let v = self._sourceFile { + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + } + if let v = self._begin { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 3) + } + if let v = self._end { + try visitor.visitSingularInt32Field(value: v, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_GeneratedCodeInfo.Annotation, rhs: Google_Protobuf_GeneratedCodeInfo.Annotation) -> Bool { + if lhs.path != rhs.path {return false} + if lhs._sourceFile != rhs._sourceFile {return false} + if lhs._begin != rhs._begin {return false} + if lhs._end != rhs._end {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/duration.pb.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/duration.pb.swift new file mode 100644 index 0000000..6ea4d6c --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/duration.pb.swift @@ -0,0 +1,173 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: google/protobuf/duration.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import Foundation + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +/// A Duration represents a signed, fixed-length span of time represented +/// as a count of seconds and fractions of seconds at nanosecond +/// resolution. It is independent of any calendar and concepts like "day" +/// or "month". It is related to Timestamp in that the difference between +/// two Timestamp values is a Duration and it can be added or subtracted +/// from a Timestamp. Range is approximately +-10,000 years. +/// +/// # Examples +/// +/// Example 1: Compute Duration from two Timestamps in pseudo code. +/// +/// Timestamp start = ...; +/// Timestamp end = ...; +/// Duration duration = ...; +/// +/// duration.seconds = end.seconds - start.seconds; +/// duration.nanos = end.nanos - start.nanos; +/// +/// if (duration.seconds < 0 && duration.nanos > 0) { +/// duration.seconds += 1; +/// duration.nanos -= 1000000000; +/// } else if (duration.seconds > 0 && duration.nanos < 0) { +/// duration.seconds -= 1; +/// duration.nanos += 1000000000; +/// } +/// +/// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. +/// +/// Timestamp start = ...; +/// Duration duration = ...; +/// Timestamp end = ...; +/// +/// end.seconds = start.seconds + duration.seconds; +/// end.nanos = start.nanos + duration.nanos; +/// +/// if (end.nanos < 0) { +/// end.seconds -= 1; +/// end.nanos += 1000000000; +/// } else if (end.nanos >= 1000000000) { +/// end.seconds += 1; +/// end.nanos -= 1000000000; +/// } +/// +/// Example 3: Compute Duration from datetime.timedelta in Python. +/// +/// td = datetime.timedelta(days=3, minutes=10) +/// duration = Duration() +/// duration.FromTimedelta(td) +/// +/// # JSON Mapping +/// +/// In JSON format, the Duration type is encoded as a string rather than an +/// object, where the string ends in the suffix "s" (indicating seconds) and +/// is preceded by the number of seconds, with nanoseconds expressed as +/// fractional seconds. For example, 3 seconds with 0 nanoseconds should be +/// encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should +/// be expressed in JSON format as "3.000000001s", and 3 seconds and 1 +/// microsecond should be expressed in JSON format as "3.000001s". +public struct Google_Protobuf_Duration { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Signed seconds of the span of time. Must be from -315,576,000,000 + /// to +315,576,000,000 inclusive. Note: these bounds are computed from: + /// 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + public var seconds: Int64 = 0 + + /// Signed fractions of a second at nanosecond resolution of the span + /// of time. Durations less than one second are represented with a 0 + /// `seconds` field and a positive or negative `nanos` field. For durations + /// of one second or more, a non-zero value for the `nanos` field must be + /// of the same sign as the `seconds` field. Must be from -999,999,999 + /// to +999,999,999 inclusive. + public var nanos: Int32 = 0 + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "google.protobuf" + +extension Google_Protobuf_Duration: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".Duration" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "seconds"), + 2: .same(proto: "nanos"), + ] + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularInt64Field(value: &self.seconds) }() + case 2: try { try decoder.decodeSingularInt32Field(value: &self.nanos) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if self.seconds != 0 { + try visitor.visitSingularInt64Field(value: self.seconds, fieldNumber: 1) + } + if self.nanos != 0 { + try visitor.visitSingularInt32Field(value: self.nanos, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_Duration, rhs: Google_Protobuf_Duration) -> Bool { + if lhs.seconds != rhs.seconds {return false} + if lhs.nanos != rhs.nanos {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/empty.pb.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/empty.pb.swift new file mode 100644 index 0000000..bdfdc7f --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/empty.pb.swift @@ -0,0 +1,92 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: google/protobuf/empty.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import Foundation + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +/// A generic empty message that you can re-use to avoid defining duplicated +/// empty messages in your APIs. A typical example is to use it as the request +/// or the response type of an API method. For instance: +/// +/// service Foo { +/// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); +/// } +/// +/// The JSON representation for `Empty` is empty JSON object `{}`. +public struct Google_Protobuf_Empty { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "google.protobuf" + +extension Google_Protobuf_Empty: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".Empty" + public static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + public mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + public func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_Empty, rhs: Google_Protobuf_Empty) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/field_mask.pb.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/field_mask.pb.swift new file mode 100644 index 0000000..508015e --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/field_mask.pb.swift @@ -0,0 +1,298 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: google/protobuf/field_mask.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import Foundation + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +/// `FieldMask` represents a set of symbolic field paths, for example: +/// +/// paths: "f.a" +/// paths: "f.b.d" +/// +/// Here `f` represents a field in some root message, `a` and `b` +/// fields in the message found in `f`, and `d` a field found in the +/// message in `f.b`. +/// +/// Field masks are used to specify a subset of fields that should be +/// returned by a get operation or modified by an update operation. +/// Field masks also have a custom JSON encoding (see below). +/// +/// # Field Masks in Projections +/// +/// When used in the context of a projection, a response message or +/// sub-message is filtered by the API to only contain those fields as +/// specified in the mask. For example, if the mask in the previous +/// example is applied to a response message as follows: +/// +/// f { +/// a : 22 +/// b { +/// d : 1 +/// x : 2 +/// } +/// y : 13 +/// } +/// z: 8 +/// +/// The result will not contain specific values for fields x,y and z +/// (their value will be set to the default, and omitted in proto text +/// output): +/// +/// +/// f { +/// a : 22 +/// b { +/// d : 1 +/// } +/// } +/// +/// A repeated field is not allowed except at the last position of a +/// paths string. +/// +/// If a FieldMask object is not present in a get operation, the +/// operation applies to all fields (as if a FieldMask of all fields +/// had been specified). +/// +/// Note that a field mask does not necessarily apply to the +/// top-level response message. In case of a REST get operation, the +/// field mask applies directly to the response, but in case of a REST +/// list operation, the mask instead applies to each individual message +/// in the returned resource list. In case of a REST custom method, +/// other definitions may be used. Where the mask applies will be +/// clearly documented together with its declaration in the API. In +/// any case, the effect on the returned resource/resources is required +/// behavior for APIs. +/// +/// # Field Masks in Update Operations +/// +/// A field mask in update operations specifies which fields of the +/// targeted resource are going to be updated. The API is required +/// to only change the values of the fields as specified in the mask +/// and leave the others untouched. If a resource is passed in to +/// describe the updated values, the API ignores the values of all +/// fields not covered by the mask. +/// +/// If a repeated field is specified for an update operation, new values will +/// be appended to the existing repeated field in the target resource. Note that +/// a repeated field is only allowed in the last position of a `paths` string. +/// +/// If a sub-message is specified in the last position of the field mask for an +/// update operation, then new value will be merged into the existing sub-message +/// in the target resource. +/// +/// For example, given the target message: +/// +/// f { +/// b { +/// d: 1 +/// x: 2 +/// } +/// c: [1] +/// } +/// +/// And an update message: +/// +/// f { +/// b { +/// d: 10 +/// } +/// c: [2] +/// } +/// +/// then if the field mask is: +/// +/// paths: ["f.b", "f.c"] +/// +/// then the result will be: +/// +/// f { +/// b { +/// d: 10 +/// x: 2 +/// } +/// c: [1, 2] +/// } +/// +/// An implementation may provide options to override this default behavior for +/// repeated and message fields. +/// +/// In order to reset a field's value to the default, the field must +/// be in the mask and set to the default value in the provided resource. +/// Hence, in order to reset all fields of a resource, provide a default +/// instance of the resource and set all fields in the mask, or do +/// not provide a mask as described below. +/// +/// If a field mask is not present on update, the operation applies to +/// all fields (as if a field mask of all fields has been specified). +/// Note that in the presence of schema evolution, this may mean that +/// fields the client does not know and has therefore not filled into +/// the request will be reset to their default. If this is unwanted +/// behavior, a specific service may require a client to always specify +/// a field mask, producing an error if not. +/// +/// As with get operations, the location of the resource which +/// describes the updated values in the request message depends on the +/// operation kind. In any case, the effect of the field mask is +/// required to be honored by the API. +/// +/// ## Considerations for HTTP REST +/// +/// The HTTP kind of an update operation which uses a field mask must +/// be set to PATCH instead of PUT in order to satisfy HTTP semantics +/// (PUT must only be used for full updates). +/// +/// # JSON Encoding of Field Masks +/// +/// In JSON, a field mask is encoded as a single string where paths are +/// separated by a comma. Fields name in each path are converted +/// to/from lower-camel naming conventions. +/// +/// As an example, consider the following message declarations: +/// +/// message Profile { +/// User user = 1; +/// Photo photo = 2; +/// } +/// message User { +/// string display_name = 1; +/// string address = 2; +/// } +/// +/// In proto a field mask for `Profile` may look as such: +/// +/// mask { +/// paths: "user.display_name" +/// paths: "photo" +/// } +/// +/// In JSON, the same mask is represented as below: +/// +/// { +/// mask: "user.displayName,photo" +/// } +/// +/// # Field Masks and Oneof Fields +/// +/// Field masks treat fields in oneofs just as regular fields. Consider the +/// following message: +/// +/// message SampleMessage { +/// oneof test_oneof { +/// string name = 4; +/// SubMessage sub_message = 9; +/// } +/// } +/// +/// The field mask can be: +/// +/// mask { +/// paths: "name" +/// } +/// +/// Or: +/// +/// mask { +/// paths: "sub_message" +/// } +/// +/// Note that oneof type names ("test_oneof" in this case) cannot be used in +/// paths. +/// +/// ## Field Mask Verification +/// +/// The implementation of any API method which has a FieldMask type field in the +/// request should verify the included field paths, and return an +/// `INVALID_ARGUMENT` error if any path is unmappable. +public struct Google_Protobuf_FieldMask { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The set of field mask paths. + public var paths: [String] = [] + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "google.protobuf" + +extension Google_Protobuf_FieldMask: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".FieldMask" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "paths"), + ] + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeRepeatedStringField(value: &self.paths) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.paths.isEmpty { + try visitor.visitRepeatedStringField(value: self.paths, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_FieldMask, rhs: Google_Protobuf_FieldMask) -> Bool { + if lhs.paths != rhs.paths {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/source_context.pb.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/source_context.pb.swift new file mode 100644 index 0000000..8c0aebd --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/source_context.pb.swift @@ -0,0 +1,102 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: google/protobuf/source_context.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import Foundation + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +/// `SourceContext` represents information about the source of a +/// protobuf element, like the file in which it is defined. +public struct Google_Protobuf_SourceContext { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The path-qualified name of the .proto file that contained the associated + /// protobuf element. For example: `"google/protobuf/source_context.proto"`. + public var fileName: String = String() + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "google.protobuf" + +extension Google_Protobuf_SourceContext: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".SourceContext" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "file_name"), + ] + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self.fileName) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.fileName.isEmpty { + try visitor.visitSingularStringField(value: self.fileName, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_SourceContext, rhs: Google_Protobuf_SourceContext) -> Bool { + if lhs.fileName != rhs.fileName {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/struct.pb.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/struct.pb.swift new file mode 100644 index 0000000..0383572 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/struct.pb.swift @@ -0,0 +1,432 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: google/protobuf/struct.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import Foundation + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +/// `NullValue` is a singleton enumeration to represent the null value for the +/// `Value` type union. +/// +/// The JSON representation for `NullValue` is JSON `null`. +public enum Google_Protobuf_NullValue: SwiftProtobuf.Enum { + public typealias RawValue = Int + + /// Null value. + case nullValue // = 0 + case UNRECOGNIZED(Int) + + public init() { + self = .nullValue + } + + public init?(rawValue: Int) { + switch rawValue { + case 0: self = .nullValue + default: self = .UNRECOGNIZED(rawValue) + } + } + + public var rawValue: Int { + switch self { + case .nullValue: return 0 + case .UNRECOGNIZED(let i): return i + } + } + +} + +#if swift(>=4.2) + +extension Google_Protobuf_NullValue: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + public static var allCases: [Google_Protobuf_NullValue] = [ + .nullValue, + ] +} + +#endif // swift(>=4.2) + +/// `Struct` represents a structured data value, consisting of fields +/// which map to dynamically typed values. In some languages, `Struct` +/// might be supported by a native representation. For example, in +/// scripting languages like JS a struct is represented as an +/// object. The details of that representation are described together +/// with the proto support for the language. +/// +/// The JSON representation for `Struct` is JSON object. +public struct Google_Protobuf_Struct { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Unordered map of dynamically typed values. + public var fields: Dictionary = [:] + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + +/// `Value` represents a dynamically typed value which can be either +/// null, a number, a string, a boolean, a recursive struct value, or a +/// list of values. A producer of value is expected to set one of that +/// variants, absence of any variant indicates an error. +/// +/// The JSON representation for `Value` is JSON value. +public struct Google_Protobuf_Value { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The kind of value. + public var kind: Google_Protobuf_Value.OneOf_Kind? = nil + + /// Represents a null value. + public var nullValue: Google_Protobuf_NullValue { + get { + if case .nullValue(let v)? = kind {return v} + return .nullValue + } + set {kind = .nullValue(newValue)} + } + + /// Represents a double value. + public var numberValue: Double { + get { + if case .numberValue(let v)? = kind {return v} + return 0 + } + set {kind = .numberValue(newValue)} + } + + /// Represents a string value. + public var stringValue: String { + get { + if case .stringValue(let v)? = kind {return v} + return String() + } + set {kind = .stringValue(newValue)} + } + + /// Represents a boolean value. + public var boolValue: Bool { + get { + if case .boolValue(let v)? = kind {return v} + return false + } + set {kind = .boolValue(newValue)} + } + + /// Represents a structured value. + public var structValue: Google_Protobuf_Struct { + get { + if case .structValue(let v)? = kind {return v} + return Google_Protobuf_Struct() + } + set {kind = .structValue(newValue)} + } + + /// Represents a repeated `Value`. + public var listValue: Google_Protobuf_ListValue { + get { + if case .listValue(let v)? = kind {return v} + return Google_Protobuf_ListValue() + } + set {kind = .listValue(newValue)} + } + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + /// The kind of value. + public enum OneOf_Kind: Equatable { + /// Represents a null value. + case nullValue(Google_Protobuf_NullValue) + /// Represents a double value. + case numberValue(Double) + /// Represents a string value. + case stringValue(String) + /// Represents a boolean value. + case boolValue(Bool) + /// Represents a structured value. + case structValue(Google_Protobuf_Struct) + /// Represents a repeated `Value`. + case listValue(Google_Protobuf_ListValue) + + #if !swift(>=4.1) + public static func ==(lhs: Google_Protobuf_Value.OneOf_Kind, rhs: Google_Protobuf_Value.OneOf_Kind) -> Bool { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch (lhs, rhs) { + case (.nullValue, .nullValue): return { + guard case .nullValue(let l) = lhs, case .nullValue(let r) = rhs else { preconditionFailure() } + return l == r + }() + case (.numberValue, .numberValue): return { + guard case .numberValue(let l) = lhs, case .numberValue(let r) = rhs else { preconditionFailure() } + return l == r + }() + case (.stringValue, .stringValue): return { + guard case .stringValue(let l) = lhs, case .stringValue(let r) = rhs else { preconditionFailure() } + return l == r + }() + case (.boolValue, .boolValue): return { + guard case .boolValue(let l) = lhs, case .boolValue(let r) = rhs else { preconditionFailure() } + return l == r + }() + case (.structValue, .structValue): return { + guard case .structValue(let l) = lhs, case .structValue(let r) = rhs else { preconditionFailure() } + return l == r + }() + case (.listValue, .listValue): return { + guard case .listValue(let l) = lhs, case .listValue(let r) = rhs else { preconditionFailure() } + return l == r + }() + default: return false + } + } + #endif + } + + public init() {} +} + +/// `ListValue` is a wrapper around a repeated field of values. +/// +/// The JSON representation for `ListValue` is JSON array. +public struct Google_Protobuf_ListValue { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Repeated field of dynamically typed values. + public var values: [Google_Protobuf_Value] = [] + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "google.protobuf" + +extension Google_Protobuf_NullValue: SwiftProtobuf._ProtoNameProviding { + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "NULL_VALUE"), + ] +} + +extension Google_Protobuf_Struct: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".Struct" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "fields"), + ] + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap.self, value: &self.fields) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.fields.isEmpty { + try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap.self, value: self.fields, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_Struct, rhs: Google_Protobuf_Struct) -> Bool { + if lhs.fields != rhs.fields {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Google_Protobuf_Value: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".Value" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "null_value"), + 2: .standard(proto: "number_value"), + 3: .standard(proto: "string_value"), + 4: .standard(proto: "bool_value"), + 5: .standard(proto: "struct_value"), + 6: .standard(proto: "list_value"), + ] + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { + if self.kind != nil {try decoder.handleConflictingOneOf()} + var v: Google_Protobuf_NullValue? + try decoder.decodeSingularEnumField(value: &v) + if let v = v {self.kind = .nullValue(v)} + }() + case 2: try { + if self.kind != nil {try decoder.handleConflictingOneOf()} + var v: Double? + try decoder.decodeSingularDoubleField(value: &v) + if let v = v {self.kind = .numberValue(v)} + }() + case 3: try { + if self.kind != nil {try decoder.handleConflictingOneOf()} + var v: String? + try decoder.decodeSingularStringField(value: &v) + if let v = v {self.kind = .stringValue(v)} + }() + case 4: try { + if self.kind != nil {try decoder.handleConflictingOneOf()} + var v: Bool? + try decoder.decodeSingularBoolField(value: &v) + if let v = v {self.kind = .boolValue(v)} + }() + case 5: try { + var v: Google_Protobuf_Struct? + if let current = self.kind { + try decoder.handleConflictingOneOf() + if case .structValue(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {self.kind = .structValue(v)} + }() + case 6: try { + var v: Google_Protobuf_ListValue? + if let current = self.kind { + try decoder.handleConflictingOneOf() + if case .listValue(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {self.kind = .listValue(v)} + }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch self.kind { + case .nullValue?: try { + guard case .nullValue(let v)? = self.kind else { preconditionFailure() } + try visitor.visitSingularEnumField(value: v, fieldNumber: 1) + }() + case .numberValue?: try { + guard case .numberValue(let v)? = self.kind else { preconditionFailure() } + try visitor.visitSingularDoubleField(value: v, fieldNumber: 2) + }() + case .stringValue?: try { + guard case .stringValue(let v)? = self.kind else { preconditionFailure() } + try visitor.visitSingularStringField(value: v, fieldNumber: 3) + }() + case .boolValue?: try { + guard case .boolValue(let v)? = self.kind else { preconditionFailure() } + try visitor.visitSingularBoolField(value: v, fieldNumber: 4) + }() + case .structValue?: try { + guard case .structValue(let v)? = self.kind else { preconditionFailure() } + try visitor.visitSingularMessageField(value: v, fieldNumber: 5) + }() + case .listValue?: try { + guard case .listValue(let v)? = self.kind else { preconditionFailure() } + try visitor.visitSingularMessageField(value: v, fieldNumber: 6) + }() + case nil: break + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_Value, rhs: Google_Protobuf_Value) -> Bool { + if lhs.kind != rhs.kind {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Google_Protobuf_ListValue: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".ListValue" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "values"), + ] + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeRepeatedMessageField(value: &self.values) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.values.isEmpty { + try visitor.visitRepeatedMessageField(value: self.values, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_ListValue, rhs: Google_Protobuf_ListValue) -> Bool { + if lhs.values != rhs.values {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/timestamp.pb.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/timestamp.pb.swift new file mode 100644 index 0000000..1f97147 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/timestamp.pb.swift @@ -0,0 +1,204 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: google/protobuf/timestamp.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import Foundation + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +/// A Timestamp represents a point in time independent of any time zone or local +/// calendar, encoded as a count of seconds and fractions of seconds at +/// nanosecond resolution. The count is relative to an epoch at UTC midnight on +/// January 1, 1970, in the proleptic Gregorian calendar which extends the +/// Gregorian calendar backwards to year one. +/// +/// All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap +/// second table is needed for interpretation, using a [24-hour linear +/// smear](https://developers.google.com/time/smear). +/// +/// The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By +/// restricting to that range, we ensure that we can convert to and from [RFC +/// 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. +/// +/// # Examples +/// +/// Example 1: Compute Timestamp from POSIX `time()`. +/// +/// Timestamp timestamp; +/// timestamp.set_seconds(time(NULL)); +/// timestamp.set_nanos(0); +/// +/// Example 2: Compute Timestamp from POSIX `gettimeofday()`. +/// +/// struct timeval tv; +/// gettimeofday(&tv, NULL); +/// +/// Timestamp timestamp; +/// timestamp.set_seconds(tv.tv_sec); +/// timestamp.set_nanos(tv.tv_usec * 1000); +/// +/// Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. +/// +/// FILETIME ft; +/// GetSystemTimeAsFileTime(&ft); +/// UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; +/// +/// // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z +/// // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. +/// Timestamp timestamp; +/// timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); +/// timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); +/// +/// Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. +/// +/// long millis = System.currentTimeMillis(); +/// +/// Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) +/// .setNanos((int) ((millis % 1000) * 1000000)).build(); +/// +/// +/// Example 5: Compute Timestamp from Java `Instant.now()`. +/// +/// Instant now = Instant.now(); +/// +/// Timestamp timestamp = +/// Timestamp.newBuilder().setSeconds(now.getEpochSecond()) +/// .setNanos(now.getNano()).build(); +/// +/// +/// Example 6: Compute Timestamp from current time in Python. +/// +/// timestamp = Timestamp() +/// timestamp.GetCurrentTime() +/// +/// # JSON Mapping +/// +/// In JSON format, the Timestamp type is encoded as a string in the +/// [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the +/// format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" +/// where {year} is always expressed using four digits while {month}, {day}, +/// {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional +/// seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), +/// are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone +/// is required. A proto3 JSON serializer should always use UTC (as indicated by +/// "Z") when printing the Timestamp type and a proto3 JSON parser should be +/// able to accept both UTC and other timezones (as indicated by an offset). +/// +/// For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past +/// 01:30 UTC on January 15, 2017. +/// +/// In JavaScript, one can convert a Date object to this format using the +/// standard +/// [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) +/// method. In Python, a standard `datetime.datetime` object can be converted +/// to this format using +/// [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with +/// the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use +/// the Joda Time's [`ISODateTimeFormat.dateTime()`]( +/// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D +/// ) to obtain a formatter capable of generating timestamps in this format. +public struct Google_Protobuf_Timestamp { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Represents seconds of UTC time since Unix epoch + /// 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to + /// 9999-12-31T23:59:59Z inclusive. + public var seconds: Int64 = 0 + + /// Non-negative fractions of a second at nanosecond resolution. Negative + /// second values with fractions must still have non-negative nanos values + /// that count forward in time. Must be from 0 to 999,999,999 + /// inclusive. + public var nanos: Int32 = 0 + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "google.protobuf" + +extension Google_Protobuf_Timestamp: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".Timestamp" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "seconds"), + 2: .same(proto: "nanos"), + ] + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularInt64Field(value: &self.seconds) }() + case 2: try { try decoder.decodeSingularInt32Field(value: &self.nanos) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if self.seconds != 0 { + try visitor.visitSingularInt64Field(value: self.seconds, fieldNumber: 1) + } + if self.nanos != 0 { + try visitor.visitSingularInt32Field(value: self.nanos, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_Timestamp, rhs: Google_Protobuf_Timestamp) -> Bool { + if lhs.seconds != rhs.seconds {return false} + if lhs.nanos != rhs.nanos {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/type.pb.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/type.pb.swift new file mode 100644 index 0000000..8ce6ea6 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/type.pb.swift @@ -0,0 +1,794 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: google/protobuf/type.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import Foundation + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +/// The syntax in which a protocol buffer element is defined. +public enum Google_Protobuf_Syntax: SwiftProtobuf.Enum { + public typealias RawValue = Int + + /// Syntax `proto2`. + case proto2 // = 0 + + /// Syntax `proto3`. + case proto3 // = 1 + case UNRECOGNIZED(Int) + + public init() { + self = .proto2 + } + + public init?(rawValue: Int) { + switch rawValue { + case 0: self = .proto2 + case 1: self = .proto3 + default: self = .UNRECOGNIZED(rawValue) + } + } + + public var rawValue: Int { + switch self { + case .proto2: return 0 + case .proto3: return 1 + case .UNRECOGNIZED(let i): return i + } + } + +} + +#if swift(>=4.2) + +extension Google_Protobuf_Syntax: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + public static var allCases: [Google_Protobuf_Syntax] = [ + .proto2, + .proto3, + ] +} + +#endif // swift(>=4.2) + +/// A protocol buffer message type. +public struct Google_Protobuf_Type { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The fully qualified message name. + public var name: String = String() + + /// The list of fields. + public var fields: [Google_Protobuf_Field] = [] + + /// The list of types appearing in `oneof` definitions in this type. + public var oneofs: [String] = [] + + /// The protocol buffer options. + public var options: [Google_Protobuf_Option] = [] + + /// The source context. + public var sourceContext: Google_Protobuf_SourceContext { + get {return _sourceContext ?? Google_Protobuf_SourceContext()} + set {_sourceContext = newValue} + } + /// Returns true if `sourceContext` has been explicitly set. + public var hasSourceContext: Bool {return self._sourceContext != nil} + /// Clears the value of `sourceContext`. Subsequent reads from it will return its default value. + public mutating func clearSourceContext() {self._sourceContext = nil} + + /// The source syntax. + public var syntax: Google_Protobuf_Syntax = .proto2 + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + fileprivate var _sourceContext: Google_Protobuf_SourceContext? = nil +} + +/// A single field of a message type. +public struct Google_Protobuf_Field { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The field type. + public var kind: Google_Protobuf_Field.Kind = .typeUnknown + + /// The field cardinality. + public var cardinality: Google_Protobuf_Field.Cardinality = .unknown + + /// The field number. + public var number: Int32 = 0 + + /// The field name. + public var name: String = String() + + /// The field type URL, without the scheme, for message or enumeration + /// types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`. + public var typeURL: String = String() + + /// The index of the field type in `Type.oneofs`, for message or enumeration + /// types. The first type has index 1; zero means the type is not in the list. + public var oneofIndex: Int32 = 0 + + /// Whether to use alternative packed wire representation. + public var packed: Bool = false + + /// The protocol buffer options. + public var options: [Google_Protobuf_Option] = [] + + /// The field JSON name. + public var jsonName: String = String() + + /// The string value of the default value of this field. Proto2 syntax only. + public var defaultValue: String = String() + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + /// Basic field types. + public enum Kind: SwiftProtobuf.Enum { + public typealias RawValue = Int + + /// Field type unknown. + case typeUnknown // = 0 + + /// Field type double. + case typeDouble // = 1 + + /// Field type float. + case typeFloat // = 2 + + /// Field type int64. + case typeInt64 // = 3 + + /// Field type uint64. + case typeUint64 // = 4 + + /// Field type int32. + case typeInt32 // = 5 + + /// Field type fixed64. + case typeFixed64 // = 6 + + /// Field type fixed32. + case typeFixed32 // = 7 + + /// Field type bool. + case typeBool // = 8 + + /// Field type string. + case typeString // = 9 + + /// Field type group. Proto2 syntax only, and deprecated. + case typeGroup // = 10 + + /// Field type message. + case typeMessage // = 11 + + /// Field type bytes. + case typeBytes // = 12 + + /// Field type uint32. + case typeUint32 // = 13 + + /// Field type enum. + case typeEnum // = 14 + + /// Field type sfixed32. + case typeSfixed32 // = 15 + + /// Field type sfixed64. + case typeSfixed64 // = 16 + + /// Field type sint32. + case typeSint32 // = 17 + + /// Field type sint64. + case typeSint64 // = 18 + case UNRECOGNIZED(Int) + + public init() { + self = .typeUnknown + } + + public init?(rawValue: Int) { + switch rawValue { + case 0: self = .typeUnknown + case 1: self = .typeDouble + case 2: self = .typeFloat + case 3: self = .typeInt64 + case 4: self = .typeUint64 + case 5: self = .typeInt32 + case 6: self = .typeFixed64 + case 7: self = .typeFixed32 + case 8: self = .typeBool + case 9: self = .typeString + case 10: self = .typeGroup + case 11: self = .typeMessage + case 12: self = .typeBytes + case 13: self = .typeUint32 + case 14: self = .typeEnum + case 15: self = .typeSfixed32 + case 16: self = .typeSfixed64 + case 17: self = .typeSint32 + case 18: self = .typeSint64 + default: self = .UNRECOGNIZED(rawValue) + } + } + + public var rawValue: Int { + switch self { + case .typeUnknown: return 0 + case .typeDouble: return 1 + case .typeFloat: return 2 + case .typeInt64: return 3 + case .typeUint64: return 4 + case .typeInt32: return 5 + case .typeFixed64: return 6 + case .typeFixed32: return 7 + case .typeBool: return 8 + case .typeString: return 9 + case .typeGroup: return 10 + case .typeMessage: return 11 + case .typeBytes: return 12 + case .typeUint32: return 13 + case .typeEnum: return 14 + case .typeSfixed32: return 15 + case .typeSfixed64: return 16 + case .typeSint32: return 17 + case .typeSint64: return 18 + case .UNRECOGNIZED(let i): return i + } + } + + } + + /// Whether a field is optional, required, or repeated. + public enum Cardinality: SwiftProtobuf.Enum { + public typealias RawValue = Int + + /// For fields with unknown cardinality. + case unknown // = 0 + + /// For optional fields. + case `optional` // = 1 + + /// For required fields. Proto2 syntax only. + case `required` // = 2 + + /// For repeated fields. + case repeated // = 3 + case UNRECOGNIZED(Int) + + public init() { + self = .unknown + } + + public init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknown + case 1: self = .optional + case 2: self = .required + case 3: self = .repeated + default: self = .UNRECOGNIZED(rawValue) + } + } + + public var rawValue: Int { + switch self { + case .unknown: return 0 + case .optional: return 1 + case .required: return 2 + case .repeated: return 3 + case .UNRECOGNIZED(let i): return i + } + } + + } + + public init() {} +} + +#if swift(>=4.2) + +extension Google_Protobuf_Field.Kind: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + public static var allCases: [Google_Protobuf_Field.Kind] = [ + .typeUnknown, + .typeDouble, + .typeFloat, + .typeInt64, + .typeUint64, + .typeInt32, + .typeFixed64, + .typeFixed32, + .typeBool, + .typeString, + .typeGroup, + .typeMessage, + .typeBytes, + .typeUint32, + .typeEnum, + .typeSfixed32, + .typeSfixed64, + .typeSint32, + .typeSint64, + ] +} + +extension Google_Protobuf_Field.Cardinality: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + public static var allCases: [Google_Protobuf_Field.Cardinality] = [ + .unknown, + .optional, + .required, + .repeated, + ] +} + +#endif // swift(>=4.2) + +/// Enum type definition. +public struct Google_Protobuf_Enum { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Enum type name. + public var name: String = String() + + /// Enum value definitions. + public var enumvalue: [Google_Protobuf_EnumValue] = [] + + /// Protocol buffer options. + public var options: [Google_Protobuf_Option] = [] + + /// The source context. + public var sourceContext: Google_Protobuf_SourceContext { + get {return _sourceContext ?? Google_Protobuf_SourceContext()} + set {_sourceContext = newValue} + } + /// Returns true if `sourceContext` has been explicitly set. + public var hasSourceContext: Bool {return self._sourceContext != nil} + /// Clears the value of `sourceContext`. Subsequent reads from it will return its default value. + public mutating func clearSourceContext() {self._sourceContext = nil} + + /// The source syntax. + public var syntax: Google_Protobuf_Syntax = .proto2 + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + fileprivate var _sourceContext: Google_Protobuf_SourceContext? = nil +} + +/// Enum value definition. +public struct Google_Protobuf_EnumValue { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Enum value name. + public var name: String = String() + + /// Enum value number. + public var number: Int32 = 0 + + /// Protocol buffer options. + public var options: [Google_Protobuf_Option] = [] + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + +/// A protocol buffer option, which can be attached to a message, field, +/// enumeration, etc. +public struct Google_Protobuf_Option { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The option's name. For protobuf built-in options (options defined in + /// descriptor.proto), this is the short name. For example, `"map_entry"`. + /// For custom options, it should be the fully-qualified name. For example, + /// `"google.api.http"`. + public var name: String = String() + + /// The option's value packed in an Any message. If the value is a primitive, + /// the corresponding wrapper type defined in google/protobuf/wrappers.proto + /// should be used. If the value is an enum, it should be stored as an int32 + /// value using the google.protobuf.Int32Value type. + public var value: Google_Protobuf_Any { + get {return _value ?? Google_Protobuf_Any()} + set {_value = newValue} + } + /// Returns true if `value` has been explicitly set. + public var hasValue: Bool {return self._value != nil} + /// Clears the value of `value`. Subsequent reads from it will return its default value. + public mutating func clearValue() {self._value = nil} + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + fileprivate var _value: Google_Protobuf_Any? = nil +} + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "google.protobuf" + +extension Google_Protobuf_Syntax: SwiftProtobuf._ProtoNameProviding { + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "SYNTAX_PROTO2"), + 1: .same(proto: "SYNTAX_PROTO3"), + ] +} + +extension Google_Protobuf_Type: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".Type" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "name"), + 2: .same(proto: "fields"), + 3: .same(proto: "oneofs"), + 4: .same(proto: "options"), + 5: .standard(proto: "source_context"), + 6: .same(proto: "syntax"), + ] + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self.name) }() + case 2: try { try decoder.decodeRepeatedMessageField(value: &self.fields) }() + case 3: try { try decoder.decodeRepeatedStringField(value: &self.oneofs) }() + case 4: try { try decoder.decodeRepeatedMessageField(value: &self.options) }() + case 5: try { try decoder.decodeSingularMessageField(value: &self._sourceContext) }() + case 6: try { try decoder.decodeSingularEnumField(value: &self.syntax) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.name.isEmpty { + try visitor.visitSingularStringField(value: self.name, fieldNumber: 1) + } + if !self.fields.isEmpty { + try visitor.visitRepeatedMessageField(value: self.fields, fieldNumber: 2) + } + if !self.oneofs.isEmpty { + try visitor.visitRepeatedStringField(value: self.oneofs, fieldNumber: 3) + } + if !self.options.isEmpty { + try visitor.visitRepeatedMessageField(value: self.options, fieldNumber: 4) + } + if let v = self._sourceContext { + try visitor.visitSingularMessageField(value: v, fieldNumber: 5) + } + if self.syntax != .proto2 { + try visitor.visitSingularEnumField(value: self.syntax, fieldNumber: 6) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_Type, rhs: Google_Protobuf_Type) -> Bool { + if lhs.name != rhs.name {return false} + if lhs.fields != rhs.fields {return false} + if lhs.oneofs != rhs.oneofs {return false} + if lhs.options != rhs.options {return false} + if lhs._sourceContext != rhs._sourceContext {return false} + if lhs.syntax != rhs.syntax {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Google_Protobuf_Field: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".Field" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "kind"), + 2: .same(proto: "cardinality"), + 3: .same(proto: "number"), + 4: .same(proto: "name"), + 6: .standard(proto: "type_url"), + 7: .standard(proto: "oneof_index"), + 8: .same(proto: "packed"), + 9: .same(proto: "options"), + 10: .standard(proto: "json_name"), + 11: .standard(proto: "default_value"), + ] + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularEnumField(value: &self.kind) }() + case 2: try { try decoder.decodeSingularEnumField(value: &self.cardinality) }() + case 3: try { try decoder.decodeSingularInt32Field(value: &self.number) }() + case 4: try { try decoder.decodeSingularStringField(value: &self.name) }() + case 6: try { try decoder.decodeSingularStringField(value: &self.typeURL) }() + case 7: try { try decoder.decodeSingularInt32Field(value: &self.oneofIndex) }() + case 8: try { try decoder.decodeSingularBoolField(value: &self.packed) }() + case 9: try { try decoder.decodeRepeatedMessageField(value: &self.options) }() + case 10: try { try decoder.decodeSingularStringField(value: &self.jsonName) }() + case 11: try { try decoder.decodeSingularStringField(value: &self.defaultValue) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if self.kind != .typeUnknown { + try visitor.visitSingularEnumField(value: self.kind, fieldNumber: 1) + } + if self.cardinality != .unknown { + try visitor.visitSingularEnumField(value: self.cardinality, fieldNumber: 2) + } + if self.number != 0 { + try visitor.visitSingularInt32Field(value: self.number, fieldNumber: 3) + } + if !self.name.isEmpty { + try visitor.visitSingularStringField(value: self.name, fieldNumber: 4) + } + if !self.typeURL.isEmpty { + try visitor.visitSingularStringField(value: self.typeURL, fieldNumber: 6) + } + if self.oneofIndex != 0 { + try visitor.visitSingularInt32Field(value: self.oneofIndex, fieldNumber: 7) + } + if self.packed != false { + try visitor.visitSingularBoolField(value: self.packed, fieldNumber: 8) + } + if !self.options.isEmpty { + try visitor.visitRepeatedMessageField(value: self.options, fieldNumber: 9) + } + if !self.jsonName.isEmpty { + try visitor.visitSingularStringField(value: self.jsonName, fieldNumber: 10) + } + if !self.defaultValue.isEmpty { + try visitor.visitSingularStringField(value: self.defaultValue, fieldNumber: 11) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_Field, rhs: Google_Protobuf_Field) -> Bool { + if lhs.kind != rhs.kind {return false} + if lhs.cardinality != rhs.cardinality {return false} + if lhs.number != rhs.number {return false} + if lhs.name != rhs.name {return false} + if lhs.typeURL != rhs.typeURL {return false} + if lhs.oneofIndex != rhs.oneofIndex {return false} + if lhs.packed != rhs.packed {return false} + if lhs.options != rhs.options {return false} + if lhs.jsonName != rhs.jsonName {return false} + if lhs.defaultValue != rhs.defaultValue {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Google_Protobuf_Field.Kind: SwiftProtobuf._ProtoNameProviding { + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "TYPE_UNKNOWN"), + 1: .same(proto: "TYPE_DOUBLE"), + 2: .same(proto: "TYPE_FLOAT"), + 3: .same(proto: "TYPE_INT64"), + 4: .same(proto: "TYPE_UINT64"), + 5: .same(proto: "TYPE_INT32"), + 6: .same(proto: "TYPE_FIXED64"), + 7: .same(proto: "TYPE_FIXED32"), + 8: .same(proto: "TYPE_BOOL"), + 9: .same(proto: "TYPE_STRING"), + 10: .same(proto: "TYPE_GROUP"), + 11: .same(proto: "TYPE_MESSAGE"), + 12: .same(proto: "TYPE_BYTES"), + 13: .same(proto: "TYPE_UINT32"), + 14: .same(proto: "TYPE_ENUM"), + 15: .same(proto: "TYPE_SFIXED32"), + 16: .same(proto: "TYPE_SFIXED64"), + 17: .same(proto: "TYPE_SINT32"), + 18: .same(proto: "TYPE_SINT64"), + ] +} + +extension Google_Protobuf_Field.Cardinality: SwiftProtobuf._ProtoNameProviding { + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "CARDINALITY_UNKNOWN"), + 1: .same(proto: "CARDINALITY_OPTIONAL"), + 2: .same(proto: "CARDINALITY_REQUIRED"), + 3: .same(proto: "CARDINALITY_REPEATED"), + ] +} + +extension Google_Protobuf_Enum: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".Enum" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "name"), + 2: .same(proto: "enumvalue"), + 3: .same(proto: "options"), + 4: .standard(proto: "source_context"), + 5: .same(proto: "syntax"), + ] + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self.name) }() + case 2: try { try decoder.decodeRepeatedMessageField(value: &self.enumvalue) }() + case 3: try { try decoder.decodeRepeatedMessageField(value: &self.options) }() + case 4: try { try decoder.decodeSingularMessageField(value: &self._sourceContext) }() + case 5: try { try decoder.decodeSingularEnumField(value: &self.syntax) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.name.isEmpty { + try visitor.visitSingularStringField(value: self.name, fieldNumber: 1) + } + if !self.enumvalue.isEmpty { + try visitor.visitRepeatedMessageField(value: self.enumvalue, fieldNumber: 2) + } + if !self.options.isEmpty { + try visitor.visitRepeatedMessageField(value: self.options, fieldNumber: 3) + } + if let v = self._sourceContext { + try visitor.visitSingularMessageField(value: v, fieldNumber: 4) + } + if self.syntax != .proto2 { + try visitor.visitSingularEnumField(value: self.syntax, fieldNumber: 5) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_Enum, rhs: Google_Protobuf_Enum) -> Bool { + if lhs.name != rhs.name {return false} + if lhs.enumvalue != rhs.enumvalue {return false} + if lhs.options != rhs.options {return false} + if lhs._sourceContext != rhs._sourceContext {return false} + if lhs.syntax != rhs.syntax {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Google_Protobuf_EnumValue: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".EnumValue" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "name"), + 2: .same(proto: "number"), + 3: .same(proto: "options"), + ] + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self.name) }() + case 2: try { try decoder.decodeSingularInt32Field(value: &self.number) }() + case 3: try { try decoder.decodeRepeatedMessageField(value: &self.options) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.name.isEmpty { + try visitor.visitSingularStringField(value: self.name, fieldNumber: 1) + } + if self.number != 0 { + try visitor.visitSingularInt32Field(value: self.number, fieldNumber: 2) + } + if !self.options.isEmpty { + try visitor.visitRepeatedMessageField(value: self.options, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_EnumValue, rhs: Google_Protobuf_EnumValue) -> Bool { + if lhs.name != rhs.name {return false} + if lhs.number != rhs.number {return false} + if lhs.options != rhs.options {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Google_Protobuf_Option: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".Option" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "name"), + 2: .same(proto: "value"), + ] + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self.name) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._value) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.name.isEmpty { + try visitor.visitSingularStringField(value: self.name, fieldNumber: 1) + } + if let v = self._value { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_Option, rhs: Google_Protobuf_Option) -> Bool { + if lhs.name != rhs.name {return false} + if lhs._value != rhs._value {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/Pods/SwiftProtobuf/Sources/SwiftProtobuf/wrappers.pb.swift b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/wrappers.pb.swift new file mode 100644 index 0000000..5ce7c98 --- /dev/null +++ b/Pods/SwiftProtobuf/Sources/SwiftProtobuf/wrappers.pb.swift @@ -0,0 +1,496 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: google/protobuf/wrappers.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Wrappers for primitive (non-message) types. These types are useful +// for embedding primitives in the `google.protobuf.Any` type and for places +// where we need to distinguish between the absence of a primitive +// typed field and its default value. +// +// These wrappers have no meaningful use within repeated fields as they lack +// the ability to detect presence on individual elements. +// These wrappers have no meaningful use within a map or a oneof since +// individual entries of a map or fields of a oneof can already detect presence. + +import Foundation + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +/// Wrapper message for `double`. +/// +/// The JSON representation for `DoubleValue` is JSON number. +public struct Google_Protobuf_DoubleValue { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The double value. + public var value: Double = 0 + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + +/// Wrapper message for `float`. +/// +/// The JSON representation for `FloatValue` is JSON number. +public struct Google_Protobuf_FloatValue { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The float value. + public var value: Float = 0 + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + +/// Wrapper message for `int64`. +/// +/// The JSON representation for `Int64Value` is JSON string. +public struct Google_Protobuf_Int64Value { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The int64 value. + public var value: Int64 = 0 + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + +/// Wrapper message for `uint64`. +/// +/// The JSON representation for `UInt64Value` is JSON string. +public struct Google_Protobuf_UInt64Value { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The uint64 value. + public var value: UInt64 = 0 + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + +/// Wrapper message for `int32`. +/// +/// The JSON representation for `Int32Value` is JSON number. +public struct Google_Protobuf_Int32Value { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The int32 value. + public var value: Int32 = 0 + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + +/// Wrapper message for `uint32`. +/// +/// The JSON representation for `UInt32Value` is JSON number. +public struct Google_Protobuf_UInt32Value { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The uint32 value. + public var value: UInt32 = 0 + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + +/// Wrapper message for `bool`. +/// +/// The JSON representation for `BoolValue` is JSON `true` and `false`. +public struct Google_Protobuf_BoolValue { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The bool value. + public var value: Bool = false + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + +/// Wrapper message for `string`. +/// +/// The JSON representation for `StringValue` is JSON string. +public struct Google_Protobuf_StringValue { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The string value. + public var value: String = String() + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + +/// Wrapper message for `bytes`. +/// +/// The JSON representation for `BytesValue` is JSON string. +public struct Google_Protobuf_BytesValue { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The bytes value. + public var value: Data = Data() + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "google.protobuf" + +extension Google_Protobuf_DoubleValue: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".DoubleValue" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "value"), + ] + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularDoubleField(value: &self.value) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if self.value != 0 { + try visitor.visitSingularDoubleField(value: self.value, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_DoubleValue, rhs: Google_Protobuf_DoubleValue) -> Bool { + if lhs.value != rhs.value {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Google_Protobuf_FloatValue: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".FloatValue" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "value"), + ] + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularFloatField(value: &self.value) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if self.value != 0 { + try visitor.visitSingularFloatField(value: self.value, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_FloatValue, rhs: Google_Protobuf_FloatValue) -> Bool { + if lhs.value != rhs.value {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Google_Protobuf_Int64Value: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".Int64Value" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "value"), + ] + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularInt64Field(value: &self.value) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if self.value != 0 { + try visitor.visitSingularInt64Field(value: self.value, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_Int64Value, rhs: Google_Protobuf_Int64Value) -> Bool { + if lhs.value != rhs.value {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Google_Protobuf_UInt64Value: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".UInt64Value" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "value"), + ] + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularUInt64Field(value: &self.value) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if self.value != 0 { + try visitor.visitSingularUInt64Field(value: self.value, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_UInt64Value, rhs: Google_Protobuf_UInt64Value) -> Bool { + if lhs.value != rhs.value {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Google_Protobuf_Int32Value: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".Int32Value" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "value"), + ] + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularInt32Field(value: &self.value) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if self.value != 0 { + try visitor.visitSingularInt32Field(value: self.value, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_Int32Value, rhs: Google_Protobuf_Int32Value) -> Bool { + if lhs.value != rhs.value {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Google_Protobuf_UInt32Value: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".UInt32Value" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "value"), + ] + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularUInt32Field(value: &self.value) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if self.value != 0 { + try visitor.visitSingularUInt32Field(value: self.value, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_UInt32Value, rhs: Google_Protobuf_UInt32Value) -> Bool { + if lhs.value != rhs.value {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Google_Protobuf_BoolValue: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".BoolValue" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "value"), + ] + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularBoolField(value: &self.value) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if self.value != false { + try visitor.visitSingularBoolField(value: self.value, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_BoolValue, rhs: Google_Protobuf_BoolValue) -> Bool { + if lhs.value != rhs.value {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Google_Protobuf_StringValue: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".StringValue" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "value"), + ] + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularStringField(value: &self.value) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.value.isEmpty { + try visitor.visitSingularStringField(value: self.value, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_StringValue, rhs: Google_Protobuf_StringValue) -> Bool { + if lhs.value != rhs.value {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Google_Protobuf_BytesValue: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".BytesValue" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "value"), + ] + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularBytesField(value: &self.value) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.value.isEmpty { + try visitor.visitSingularBytesField(value: self.value, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Google_Protobuf_BytesValue, rhs: Google_Protobuf_BytesValue) -> Bool { + if lhs.value != rhs.value {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/Pods/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests-Info.plist b/Pods/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests-Info.plist new file mode 100644 index 0000000..2243fe6 --- /dev/null +++ b/Pods/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests-Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + ${PRODUCT_BUNDLE_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0.0 + CFBundleSignature + ???? + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + NSPrincipalClass + + + diff --git a/Pods/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests-acknowledgements.markdown b/Pods/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests-acknowledgements.markdown new file mode 100644 index 0000000..fd7bc2a --- /dev/null +++ b/Pods/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests-acknowledgements.markdown @@ -0,0 +1,240 @@ +# Acknowledgements +This application makes use of the following third party libraries: + +## QR-Code-Scanner-iOS + +Copyright (c) 2020 Applied Recognition, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +## SwiftProtobuf + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + + +## Runtime Library Exception to the Apache 2.0 License: ## + + + As an exception, if you use this Software to compile your source code and + portions of this Software are embedded into the binary product as a result, + you may redistribute such product without providing attribution as would + otherwise be required by Sections 4(a), 4(b) and 4(d) of the License. + +Generated by CocoaPods - https://cocoapods.org diff --git a/Pods/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests-acknowledgements.plist b/Pods/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests-acknowledgements.plist new file mode 100644 index 0000000..19351eb --- /dev/null +++ b/Pods/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests-acknowledgements.plist @@ -0,0 +1,278 @@ + + + + + PreferenceSpecifiers + + + FooterText + This application makes use of the following third party libraries: + Title + Acknowledgements + Type + PSGroupSpecifier + + + FooterText + Copyright (c) 2020 Applied Recognition, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + License + MIT + Title + QR-Code-Scanner-iOS + Type + PSGroupSpecifier + + + FooterText + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + + +## Runtime Library Exception to the Apache 2.0 License: ## + + + As an exception, if you use this Software to compile your source code and + portions of this Software are embedded into the binary product as a result, + you may redistribute such product without providing attribution as would + otherwise be required by Sections 4(a), 4(b) and 4(d) of the License. + + License + Apache 2.0 + Title + SwiftProtobuf + Type + PSGroupSpecifier + + + FooterText + Generated by CocoaPods - https://cocoapods.org + Title + + Type + PSGroupSpecifier + + + StringsTable + Acknowledgements + Title + Acknowledgements + + diff --git a/Pods/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests-dummy.m b/Pods/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests-dummy.m new file mode 100644 index 0000000..85a0f6c --- /dev/null +++ b/Pods/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_Pods_wallet_walletUITests : NSObject +@end +@implementation PodsDummy_Pods_wallet_walletUITests +@end diff --git a/Pods/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests-frameworks-Debug-input-files.xcfilelist b/Pods/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests-frameworks-Debug-input-files.xcfilelist new file mode 100644 index 0000000..8f988d6 --- /dev/null +++ b/Pods/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests-frameworks-Debug-input-files.xcfilelist @@ -0,0 +1,3 @@ +${PODS_ROOT}/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests-frameworks.sh +${BUILT_PRODUCTS_DIR}/QR-Code-Scanner-iOS/QRCodeScanner.framework +${BUILT_PRODUCTS_DIR}/SwiftProtobuf/SwiftProtobuf.framework \ No newline at end of file diff --git a/Pods/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests-frameworks-Debug-output-files.xcfilelist b/Pods/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests-frameworks-Debug-output-files.xcfilelist new file mode 100644 index 0000000..d3688db --- /dev/null +++ b/Pods/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests-frameworks-Debug-output-files.xcfilelist @@ -0,0 +1,2 @@ +${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/QRCodeScanner.framework +${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftProtobuf.framework \ No newline at end of file diff --git a/Pods/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests-frameworks-Release-input-files.xcfilelist b/Pods/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests-frameworks-Release-input-files.xcfilelist new file mode 100644 index 0000000..8f988d6 --- /dev/null +++ b/Pods/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests-frameworks-Release-input-files.xcfilelist @@ -0,0 +1,3 @@ +${PODS_ROOT}/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests-frameworks.sh +${BUILT_PRODUCTS_DIR}/QR-Code-Scanner-iOS/QRCodeScanner.framework +${BUILT_PRODUCTS_DIR}/SwiftProtobuf/SwiftProtobuf.framework \ No newline at end of file diff --git a/Pods/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests-frameworks-Release-output-files.xcfilelist b/Pods/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests-frameworks-Release-output-files.xcfilelist new file mode 100644 index 0000000..d3688db --- /dev/null +++ b/Pods/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests-frameworks-Release-output-files.xcfilelist @@ -0,0 +1,2 @@ +${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/QRCodeScanner.framework +${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftProtobuf.framework \ No newline at end of file diff --git a/Pods/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests-frameworks.sh b/Pods/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests-frameworks.sh new file mode 100755 index 0000000..12eaf25 --- /dev/null +++ b/Pods/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests-frameworks.sh @@ -0,0 +1,188 @@ +#!/bin/sh +set -e +set -u +set -o pipefail + +function on_error { + echo "$(realpath -mq "${0}"):$1: error: Unexpected failure" +} +trap 'on_error $LINENO' ERR + +if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then + # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy + # frameworks to, so exit 0 (signalling the script phase was successful). + exit 0 +fi + +echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" +mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + +COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}" +SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" +BCSYMBOLMAP_DIR="BCSymbolMaps" + + +# This protects against multiple targets copying the same framework dependency at the same time. The solution +# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html +RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") + +# Copies and strips a vendored framework +install_framework() +{ + if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then + local source="${BUILT_PRODUCTS_DIR}/$1" + elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then + local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" + elif [ -r "$1" ]; then + local source="$1" + fi + + local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + + if [ -L "${source}" ]; then + echo "Symlinked..." + source="$(readlink "${source}")" + fi + + if [ -d "${source}/${BCSYMBOLMAP_DIR}" ]; then + # Locate and install any .bcsymbolmaps if present, and remove them from the .framework before the framework is copied + find "${source}/${BCSYMBOLMAP_DIR}" -name "*.bcsymbolmap"|while read f; do + echo "Installing $f" + install_bcsymbolmap "$f" "$destination" + rm "$f" + done + rmdir "${source}/${BCSYMBOLMAP_DIR}" + fi + + # Use filter instead of exclude so missing patterns don't throw errors. + echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" + rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" + + local basename + basename="$(basename -s .framework "$1")" + binary="${destination}/${basename}.framework/${basename}" + + if ! [ -r "$binary" ]; then + binary="${destination}/${basename}" + elif [ -L "${binary}" ]; then + echo "Destination binary is symlinked..." + dirname="$(dirname "${binary}")" + binary="${dirname}/$(readlink "${binary}")" + fi + + # Strip invalid architectures so "fat" simulator / device frameworks work on device + if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then + strip_invalid_archs "$binary" + fi + + # Resign the code if required by the build settings to avoid unstable apps + code_sign_if_enabled "${destination}/$(basename "$1")" + + # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. + if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then + local swift_runtime_libs + swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u) + for lib in $swift_runtime_libs; do + echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" + rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" + code_sign_if_enabled "${destination}/${lib}" + done + fi +} +# Copies and strips a vendored dSYM +install_dsym() { + local source="$1" + warn_missing_arch=${2:-true} + if [ -r "$source" ]; then + # Copy the dSYM into the targets temp dir. + echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\"" + rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}" + + local basename + basename="$(basename -s .dSYM "$source")" + binary_name="$(ls "$source/Contents/Resources/DWARF")" + binary="${DERIVED_FILES_DIR}/${basename}.dSYM/Contents/Resources/DWARF/${binary_name}" + + # Strip invalid architectures from the dSYM. + if [[ "$(file "$binary")" == *"Mach-O "*"dSYM companion"* ]]; then + strip_invalid_archs "$binary" "$warn_missing_arch" + fi + if [[ $STRIP_BINARY_RETVAL == 0 ]]; then + # Move the stripped file into its final destination. + echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\"" + rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.dSYM" "${DWARF_DSYM_FOLDER_PATH}" + else + # The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing. + mkdir -p "${DWARF_DSYM_FOLDER_PATH}" + touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.dSYM" + fi + fi +} + +# Used as a return value for each invocation of `strip_invalid_archs` function. +STRIP_BINARY_RETVAL=0 + +# Strip invalid architectures +strip_invalid_archs() { + binary="$1" + warn_missing_arch=${2:-true} + # Get architectures for current target binary + binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)" + # Intersect them with the architectures we are building for + intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)" + # If there are no archs supported by this binary then warn the user + if [[ -z "$intersected_archs" ]]; then + if [[ "$warn_missing_arch" == "true" ]]; then + echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)." + fi + STRIP_BINARY_RETVAL=1 + return + fi + stripped="" + for arch in $binary_archs; do + if ! [[ "${ARCHS}" == *"$arch"* ]]; then + # Strip non-valid architectures in-place + lipo -remove "$arch" -output "$binary" "$binary" + stripped="$stripped $arch" + fi + done + if [[ "$stripped" ]]; then + echo "Stripped $binary of architectures:$stripped" + fi + STRIP_BINARY_RETVAL=0 +} + +# Copies the bcsymbolmap files of a vendored framework +install_bcsymbolmap() { + local bcsymbolmap_path="$1" + local destination="${BUILT_PRODUCTS_DIR}" + echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}"" + rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}" +} + +# Signs a framework with the provided identity +code_sign_if_enabled() { + if [ -n "${EXPANDED_CODE_SIGN_IDENTITY:-}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then + # Use the current code_sign_identity + echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" + local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'" + + if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then + code_sign_cmd="$code_sign_cmd &" + fi + echo "$code_sign_cmd" + eval "$code_sign_cmd" + fi +} + +if [[ "$CONFIGURATION" == "Debug" ]]; then + install_framework "${BUILT_PRODUCTS_DIR}/QR-Code-Scanner-iOS/QRCodeScanner.framework" + install_framework "${BUILT_PRODUCTS_DIR}/SwiftProtobuf/SwiftProtobuf.framework" +fi +if [[ "$CONFIGURATION" == "Release" ]]; then + install_framework "${BUILT_PRODUCTS_DIR}/QR-Code-Scanner-iOS/QRCodeScanner.framework" + install_framework "${BUILT_PRODUCTS_DIR}/SwiftProtobuf/SwiftProtobuf.framework" +fi +if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then + wait +fi diff --git a/Pods/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests-umbrella.h b/Pods/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests-umbrella.h new file mode 100644 index 0000000..efddf95 --- /dev/null +++ b/Pods/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests-umbrella.h @@ -0,0 +1,16 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + + +FOUNDATION_EXPORT double Pods_wallet_walletUITestsVersionNumber; +FOUNDATION_EXPORT const unsigned char Pods_wallet_walletUITestsVersionString[]; + diff --git a/Pods/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests.debug.xcconfig b/Pods/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests.debug.xcconfig new file mode 100644 index 0000000..a8e2be0 --- /dev/null +++ b/Pods/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests.debug.xcconfig @@ -0,0 +1,15 @@ +ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES +CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO +FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/QR-Code-Scanner-iOS" "${PODS_CONFIGURATION_BUILD_DIR}/SwiftProtobuf" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/QR-Code-Scanner-iOS/QRCodeScanner.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/SwiftProtobuf/SwiftProtobuf.framework/Headers" +LD_RUNPATH_SEARCH_PATHS = $(inherited) /usr/lib/swift "$(PLATFORM_DIR)/Developer/Library/Frameworks" '@executable_path/Frameworks' '@loader_path/Frameworks' +LIBRARY_SEARCH_PATHS = $(inherited) "${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift +OTHER_LDFLAGS = $(inherited) -framework "QRCodeScanner" -framework "SwiftProtobuf" +OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_PODFILE_DIR_PATH = ${SRCROOT}/. +PODS_ROOT = ${SRCROOT}/Pods +PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Pods/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests.modulemap b/Pods/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests.modulemap new file mode 100644 index 0000000..58407ae --- /dev/null +++ b/Pods/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests.modulemap @@ -0,0 +1,6 @@ +framework module Pods_wallet_walletUITests { + umbrella header "Pods-wallet-walletUITests-umbrella.h" + + export * + module * { export * } +} diff --git a/Pods/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests.release.xcconfig b/Pods/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests.release.xcconfig new file mode 100644 index 0000000..a8e2be0 --- /dev/null +++ b/Pods/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests.release.xcconfig @@ -0,0 +1,15 @@ +ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES +CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO +FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/QR-Code-Scanner-iOS" "${PODS_CONFIGURATION_BUILD_DIR}/SwiftProtobuf" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/QR-Code-Scanner-iOS/QRCodeScanner.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/SwiftProtobuf/SwiftProtobuf.framework/Headers" +LD_RUNPATH_SEARCH_PATHS = $(inherited) /usr/lib/swift "$(PLATFORM_DIR)/Developer/Library/Frameworks" '@executable_path/Frameworks' '@loader_path/Frameworks' +LIBRARY_SEARCH_PATHS = $(inherited) "${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift +OTHER_LDFLAGS = $(inherited) -framework "QRCodeScanner" -framework "SwiftProtobuf" +OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_PODFILE_DIR_PATH = ${SRCROOT}/. +PODS_ROOT = ${SRCROOT}/Pods +PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Pods/Target Support Files/Pods-wallet/Pods-wallet-Info.plist b/Pods/Target Support Files/Pods-wallet/Pods-wallet-Info.plist new file mode 100644 index 0000000..2243fe6 --- /dev/null +++ b/Pods/Target Support Files/Pods-wallet/Pods-wallet-Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + ${PRODUCT_BUNDLE_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0.0 + CFBundleSignature + ???? + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + NSPrincipalClass + + + diff --git a/Pods/Target Support Files/Pods-wallet/Pods-wallet-acknowledgements.markdown b/Pods/Target Support Files/Pods-wallet/Pods-wallet-acknowledgements.markdown new file mode 100644 index 0000000..fd7bc2a --- /dev/null +++ b/Pods/Target Support Files/Pods-wallet/Pods-wallet-acknowledgements.markdown @@ -0,0 +1,240 @@ +# Acknowledgements +This application makes use of the following third party libraries: + +## QR-Code-Scanner-iOS + +Copyright (c) 2020 Applied Recognition, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +## SwiftProtobuf + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + + +## Runtime Library Exception to the Apache 2.0 License: ## + + + As an exception, if you use this Software to compile your source code and + portions of this Software are embedded into the binary product as a result, + you may redistribute such product without providing attribution as would + otherwise be required by Sections 4(a), 4(b) and 4(d) of the License. + +Generated by CocoaPods - https://cocoapods.org diff --git a/Pods/Target Support Files/Pods-wallet/Pods-wallet-acknowledgements.plist b/Pods/Target Support Files/Pods-wallet/Pods-wallet-acknowledgements.plist new file mode 100644 index 0000000..19351eb --- /dev/null +++ b/Pods/Target Support Files/Pods-wallet/Pods-wallet-acknowledgements.plist @@ -0,0 +1,278 @@ + + + + + PreferenceSpecifiers + + + FooterText + This application makes use of the following third party libraries: + Title + Acknowledgements + Type + PSGroupSpecifier + + + FooterText + Copyright (c) 2020 Applied Recognition, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + License + MIT + Title + QR-Code-Scanner-iOS + Type + PSGroupSpecifier + + + FooterText + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + + +## Runtime Library Exception to the Apache 2.0 License: ## + + + As an exception, if you use this Software to compile your source code and + portions of this Software are embedded into the binary product as a result, + you may redistribute such product without providing attribution as would + otherwise be required by Sections 4(a), 4(b) and 4(d) of the License. + + License + Apache 2.0 + Title + SwiftProtobuf + Type + PSGroupSpecifier + + + FooterText + Generated by CocoaPods - https://cocoapods.org + Title + + Type + PSGroupSpecifier + + + StringsTable + Acknowledgements + Title + Acknowledgements + + diff --git a/Pods/Target Support Files/Pods-wallet/Pods-wallet-dummy.m b/Pods/Target Support Files/Pods-wallet/Pods-wallet-dummy.m new file mode 100644 index 0000000..5caaf6e --- /dev/null +++ b/Pods/Target Support Files/Pods-wallet/Pods-wallet-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_Pods_wallet : NSObject +@end +@implementation PodsDummy_Pods_wallet +@end diff --git a/Pods/Target Support Files/Pods-wallet/Pods-wallet-frameworks-Debug-input-files.xcfilelist b/Pods/Target Support Files/Pods-wallet/Pods-wallet-frameworks-Debug-input-files.xcfilelist new file mode 100644 index 0000000..6dadd69 --- /dev/null +++ b/Pods/Target Support Files/Pods-wallet/Pods-wallet-frameworks-Debug-input-files.xcfilelist @@ -0,0 +1,3 @@ +${PODS_ROOT}/Target Support Files/Pods-wallet/Pods-wallet-frameworks.sh +${BUILT_PRODUCTS_DIR}/QR-Code-Scanner-iOS/QRCodeScanner.framework +${BUILT_PRODUCTS_DIR}/SwiftProtobuf/SwiftProtobuf.framework \ No newline at end of file diff --git a/Pods/Target Support Files/Pods-wallet/Pods-wallet-frameworks-Debug-output-files.xcfilelist b/Pods/Target Support Files/Pods-wallet/Pods-wallet-frameworks-Debug-output-files.xcfilelist new file mode 100644 index 0000000..d3688db --- /dev/null +++ b/Pods/Target Support Files/Pods-wallet/Pods-wallet-frameworks-Debug-output-files.xcfilelist @@ -0,0 +1,2 @@ +${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/QRCodeScanner.framework +${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftProtobuf.framework \ No newline at end of file diff --git a/Pods/Target Support Files/Pods-wallet/Pods-wallet-frameworks-Release-input-files.xcfilelist b/Pods/Target Support Files/Pods-wallet/Pods-wallet-frameworks-Release-input-files.xcfilelist new file mode 100644 index 0000000..6dadd69 --- /dev/null +++ b/Pods/Target Support Files/Pods-wallet/Pods-wallet-frameworks-Release-input-files.xcfilelist @@ -0,0 +1,3 @@ +${PODS_ROOT}/Target Support Files/Pods-wallet/Pods-wallet-frameworks.sh +${BUILT_PRODUCTS_DIR}/QR-Code-Scanner-iOS/QRCodeScanner.framework +${BUILT_PRODUCTS_DIR}/SwiftProtobuf/SwiftProtobuf.framework \ No newline at end of file diff --git a/Pods/Target Support Files/Pods-wallet/Pods-wallet-frameworks-Release-output-files.xcfilelist b/Pods/Target Support Files/Pods-wallet/Pods-wallet-frameworks-Release-output-files.xcfilelist new file mode 100644 index 0000000..d3688db --- /dev/null +++ b/Pods/Target Support Files/Pods-wallet/Pods-wallet-frameworks-Release-output-files.xcfilelist @@ -0,0 +1,2 @@ +${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/QRCodeScanner.framework +${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftProtobuf.framework \ No newline at end of file diff --git a/Pods/Target Support Files/Pods-wallet/Pods-wallet-frameworks.sh b/Pods/Target Support Files/Pods-wallet/Pods-wallet-frameworks.sh new file mode 100755 index 0000000..12eaf25 --- /dev/null +++ b/Pods/Target Support Files/Pods-wallet/Pods-wallet-frameworks.sh @@ -0,0 +1,188 @@ +#!/bin/sh +set -e +set -u +set -o pipefail + +function on_error { + echo "$(realpath -mq "${0}"):$1: error: Unexpected failure" +} +trap 'on_error $LINENO' ERR + +if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then + # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy + # frameworks to, so exit 0 (signalling the script phase was successful). + exit 0 +fi + +echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" +mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + +COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}" +SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" +BCSYMBOLMAP_DIR="BCSymbolMaps" + + +# This protects against multiple targets copying the same framework dependency at the same time. The solution +# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html +RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") + +# Copies and strips a vendored framework +install_framework() +{ + if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then + local source="${BUILT_PRODUCTS_DIR}/$1" + elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then + local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" + elif [ -r "$1" ]; then + local source="$1" + fi + + local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + + if [ -L "${source}" ]; then + echo "Symlinked..." + source="$(readlink "${source}")" + fi + + if [ -d "${source}/${BCSYMBOLMAP_DIR}" ]; then + # Locate and install any .bcsymbolmaps if present, and remove them from the .framework before the framework is copied + find "${source}/${BCSYMBOLMAP_DIR}" -name "*.bcsymbolmap"|while read f; do + echo "Installing $f" + install_bcsymbolmap "$f" "$destination" + rm "$f" + done + rmdir "${source}/${BCSYMBOLMAP_DIR}" + fi + + # Use filter instead of exclude so missing patterns don't throw errors. + echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" + rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" + + local basename + basename="$(basename -s .framework "$1")" + binary="${destination}/${basename}.framework/${basename}" + + if ! [ -r "$binary" ]; then + binary="${destination}/${basename}" + elif [ -L "${binary}" ]; then + echo "Destination binary is symlinked..." + dirname="$(dirname "${binary}")" + binary="${dirname}/$(readlink "${binary}")" + fi + + # Strip invalid architectures so "fat" simulator / device frameworks work on device + if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then + strip_invalid_archs "$binary" + fi + + # Resign the code if required by the build settings to avoid unstable apps + code_sign_if_enabled "${destination}/$(basename "$1")" + + # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. + if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then + local swift_runtime_libs + swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u) + for lib in $swift_runtime_libs; do + echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" + rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" + code_sign_if_enabled "${destination}/${lib}" + done + fi +} +# Copies and strips a vendored dSYM +install_dsym() { + local source="$1" + warn_missing_arch=${2:-true} + if [ -r "$source" ]; then + # Copy the dSYM into the targets temp dir. + echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\"" + rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}" + + local basename + basename="$(basename -s .dSYM "$source")" + binary_name="$(ls "$source/Contents/Resources/DWARF")" + binary="${DERIVED_FILES_DIR}/${basename}.dSYM/Contents/Resources/DWARF/${binary_name}" + + # Strip invalid architectures from the dSYM. + if [[ "$(file "$binary")" == *"Mach-O "*"dSYM companion"* ]]; then + strip_invalid_archs "$binary" "$warn_missing_arch" + fi + if [[ $STRIP_BINARY_RETVAL == 0 ]]; then + # Move the stripped file into its final destination. + echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\"" + rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.dSYM" "${DWARF_DSYM_FOLDER_PATH}" + else + # The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing. + mkdir -p "${DWARF_DSYM_FOLDER_PATH}" + touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.dSYM" + fi + fi +} + +# Used as a return value for each invocation of `strip_invalid_archs` function. +STRIP_BINARY_RETVAL=0 + +# Strip invalid architectures +strip_invalid_archs() { + binary="$1" + warn_missing_arch=${2:-true} + # Get architectures for current target binary + binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)" + # Intersect them with the architectures we are building for + intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)" + # If there are no archs supported by this binary then warn the user + if [[ -z "$intersected_archs" ]]; then + if [[ "$warn_missing_arch" == "true" ]]; then + echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)." + fi + STRIP_BINARY_RETVAL=1 + return + fi + stripped="" + for arch in $binary_archs; do + if ! [[ "${ARCHS}" == *"$arch"* ]]; then + # Strip non-valid architectures in-place + lipo -remove "$arch" -output "$binary" "$binary" + stripped="$stripped $arch" + fi + done + if [[ "$stripped" ]]; then + echo "Stripped $binary of architectures:$stripped" + fi + STRIP_BINARY_RETVAL=0 +} + +# Copies the bcsymbolmap files of a vendored framework +install_bcsymbolmap() { + local bcsymbolmap_path="$1" + local destination="${BUILT_PRODUCTS_DIR}" + echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}"" + rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}" +} + +# Signs a framework with the provided identity +code_sign_if_enabled() { + if [ -n "${EXPANDED_CODE_SIGN_IDENTITY:-}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then + # Use the current code_sign_identity + echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" + local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'" + + if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then + code_sign_cmd="$code_sign_cmd &" + fi + echo "$code_sign_cmd" + eval "$code_sign_cmd" + fi +} + +if [[ "$CONFIGURATION" == "Debug" ]]; then + install_framework "${BUILT_PRODUCTS_DIR}/QR-Code-Scanner-iOS/QRCodeScanner.framework" + install_framework "${BUILT_PRODUCTS_DIR}/SwiftProtobuf/SwiftProtobuf.framework" +fi +if [[ "$CONFIGURATION" == "Release" ]]; then + install_framework "${BUILT_PRODUCTS_DIR}/QR-Code-Scanner-iOS/QRCodeScanner.framework" + install_framework "${BUILT_PRODUCTS_DIR}/SwiftProtobuf/SwiftProtobuf.framework" +fi +if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then + wait +fi diff --git a/Pods/Target Support Files/Pods-wallet/Pods-wallet-umbrella.h b/Pods/Target Support Files/Pods-wallet/Pods-wallet-umbrella.h new file mode 100644 index 0000000..08276dc --- /dev/null +++ b/Pods/Target Support Files/Pods-wallet/Pods-wallet-umbrella.h @@ -0,0 +1,16 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + + +FOUNDATION_EXPORT double Pods_walletVersionNumber; +FOUNDATION_EXPORT const unsigned char Pods_walletVersionString[]; + diff --git a/Pods/Target Support Files/Pods-wallet/Pods-wallet.debug.xcconfig b/Pods/Target Support Files/Pods-wallet/Pods-wallet.debug.xcconfig new file mode 100644 index 0000000..553c34e --- /dev/null +++ b/Pods/Target Support Files/Pods-wallet/Pods-wallet.debug.xcconfig @@ -0,0 +1,15 @@ +ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES +CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO +FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/QR-Code-Scanner-iOS" "${PODS_CONFIGURATION_BUILD_DIR}/SwiftProtobuf" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/QR-Code-Scanner-iOS/QRCodeScanner.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/SwiftProtobuf/SwiftProtobuf.framework/Headers" +LD_RUNPATH_SEARCH_PATHS = $(inherited) /usr/lib/swift '@executable_path/Frameworks' '@loader_path/Frameworks' +LIBRARY_SEARCH_PATHS = $(inherited) "${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift +OTHER_LDFLAGS = $(inherited) -framework "QRCodeScanner" -framework "SwiftProtobuf" +OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_PODFILE_DIR_PATH = ${SRCROOT}/. +PODS_ROOT = ${SRCROOT}/Pods +PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Pods/Target Support Files/Pods-wallet/Pods-wallet.modulemap b/Pods/Target Support Files/Pods-wallet/Pods-wallet.modulemap new file mode 100644 index 0000000..b9d78fc --- /dev/null +++ b/Pods/Target Support Files/Pods-wallet/Pods-wallet.modulemap @@ -0,0 +1,6 @@ +framework module Pods_wallet { + umbrella header "Pods-wallet-umbrella.h" + + export * + module * { export * } +} diff --git a/Pods/Target Support Files/Pods-wallet/Pods-wallet.release.xcconfig b/Pods/Target Support Files/Pods-wallet/Pods-wallet.release.xcconfig new file mode 100644 index 0000000..553c34e --- /dev/null +++ b/Pods/Target Support Files/Pods-wallet/Pods-wallet.release.xcconfig @@ -0,0 +1,15 @@ +ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES +CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO +FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/QR-Code-Scanner-iOS" "${PODS_CONFIGURATION_BUILD_DIR}/SwiftProtobuf" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/QR-Code-Scanner-iOS/QRCodeScanner.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/SwiftProtobuf/SwiftProtobuf.framework/Headers" +LD_RUNPATH_SEARCH_PATHS = $(inherited) /usr/lib/swift '@executable_path/Frameworks' '@loader_path/Frameworks' +LIBRARY_SEARCH_PATHS = $(inherited) "${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift +OTHER_LDFLAGS = $(inherited) -framework "QRCodeScanner" -framework "SwiftProtobuf" +OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_PODFILE_DIR_PATH = ${SRCROOT}/. +PODS_ROOT = ${SRCROOT}/Pods +PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Pods/Target Support Files/Pods-walletTests/Pods-walletTests-Info.plist b/Pods/Target Support Files/Pods-walletTests/Pods-walletTests-Info.plist new file mode 100644 index 0000000..2243fe6 --- /dev/null +++ b/Pods/Target Support Files/Pods-walletTests/Pods-walletTests-Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + ${PRODUCT_BUNDLE_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0.0 + CFBundleSignature + ???? + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + NSPrincipalClass + + + diff --git a/Pods/Target Support Files/Pods-walletTests/Pods-walletTests-acknowledgements.markdown b/Pods/Target Support Files/Pods-walletTests/Pods-walletTests-acknowledgements.markdown new file mode 100644 index 0000000..102af75 --- /dev/null +++ b/Pods/Target Support Files/Pods-walletTests/Pods-walletTests-acknowledgements.markdown @@ -0,0 +1,3 @@ +# Acknowledgements +This application makes use of the following third party libraries: +Generated by CocoaPods - https://cocoapods.org diff --git a/Pods/Target Support Files/Pods-walletTests/Pods-walletTests-acknowledgements.plist b/Pods/Target Support Files/Pods-walletTests/Pods-walletTests-acknowledgements.plist new file mode 100644 index 0000000..7acbad1 --- /dev/null +++ b/Pods/Target Support Files/Pods-walletTests/Pods-walletTests-acknowledgements.plist @@ -0,0 +1,29 @@ + + + + + PreferenceSpecifiers + + + FooterText + This application makes use of the following third party libraries: + Title + Acknowledgements + Type + PSGroupSpecifier + + + FooterText + Generated by CocoaPods - https://cocoapods.org + Title + + Type + PSGroupSpecifier + + + StringsTable + Acknowledgements + Title + Acknowledgements + + diff --git a/Pods/Target Support Files/Pods-walletTests/Pods-walletTests-dummy.m b/Pods/Target Support Files/Pods-walletTests/Pods-walletTests-dummy.m new file mode 100644 index 0000000..f1cba05 --- /dev/null +++ b/Pods/Target Support Files/Pods-walletTests/Pods-walletTests-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_Pods_walletTests : NSObject +@end +@implementation PodsDummy_Pods_walletTests +@end diff --git a/Pods/Target Support Files/Pods-walletTests/Pods-walletTests-umbrella.h b/Pods/Target Support Files/Pods-walletTests/Pods-walletTests-umbrella.h new file mode 100644 index 0000000..b7b3560 --- /dev/null +++ b/Pods/Target Support Files/Pods-walletTests/Pods-walletTests-umbrella.h @@ -0,0 +1,16 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + + +FOUNDATION_EXPORT double Pods_walletTestsVersionNumber; +FOUNDATION_EXPORT const unsigned char Pods_walletTestsVersionString[]; + diff --git a/Pods/Target Support Files/Pods-walletTests/Pods-walletTests.debug.xcconfig b/Pods/Target Support Files/Pods-walletTests/Pods-walletTests.debug.xcconfig new file mode 100644 index 0000000..39b1ebc --- /dev/null +++ b/Pods/Target Support Files/Pods-walletTests/Pods-walletTests.debug.xcconfig @@ -0,0 +1,11 @@ +CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO +FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/QR-Code-Scanner-iOS" "${PODS_CONFIGURATION_BUILD_DIR}/SwiftProtobuf" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/QR-Code-Scanner-iOS/QRCodeScanner.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/SwiftProtobuf/SwiftProtobuf.framework/Headers" +OTHER_LDFLAGS = $(inherited) -framework "QRCodeScanner" -framework "SwiftProtobuf" +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_PODFILE_DIR_PATH = ${SRCROOT}/. +PODS_ROOT = ${SRCROOT}/Pods +PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Pods/Target Support Files/Pods-walletTests/Pods-walletTests.modulemap b/Pods/Target Support Files/Pods-walletTests/Pods-walletTests.modulemap new file mode 100644 index 0000000..96e8b76 --- /dev/null +++ b/Pods/Target Support Files/Pods-walletTests/Pods-walletTests.modulemap @@ -0,0 +1,6 @@ +framework module Pods_walletTests { + umbrella header "Pods-walletTests-umbrella.h" + + export * + module * { export * } +} diff --git a/Pods/Target Support Files/Pods-walletTests/Pods-walletTests.release.xcconfig b/Pods/Target Support Files/Pods-walletTests/Pods-walletTests.release.xcconfig new file mode 100644 index 0000000..39b1ebc --- /dev/null +++ b/Pods/Target Support Files/Pods-walletTests/Pods-walletTests.release.xcconfig @@ -0,0 +1,11 @@ +CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO +FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/QR-Code-Scanner-iOS" "${PODS_CONFIGURATION_BUILD_DIR}/SwiftProtobuf" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/QR-Code-Scanner-iOS/QRCodeScanner.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/SwiftProtobuf/SwiftProtobuf.framework/Headers" +OTHER_LDFLAGS = $(inherited) -framework "QRCodeScanner" -framework "SwiftProtobuf" +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_PODFILE_DIR_PATH = ${SRCROOT}/. +PODS_ROOT = ${SRCROOT}/Pods +PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Pods/Target Support Files/QR-Code-Scanner-iOS/QR-Code-Scanner-iOS-Info.plist b/Pods/Target Support Files/QR-Code-Scanner-iOS/QR-Code-Scanner-iOS-Info.plist new file mode 100644 index 0000000..2243fe6 --- /dev/null +++ b/Pods/Target Support Files/QR-Code-Scanner-iOS/QR-Code-Scanner-iOS-Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + ${PRODUCT_BUNDLE_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0.0 + CFBundleSignature + ???? + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + NSPrincipalClass + + + diff --git a/Pods/Target Support Files/QR-Code-Scanner-iOS/QR-Code-Scanner-iOS-dummy.m b/Pods/Target Support Files/QR-Code-Scanner-iOS/QR-Code-Scanner-iOS-dummy.m new file mode 100644 index 0000000..be8c1cc --- /dev/null +++ b/Pods/Target Support Files/QR-Code-Scanner-iOS/QR-Code-Scanner-iOS-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_QR_Code_Scanner_iOS : NSObject +@end +@implementation PodsDummy_QR_Code_Scanner_iOS +@end diff --git a/Pods/Target Support Files/QR-Code-Scanner-iOS/QR-Code-Scanner-iOS-prefix.pch b/Pods/Target Support Files/QR-Code-Scanner-iOS/QR-Code-Scanner-iOS-prefix.pch new file mode 100644 index 0000000..beb2a24 --- /dev/null +++ b/Pods/Target Support Files/QR-Code-Scanner-iOS/QR-Code-Scanner-iOS-prefix.pch @@ -0,0 +1,12 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + diff --git a/Pods/Target Support Files/QR-Code-Scanner-iOS/QR-Code-Scanner-iOS-umbrella.h b/Pods/Target Support Files/QR-Code-Scanner-iOS/QR-Code-Scanner-iOS-umbrella.h new file mode 100644 index 0000000..4e5069f --- /dev/null +++ b/Pods/Target Support Files/QR-Code-Scanner-iOS/QR-Code-Scanner-iOS-umbrella.h @@ -0,0 +1,16 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + + +FOUNDATION_EXPORT double QRCodeScannerVersionNumber; +FOUNDATION_EXPORT const unsigned char QRCodeScannerVersionString[]; + diff --git a/Pods/Target Support Files/QR-Code-Scanner-iOS/QR-Code-Scanner-iOS.debug.xcconfig b/Pods/Target Support Files/QR-Code-Scanner-iOS/QR-Code-Scanner-iOS.debug.xcconfig new file mode 100644 index 0000000..f1426e6 --- /dev/null +++ b/Pods/Target Support Files/QR-Code-Scanner-iOS/QR-Code-Scanner-iOS.debug.xcconfig @@ -0,0 +1,13 @@ +CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO +CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/QR-Code-Scanner-iOS +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +LIBRARY_SEARCH_PATHS = $(inherited) "${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift +OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_ROOT = ${SRCROOT} +PODS_TARGET_SRCROOT = ${PODS_ROOT}/QR-Code-Scanner-iOS +PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Pods/Target Support Files/QR-Code-Scanner-iOS/QR-Code-Scanner-iOS.modulemap b/Pods/Target Support Files/QR-Code-Scanner-iOS/QR-Code-Scanner-iOS.modulemap new file mode 100644 index 0000000..6862df1 --- /dev/null +++ b/Pods/Target Support Files/QR-Code-Scanner-iOS/QR-Code-Scanner-iOS.modulemap @@ -0,0 +1,6 @@ +framework module QRCodeScanner { + umbrella header "QR-Code-Scanner-iOS-umbrella.h" + + export * + module * { export * } +} diff --git a/Pods/Target Support Files/QR-Code-Scanner-iOS/QR-Code-Scanner-iOS.release.xcconfig b/Pods/Target Support Files/QR-Code-Scanner-iOS/QR-Code-Scanner-iOS.release.xcconfig new file mode 100644 index 0000000..f1426e6 --- /dev/null +++ b/Pods/Target Support Files/QR-Code-Scanner-iOS/QR-Code-Scanner-iOS.release.xcconfig @@ -0,0 +1,13 @@ +CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO +CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/QR-Code-Scanner-iOS +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +LIBRARY_SEARCH_PATHS = $(inherited) "${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift +OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_ROOT = ${SRCROOT} +PODS_TARGET_SRCROOT = ${PODS_ROOT}/QR-Code-Scanner-iOS +PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Pods/Target Support Files/SwiftProtobuf/SwiftProtobuf-Info.plist b/Pods/Target Support Files/SwiftProtobuf/SwiftProtobuf-Info.plist new file mode 100644 index 0000000..fa6f453 --- /dev/null +++ b/Pods/Target Support Files/SwiftProtobuf/SwiftProtobuf-Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + ${PRODUCT_BUNDLE_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.12.0 + CFBundleSignature + ???? + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + NSPrincipalClass + + + diff --git a/Pods/Target Support Files/SwiftProtobuf/SwiftProtobuf-dummy.m b/Pods/Target Support Files/SwiftProtobuf/SwiftProtobuf-dummy.m new file mode 100644 index 0000000..95f025a --- /dev/null +++ b/Pods/Target Support Files/SwiftProtobuf/SwiftProtobuf-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_SwiftProtobuf : NSObject +@end +@implementation PodsDummy_SwiftProtobuf +@end diff --git a/Pods/Target Support Files/SwiftProtobuf/SwiftProtobuf-prefix.pch b/Pods/Target Support Files/SwiftProtobuf/SwiftProtobuf-prefix.pch new file mode 100644 index 0000000..beb2a24 --- /dev/null +++ b/Pods/Target Support Files/SwiftProtobuf/SwiftProtobuf-prefix.pch @@ -0,0 +1,12 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + diff --git a/Pods/Target Support Files/SwiftProtobuf/SwiftProtobuf-umbrella.h b/Pods/Target Support Files/SwiftProtobuf/SwiftProtobuf-umbrella.h new file mode 100644 index 0000000..6082918 --- /dev/null +++ b/Pods/Target Support Files/SwiftProtobuf/SwiftProtobuf-umbrella.h @@ -0,0 +1,16 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + + +FOUNDATION_EXPORT double SwiftProtobufVersionNumber; +FOUNDATION_EXPORT const unsigned char SwiftProtobufVersionString[]; + diff --git a/Pods/Target Support Files/SwiftProtobuf/SwiftProtobuf.debug.xcconfig b/Pods/Target Support Files/SwiftProtobuf/SwiftProtobuf.debug.xcconfig new file mode 100644 index 0000000..fc81198 --- /dev/null +++ b/Pods/Target Support Files/SwiftProtobuf/SwiftProtobuf.debug.xcconfig @@ -0,0 +1,13 @@ +CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO +CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SwiftProtobuf +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +LIBRARY_SEARCH_PATHS = $(inherited) "${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift +OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_ROOT = ${SRCROOT} +PODS_TARGET_SRCROOT = ${PODS_ROOT}/SwiftProtobuf +PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Pods/Target Support Files/SwiftProtobuf/SwiftProtobuf.modulemap b/Pods/Target Support Files/SwiftProtobuf/SwiftProtobuf.modulemap new file mode 100644 index 0000000..a88eceb --- /dev/null +++ b/Pods/Target Support Files/SwiftProtobuf/SwiftProtobuf.modulemap @@ -0,0 +1,6 @@ +framework module SwiftProtobuf { + umbrella header "SwiftProtobuf-umbrella.h" + + export * + module * { export * } +} diff --git a/Pods/Target Support Files/SwiftProtobuf/SwiftProtobuf.release.xcconfig b/Pods/Target Support Files/SwiftProtobuf/SwiftProtobuf.release.xcconfig new file mode 100644 index 0000000..fc81198 --- /dev/null +++ b/Pods/Target Support Files/SwiftProtobuf/SwiftProtobuf.release.xcconfig @@ -0,0 +1,13 @@ +CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO +CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SwiftProtobuf +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +LIBRARY_SEARCH_PATHS = $(inherited) "${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift +OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_ROOT = ${SRCROOT} +PODS_TARGET_SRCROOT = ${PODS_ROOT}/SwiftProtobuf +PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/wallet.xcodeproj/project.pbxproj b/wallet.xcodeproj/project.pbxproj new file mode 100644 index 0000000..4615bad --- /dev/null +++ b/wallet.xcodeproj/project.pbxproj @@ -0,0 +1,1210 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 51; + objects = { + +/* Begin PBXBuildFile section */ + 00524CF0255B3024003DED89 /* CustomViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00524CEF255B3024003DED89 /* CustomViewController.swift */; }; + 00524CF5255B3170003DED89 /* CustomButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00524CF4255B3170003DED89 /* CustomButton.swift */; }; + 00665E7924E5C71600030A13 /* Lndmobile.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00665E7824E5C71600030A13 /* Lndmobile.framework */; }; + 00665E7A24E5C71600030A13 /* Lndmobile.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00665E7824E5C71600030A13 /* Lndmobile.framework */; }; + 00665E8224E5C72C00030A13 /* LndCallbacks.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00665E7C24E5C72C00030A13 /* LndCallbacks.swift */; }; + 00665E8324E5C72C00030A13 /* LndCallbacks.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00665E7C24E5C72C00030A13 /* LndCallbacks.swift */; }; + 00665E8424E5C72C00030A13 /* Lightning.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00665E7D24E5C72C00030A13 /* Lightning.swift */; }; + 00665E8524E5C72C00030A13 /* Lightning.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00665E7D24E5C72C00030A13 /* Lightning.swift */; }; + 00665E8624E5C72C00030A13 /* lnd.conf in Resources */ = {isa = PBXBuildFile; fileRef = 00665E7E24E5C72C00030A13 /* lnd.conf */; }; + 00665E8724E5C72C00030A13 /* lnd.conf in Resources */ = {isa = PBXBuildFile; fileRef = 00665E7E24E5C72C00030A13 /* lnd.conf */; }; + 00665EA824E9185B00030A13 /* lncli.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00665E9324E9185B00030A13 /* lncli.pb.swift */; }; + 00665EA924E9185B00030A13 /* lncli.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00665E9324E9185B00030A13 /* lncli.pb.swift */; }; + 00665EAA24E9185B00030A13 /* chainnotifier.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00665E9524E9185B00030A13 /* chainnotifier.pb.swift */; }; + 00665EAB24E9185B00030A13 /* chainnotifier.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00665E9524E9185B00030A13 /* chainnotifier.pb.swift */; }; + 00665EAC24E9185B00030A13 /* walletkit.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00665E9724E9185B00030A13 /* walletkit.pb.swift */; }; + 00665EAD24E9185B00030A13 /* walletkit.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00665E9724E9185B00030A13 /* walletkit.pb.swift */; }; + 00665EAE24E9185B00030A13 /* router.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00665E9924E9185B00030A13 /* router.pb.swift */; }; + 00665EAF24E9185B00030A13 /* router.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00665E9924E9185B00030A13 /* router.pb.swift */; }; + 00665EB024E9185B00030A13 /* rpc.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00665E9A24E9185B00030A13 /* rpc.pb.swift */; }; + 00665EB124E9185B00030A13 /* rpc.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00665E9A24E9185B00030A13 /* rpc.pb.swift */; }; + 00665EB224E9185B00030A13 /* autopilot.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00665E9C24E9185B00030A13 /* autopilot.pb.swift */; }; + 00665EB324E9185B00030A13 /* autopilot.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00665E9C24E9185B00030A13 /* autopilot.pb.swift */; }; + 00665EB424E9185B00030A13 /* signer.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00665E9E24E9185B00030A13 /* signer.pb.swift */; }; + 00665EB524E9185B00030A13 /* signer.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00665E9E24E9185B00030A13 /* signer.pb.swift */; }; + 00665EB624E9185B00030A13 /* walletunlocker.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00665E9F24E9185B00030A13 /* walletunlocker.pb.swift */; }; + 00665EB724E9185B00030A13 /* walletunlocker.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00665E9F24E9185B00030A13 /* walletunlocker.pb.swift */; }; + 00665EB824E9185B00030A13 /* watchtower.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00665EA124E9185B00030A13 /* watchtower.pb.swift */; }; + 00665EB924E9185B00030A13 /* watchtower.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00665EA124E9185B00030A13 /* watchtower.pb.swift */; }; + 00665EBA24E9185B00030A13 /* wtclient.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00665EA324E9185B00030A13 /* wtclient.pb.swift */; }; + 00665EBB24E9185B00030A13 /* wtclient.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00665EA324E9185B00030A13 /* wtclient.pb.swift */; }; + 00665EBC24E9185B00030A13 /* verrpc.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00665EA524E9185B00030A13 /* verrpc.pb.swift */; }; + 00665EBD24E9185B00030A13 /* verrpc.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00665EA524E9185B00030A13 /* verrpc.pb.swift */; }; + 00665EBE24E9185B00030A13 /* invoices.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00665EA724E9185B00030A13 /* invoices.pb.swift */; }; + 00665EBF24E9185B00030A13 /* invoices.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00665EA724E9185B00030A13 /* invoices.pb.swift */; }; + 00665EC924EC494A00030A13 /* HomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00665EC824EC494A00030A13 /* HomeViewController.swift */; }; + 00665ECE24EC4B9000030A13 /* UIViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00665ECD24EC4B9000030A13 /* UIViewController.swift */; }; + 00665ED224EC510400030A13 /* EventBus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00665ED124EC510400030A13 /* EventBus.swift */; }; + 00665ED424EC55B300030A13 /* LightningStateMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00665ED324EC55B300030A13 /* LightningStateMonitor.swift */; }; + 00665ED724EF05B700030A13 /* NodePublicKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00665ED624EF05B700030A13 /* NodePublicKey.swift */; }; + 00665ED824EF05B700030A13 /* NodePublicKey.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00665ED624EF05B700030A13 /* NodePublicKey.swift */; }; + 00665ED924EF067900030A13 /* EventBus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00665ED124EC510400030A13 /* EventBus.swift */; }; + 00665EDA24EF067900030A13 /* LightningStateMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00665ED324EC55B300030A13 /* LightningStateMonitor.swift */; }; + 00665EDC24EF07E800030A13 /* Settings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00665EDB24EF07E800030A13 /* Settings.swift */; }; + 00665EDD24EF07E800030A13 /* Settings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00665EDB24EF07E800030A13 /* Settings.swift */; }; + 00B045C0250CDFDE0060D4D1 /* LightningError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00B045BF250CDFDE0060D4D1 /* LightningError.swift */; }; + 00FB66A82507FCBD003461CD /* lnd-regtest.conf in Resources */ = {isa = PBXBuildFile; fileRef = 00FB66A72507FCBD003461CD /* lnd-regtest.conf */; }; + 3A0EBBC528AF752000989970 /* HomeVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A0EBBC328AF752000989970 /* HomeVC.swift */; }; + 3A0EBBC628AF752000989970 /* HomeVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3A0EBBC428AF752000989970 /* HomeVC.xib */; }; + 3A50665328B3768500073CA0 /* PaymentsVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A50665128B3768500073CA0 /* PaymentsVC.swift */; }; + 3A50665428B3768500073CA0 /* PaymentsVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3A50665228B3768500073CA0 /* PaymentsVC.xib */; }; + 3AFBD33A28B37B2800F8CC54 /* ChannelsVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AFBD33828B37B2800F8CC54 /* ChannelsVC.swift */; }; + 3AFBD33B28B37B2800F8CC54 /* ChannelsVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3AFBD33928B37B2800F8CC54 /* ChannelsVC.xib */; }; + 3AFBD33D28B3822D00F8CC54 /* PaymentsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AFBD33C28B3822D00F8CC54 /* PaymentsViewModel.swift */; }; + 3AFBD34128B4D0EC00F8CC54 /* ChannelsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AFBD34028B4D0EC00F8CC54 /* ChannelsViewModel.swift */; }; + 3AFBD34328B66DAD00F8CC54 /* Int64.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AFBD34228B66DAD00F8CC54 /* Int64.swift */; }; + 3AFBD34528B66FF300F8CC54 /* Date.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AFBD34428B66FF300F8CC54 /* Date.swift */; }; + 3C42530BF0760EAA4F38CEDD /* Pods_wallet_walletUITests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8169844622EC1A934F64E4C8 /* Pods_wallet_walletUITests.framework */; }; + 4029655179169C028F45B373 /* Pods_walletTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EE6665EF031EDC3E364CE652 /* Pods_walletTests.framework */; }; + 7A2CC33D24EF5C6E00E2605A /* Colors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A2CC33C24EF5C6E00E2605A /* Colors.swift */; }; + 7A2CC34424EF63E200E2605A /* Theme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A2CC34324EF63E200E2605A /* Theme.swift */; }; + 7A2CC34924EF6F7A00E2605A /* Fonts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A2CC34824EF6F7A00E2605A /* Fonts.swift */; }; + 7A2CC35124EF73AD00E2605A /* Navigation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A2CC35024EF73AD00E2605A /* Navigation.swift */; }; + 7A2CC36124F1CD3400E2605A /* sofia_pro_medium.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 7A2CC35E24F1CD3400E2605A /* sofia_pro_medium.ttf */; }; + 7A2CC36224F1CD3400E2605A /* sofia_pro_regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 7A2CC35F24F1CD3400E2605A /* sofia_pro_regular.ttf */; }; + 7A2CC36324F1CD3400E2605A /* sofia_pro_bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 7A2CC36024F1CD3400E2605A /* sofia_pro_bold.ttf */; }; + 7A2CC36724F2CD6000E2605A /* LoadingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A2CC36624F2CD6000E2605A /* LoadingView.swift */; }; + 7A2CC36924F2D24900E2605A /* UIView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A2CC36824F2D24900E2605A /* UIView.swift */; }; + 7A2CC36B24F2D37200E2605A /* ErrorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A2CC36A24F2D37200E2605A /* ErrorView.swift */; }; + 7A2CC36E24F2D7CD00E2605A /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 7A2CC37024F2D7CD00E2605A /* Localizable.strings */; }; + 7A2CC37224F2D82E00E2605A /* Strings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A2CC37124F2D82E00E2605A /* Strings.swift */; }; + 7A2CC37424F3488F00E2605A /* Observable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A2CC37324F3488F00E2605A /* Observable.swift */; }; + 7A2CC37724F348FE00E2605A /* HomeViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A2CC37624F348FE00E2605A /* HomeViewModel.swift */; }; + 7A2CC37A24F3495500E2605A /* ExampleRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A2CC37924F3495500E2605A /* ExampleRepository.swift */; }; + 7A2CC37C24F3510900E2605A /* ViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A2CC37B24F3510900E2605A /* ViewModel.swift */; }; + 7A811E9A24F8918D00F8D8C8 /* UIImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A811E9924F8918D00F8D8C8 /* UIImage.swift */; }; + 7A811E9C24F8930A00F8D8C8 /* Icons.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A811E9B24F8930A00F8D8C8 /* Icons.swift */; }; + 7A811E9E24F8A66B00F8D8C8 /* Dimens.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A811E9D24F8A66B00F8D8C8 /* Dimens.swift */; }; + 7A811EA024FC103E00F8D8C8 /* LightningRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A811E9F24FC103E00F8D8C8 /* LightningRepository.swift */; }; + 7A811EA824FC455400F8D8C8 /* Misc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A811EA724FC455400F8D8C8 /* Misc.swift */; }; + 7A811EAC24FC7E1000F8D8C8 /* RequestViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A811EAB24FC7E0F00F8D8C8 /* RequestViewModel.swift */; }; + 7ABFCBD124E4EBFD0012EF39 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7ABFCBD024E4EBFD0012EF39 /* AppDelegate.swift */; }; + 7ABFCBD324E4EBFD0012EF39 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7ABFCBD224E4EBFD0012EF39 /* SceneDelegate.swift */; }; + 7ABFCBD724E4EC010012EF39 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7ABFCBD624E4EC010012EF39 /* Assets.xcassets */; }; + 7ABFCBDD24E4EC010012EF39 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7ABFCBDB24E4EC010012EF39 /* LaunchScreen.storyboard */; }; + 7ABFCBE824E4EC010012EF39 /* LightningTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7ABFCBE724E4EC010012EF39 /* LightningTests.swift */; }; + 7ABFCBF324E4EC010012EF39 /* walletUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7ABFCBF224E4EC010012EF39 /* walletUITests.swift */; }; + 9E840E98A4801A110F5387E7 /* Pods_wallet.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8F290869CC2E00AF959ABA33 /* Pods_wallet.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 7ABFCBE424E4EC010012EF39 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 7ABFCBC524E4EBFD0012EF39 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 7ABFCBCC24E4EBFD0012EF39; + remoteInfo = wallet; + }; + 7ABFCBEF24E4EC010012EF39 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 7ABFCBC524E4EBFD0012EF39 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 7ABFCBCC24E4EBFD0012EF39; + remoteInfo = wallet; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 00524CEF255B3024003DED89 /* CustomViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomViewController.swift; sourceTree = ""; }; + 00524CF4255B3170003DED89 /* CustomButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomButton.swift; sourceTree = ""; }; + 00665E7824E5C71600030A13 /* Lndmobile.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Lndmobile.framework; sourceTree = ""; }; + 00665E7C24E5C72C00030A13 /* LndCallbacks.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LndCallbacks.swift; sourceTree = ""; }; + 00665E7D24E5C72C00030A13 /* Lightning.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Lightning.swift; sourceTree = ""; }; + 00665E7E24E5C72C00030A13 /* lnd.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = lnd.conf; sourceTree = ""; }; + 00665E8C24E5C79500030A13 /* wallet-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "wallet-Bridging-Header.h"; sourceTree = ""; }; + 00665E8D24E5C79500030A13 /* walletTests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "walletTests-Bridging-Header.h"; sourceTree = ""; }; + 00665E9324E9185B00030A13 /* lncli.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = lncli.pb.swift; sourceTree = ""; }; + 00665E9524E9185B00030A13 /* chainnotifier.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = chainnotifier.pb.swift; sourceTree = ""; }; + 00665E9724E9185B00030A13 /* walletkit.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = walletkit.pb.swift; sourceTree = ""; }; + 00665E9924E9185B00030A13 /* router.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = router.pb.swift; sourceTree = ""; }; + 00665E9A24E9185B00030A13 /* rpc.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = rpc.pb.swift; sourceTree = ""; }; + 00665E9C24E9185B00030A13 /* autopilot.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = autopilot.pb.swift; sourceTree = ""; }; + 00665E9E24E9185B00030A13 /* signer.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = signer.pb.swift; sourceTree = ""; }; + 00665E9F24E9185B00030A13 /* walletunlocker.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = walletunlocker.pb.swift; sourceTree = ""; }; + 00665EA124E9185B00030A13 /* watchtower.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = watchtower.pb.swift; sourceTree = ""; }; + 00665EA324E9185B00030A13 /* wtclient.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = wtclient.pb.swift; sourceTree = ""; }; + 00665EA524E9185B00030A13 /* verrpc.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = verrpc.pb.swift; sourceTree = ""; }; + 00665EA724E9185B00030A13 /* invoices.pb.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = invoices.pb.swift; sourceTree = ""; }; + 00665EC824EC494A00030A13 /* HomeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeViewController.swift; sourceTree = ""; }; + 00665ECD24EC4B9000030A13 /* UIViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIViewController.swift; sourceTree = ""; }; + 00665ED124EC510400030A13 /* EventBus.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventBus.swift; sourceTree = ""; }; + 00665ED324EC55B300030A13 /* LightningStateMonitor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LightningStateMonitor.swift; sourceTree = ""; }; + 00665ED624EF05B700030A13 /* NodePublicKey.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NodePublicKey.swift; sourceTree = ""; }; + 00665EDB24EF07E800030A13 /* Settings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Settings.swift; sourceTree = ""; }; + 00B045BF250CDFDE0060D4D1 /* LightningError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LightningError.swift; sourceTree = ""; }; + 00FB66A72507FCBD003461CD /* lnd-regtest.conf */ = {isa = PBXFileReference; lastKnownFileType = text; path = "lnd-regtest.conf"; sourceTree = ""; }; + 22C1F2815F66B3F1B4C860DC /* Pods-wallet-walletUITests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-wallet-walletUITests.release.xcconfig"; path = "Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests.release.xcconfig"; sourceTree = ""; }; + 3A0EBBC328AF752000989970 /* HomeVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeVC.swift; sourceTree = ""; }; + 3A0EBBC428AF752000989970 /* HomeVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = HomeVC.xib; sourceTree = ""; }; + 3A50665128B3768500073CA0 /* PaymentsVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PaymentsVC.swift; sourceTree = ""; }; + 3A50665228B3768500073CA0 /* PaymentsVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = PaymentsVC.xib; sourceTree = ""; }; + 3AFBD33828B37B2800F8CC54 /* ChannelsVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChannelsVC.swift; sourceTree = ""; }; + 3AFBD33928B37B2800F8CC54 /* ChannelsVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ChannelsVC.xib; sourceTree = ""; }; + 3AFBD33C28B3822D00F8CC54 /* PaymentsViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PaymentsViewModel.swift; sourceTree = ""; }; + 3AFBD34028B4D0EC00F8CC54 /* ChannelsViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChannelsViewModel.swift; sourceTree = ""; }; + 3AFBD34228B66DAD00F8CC54 /* Int64.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Int64.swift; sourceTree = ""; }; + 3AFBD34428B66FF300F8CC54 /* Date.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Date.swift; sourceTree = ""; }; + 49151D7AE89BC38CAB768074 /* Pods-walletTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-walletTests.debug.xcconfig"; path = "Target Support Files/Pods-walletTests/Pods-walletTests.debug.xcconfig"; sourceTree = ""; }; + 4C2A1A61CA82F3F36E6DB4B2 /* Pods-walletTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-walletTests.release.xcconfig"; path = "Target Support Files/Pods-walletTests/Pods-walletTests.release.xcconfig"; sourceTree = ""; }; + 59841CD97AB95EE18B1586B5 /* Pods-wallet-walletUITests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-wallet-walletUITests.debug.xcconfig"; path = "Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests.debug.xcconfig"; sourceTree = ""; }; + 61751AE73E16766A4665327B /* Pods-wallet.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-wallet.release.xcconfig"; path = "Target Support Files/Pods-wallet/Pods-wallet.release.xcconfig"; sourceTree = ""; }; + 7A2CC33C24EF5C6E00E2605A /* Colors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Colors.swift; sourceTree = ""; }; + 7A2CC34324EF63E200E2605A /* Theme.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Theme.swift; sourceTree = ""; }; + 7A2CC34824EF6F7A00E2605A /* Fonts.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Fonts.swift; sourceTree = ""; }; + 7A2CC35024EF73AD00E2605A /* Navigation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Navigation.swift; sourceTree = ""; }; + 7A2CC35E24F1CD3400E2605A /* sofia_pro_medium.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = sofia_pro_medium.ttf; sourceTree = ""; }; + 7A2CC35F24F1CD3400E2605A /* sofia_pro_regular.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = sofia_pro_regular.ttf; sourceTree = ""; }; + 7A2CC36024F1CD3400E2605A /* sofia_pro_bold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = sofia_pro_bold.ttf; sourceTree = ""; }; + 7A2CC36624F2CD6000E2605A /* LoadingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoadingView.swift; sourceTree = ""; }; + 7A2CC36824F2D24900E2605A /* UIView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIView.swift; sourceTree = ""; }; + 7A2CC36A24F2D37200E2605A /* ErrorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ErrorView.swift; sourceTree = ""; }; + 7A2CC36F24F2D7CD00E2605A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; + 7A2CC37124F2D82E00E2605A /* Strings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Strings.swift; sourceTree = ""; }; + 7A2CC37324F3488F00E2605A /* Observable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Observable.swift; sourceTree = ""; }; + 7A2CC37624F348FE00E2605A /* HomeViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeViewModel.swift; sourceTree = ""; }; + 7A2CC37924F3495500E2605A /* ExampleRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExampleRepository.swift; sourceTree = ""; }; + 7A2CC37B24F3510900E2605A /* ViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewModel.swift; sourceTree = ""; }; + 7A811E9924F8918D00F8D8C8 /* UIImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIImage.swift; sourceTree = ""; }; + 7A811E9B24F8930A00F8D8C8 /* Icons.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Icons.swift; sourceTree = ""; }; + 7A811E9D24F8A66B00F8D8C8 /* Dimens.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Dimens.swift; sourceTree = ""; }; + 7A811E9F24FC103E00F8D8C8 /* LightningRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LightningRepository.swift; sourceTree = ""; }; + 7A811EA724FC455400F8D8C8 /* Misc.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Misc.swift; sourceTree = ""; }; + 7A811EAB24FC7E0F00F8D8C8 /* RequestViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RequestViewModel.swift; sourceTree = ""; }; + 7ABFCBCD24E4EBFD0012EF39 /* wallet.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = wallet.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 7ABFCBD024E4EBFD0012EF39 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 7ABFCBD224E4EBFD0012EF39 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; + 7ABFCBD624E4EC010012EF39 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 7ABFCBDC24E4EC010012EF39 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 7ABFCBDE24E4EC010012EF39 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 7ABFCBE324E4EC010012EF39 /* walletTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = walletTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 7ABFCBE724E4EC010012EF39 /* LightningTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LightningTests.swift; sourceTree = ""; }; + 7ABFCBE924E4EC010012EF39 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 7ABFCBEE24E4EC010012EF39 /* walletUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = walletUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 7ABFCBF224E4EC010012EF39 /* walletUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = walletUITests.swift; sourceTree = ""; }; + 7ABFCBF424E4EC010012EF39 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 8169844622EC1A934F64E4C8 /* Pods_wallet_walletUITests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_wallet_walletUITests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 8F290869CC2E00AF959ABA33 /* Pods_wallet.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_wallet.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + EE6665EF031EDC3E364CE652 /* Pods_walletTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_walletTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + F77AAF824A3306842FDC9AC0 /* Pods-wallet.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-wallet.debug.xcconfig"; path = "Target Support Files/Pods-wallet/Pods-wallet.debug.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 7ABFCBCA24E4EBFD0012EF39 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 9E840E98A4801A110F5387E7 /* Pods_wallet.framework in Frameworks */, + 00665E7924E5C71600030A13 /* Lndmobile.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 7ABFCBE024E4EC010012EF39 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 4029655179169C028F45B373 /* Pods_walletTests.framework in Frameworks */, + 00665E7A24E5C71600030A13 /* Lndmobile.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 7ABFCBEB24E4EC010012EF39 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 3C42530BF0760EAA4F38CEDD /* Pods_wallet_walletUITests.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 00665E7B24E5C72C00030A13 /* Lightning */ = { + isa = PBXGroup; + children = ( + 00665E7D24E5C72C00030A13 /* Lightning.swift */, + 00665E7C24E5C72C00030A13 /* LndCallbacks.swift */, + 00665E7E24E5C72C00030A13 /* lnd.conf */, + 00FB66A72507FCBD003461CD /* lnd-regtest.conf */, + 00665ED024EC504F00030A13 /* Utils */, + 00665E7F24E5C72C00030A13 /* rpc */, + ); + path = Lightning; + sourceTree = ""; + }; + 00665E7F24E5C72C00030A13 /* rpc */ = { + isa = PBXGroup; + children = ( + 00665E9B24E9185B00030A13 /* autopilotrpc */, + 00665E9424E9185B00030A13 /* chainrpc */, + 00665EA624E9185B00030A13 /* invoicesrpc */, + 00665E9224E9185B00030A13 /* lnclipb */, + 00665E9824E9185B00030A13 /* routerrpc */, + 00665E9A24E9185B00030A13 /* rpc.pb.swift */, + 00665E9D24E9185B00030A13 /* signrpc */, + 00665EA424E9185B00030A13 /* verrpc */, + 00665E9624E9185B00030A13 /* walletrpc */, + 00665E9F24E9185B00030A13 /* walletunlocker.pb.swift */, + 00665EA024E9185B00030A13 /* watchtowerrpc */, + 00665EA224E9185B00030A13 /* wtclientrpc */, + ); + path = rpc; + sourceTree = ""; + }; + 00665E9224E9185B00030A13 /* lnclipb */ = { + isa = PBXGroup; + children = ( + 00665E9324E9185B00030A13 /* lncli.pb.swift */, + ); + path = lnclipb; + sourceTree = ""; + }; + 00665E9424E9185B00030A13 /* chainrpc */ = { + isa = PBXGroup; + children = ( + 00665E9524E9185B00030A13 /* chainnotifier.pb.swift */, + ); + path = chainrpc; + sourceTree = ""; + }; + 00665E9624E9185B00030A13 /* walletrpc */ = { + isa = PBXGroup; + children = ( + 00665E9724E9185B00030A13 /* walletkit.pb.swift */, + ); + path = walletrpc; + sourceTree = ""; + }; + 00665E9824E9185B00030A13 /* routerrpc */ = { + isa = PBXGroup; + children = ( + 00665E9924E9185B00030A13 /* router.pb.swift */, + ); + path = routerrpc; + sourceTree = ""; + }; + 00665E9B24E9185B00030A13 /* autopilotrpc */ = { + isa = PBXGroup; + children = ( + 00665E9C24E9185B00030A13 /* autopilot.pb.swift */, + ); + path = autopilotrpc; + sourceTree = ""; + }; + 00665E9D24E9185B00030A13 /* signrpc */ = { + isa = PBXGroup; + children = ( + 00665E9E24E9185B00030A13 /* signer.pb.swift */, + ); + path = signrpc; + sourceTree = ""; + }; + 00665EA024E9185B00030A13 /* watchtowerrpc */ = { + isa = PBXGroup; + children = ( + 00665EA124E9185B00030A13 /* watchtower.pb.swift */, + ); + path = watchtowerrpc; + sourceTree = ""; + }; + 00665EA224E9185B00030A13 /* wtclientrpc */ = { + isa = PBXGroup; + children = ( + 00665EA324E9185B00030A13 /* wtclient.pb.swift */, + ); + path = wtclientrpc; + sourceTree = ""; + }; + 00665EA424E9185B00030A13 /* verrpc */ = { + isa = PBXGroup; + children = ( + 00665EA524E9185B00030A13 /* verrpc.pb.swift */, + ); + path = verrpc; + sourceTree = ""; + }; + 00665EA624E9185B00030A13 /* invoicesrpc */ = { + isa = PBXGroup; + children = ( + 00665EA724E9185B00030A13 /* invoices.pb.swift */, + ); + path = invoicesrpc; + sourceTree = ""; + }; + 00665ECA24EC4B3600030A13 /* ViewControllers */ = { + isa = PBXGroup; + children = ( + 00665EC824EC494A00030A13 /* HomeViewController.swift */, + 00524CEF255B3024003DED89 /* CustomViewController.swift */, + 3A0EBBC328AF752000989970 /* HomeVC.swift */, + 3A0EBBC428AF752000989970 /* HomeVC.xib */, + 3A50665128B3768500073CA0 /* PaymentsVC.swift */, + 3A50665228B3768500073CA0 /* PaymentsVC.xib */, + 3AFBD33828B37B2800F8CC54 /* ChannelsVC.swift */, + 3AFBD33928B37B2800F8CC54 /* ChannelsVC.xib */, + ); + path = ViewControllers; + sourceTree = ""; + }; + 00665ECB24EC4B6900030A13 /* Utils */ = { + isa = PBXGroup; + children = ( + 00665ECC24EC4B7E00030A13 /* Extensions */, + 00665EDB24EF07E800030A13 /* Settings.swift */, + 7A2CC33C24EF5C6E00E2605A /* Colors.swift */, + 7A2CC34324EF63E200E2605A /* Theme.swift */, + 7A2CC34824EF6F7A00E2605A /* Fonts.swift */, + 7A2CC35024EF73AD00E2605A /* Navigation.swift */, + 7A2CC37124F2D82E00E2605A /* Strings.swift */, + 7A2CC37324F3488F00E2605A /* Observable.swift */, + 7A811E9B24F8930A00F8D8C8 /* Icons.swift */, + 7A811E9D24F8A66B00F8D8C8 /* Dimens.swift */, + ); + path = Utils; + sourceTree = ""; + }; + 00665ECC24EC4B7E00030A13 /* Extensions */ = { + isa = PBXGroup; + children = ( + 00665ECD24EC4B9000030A13 /* UIViewController.swift */, + 7A2CC36824F2D24900E2605A /* UIView.swift */, + 7A811E9924F8918D00F8D8C8 /* UIImage.swift */, + 7A811EA724FC455400F8D8C8 /* Misc.swift */, + 3AFBD34228B66DAD00F8CC54 /* Int64.swift */, + 3AFBD34428B66FF300F8CC54 /* Date.swift */, + ); + path = Extensions; + sourceTree = ""; + }; + 00665ED024EC504F00030A13 /* Utils */ = { + isa = PBXGroup; + children = ( + 00665ED124EC510400030A13 /* EventBus.swift */, + 00665ED324EC55B300030A13 /* LightningStateMonitor.swift */, + 00665ED624EF05B700030A13 /* NodePublicKey.swift */, + 00B045BF250CDFDE0060D4D1 /* LightningError.swift */, + ); + path = Utils; + sourceTree = ""; + }; + 329457048B50980C6F7F3FDA /* Pods */ = { + isa = PBXGroup; + children = ( + F77AAF824A3306842FDC9AC0 /* Pods-wallet.debug.xcconfig */, + 61751AE73E16766A4665327B /* Pods-wallet.release.xcconfig */, + 59841CD97AB95EE18B1586B5 /* Pods-wallet-walletUITests.debug.xcconfig */, + 22C1F2815F66B3F1B4C860DC /* Pods-wallet-walletUITests.release.xcconfig */, + 49151D7AE89BC38CAB768074 /* Pods-walletTests.debug.xcconfig */, + 4C2A1A61CA82F3F36E6DB4B2 /* Pods-walletTests.release.xcconfig */, + ); + path = Pods; + sourceTree = ""; + }; + 6786B70A1C6DB75C8516CCFC /* Frameworks */ = { + isa = PBXGroup; + children = ( + 00665E7824E5C71600030A13 /* Lndmobile.framework */, + 8F290869CC2E00AF959ABA33 /* Pods_wallet.framework */, + 8169844622EC1A934F64E4C8 /* Pods_wallet_walletUITests.framework */, + EE6665EF031EDC3E364CE652 /* Pods_walletTests.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 7A2CC36424F1CD6B00E2605A /* Fonts */ = { + isa = PBXGroup; + children = ( + 7A2CC36024F1CD3400E2605A /* sofia_pro_bold.ttf */, + 7A2CC35E24F1CD3400E2605A /* sofia_pro_medium.ttf */, + 7A2CC35F24F1CD3400E2605A /* sofia_pro_regular.ttf */, + ); + path = Fonts; + sourceTree = ""; + }; + 7A2CC36524F2CD4500E2605A /* Views */ = { + isa = PBXGroup; + children = ( + 7A2CC36624F2CD6000E2605A /* LoadingView.swift */, + 7A2CC36A24F2D37200E2605A /* ErrorView.swift */, + 00524CF4255B3170003DED89 /* CustomButton.swift */, + ); + path = Views; + sourceTree = ""; + }; + 7A2CC37524F348DD00E2605A /* ViewModels */ = { + isa = PBXGroup; + children = ( + 7A2CC37624F348FE00E2605A /* HomeViewModel.swift */, + 7A2CC37B24F3510900E2605A /* ViewModel.swift */, + 7A811EAB24FC7E0F00F8D8C8 /* RequestViewModel.swift */, + 3AFBD33C28B3822D00F8CC54 /* PaymentsViewModel.swift */, + 3AFBD34028B4D0EC00F8CC54 /* ChannelsViewModel.swift */, + ); + path = ViewModels; + sourceTree = ""; + }; + 7A2CC37824F3493400E2605A /* Repository */ = { + isa = PBXGroup; + children = ( + 7A2CC37924F3495500E2605A /* ExampleRepository.swift */, + 7A811E9F24FC103E00F8D8C8 /* LightningRepository.swift */, + ); + path = Repository; + sourceTree = ""; + }; + 7ABFCBC424E4EBFD0012EF39 = { + isa = PBXGroup; + children = ( + 7ABFCBCF24E4EBFD0012EF39 /* wallet */, + 7ABFCBE624E4EC010012EF39 /* walletTests */, + 7ABFCBF124E4EC010012EF39 /* walletUITests */, + 7ABFCBCE24E4EBFD0012EF39 /* Products */, + 329457048B50980C6F7F3FDA /* Pods */, + 6786B70A1C6DB75C8516CCFC /* Frameworks */, + ); + sourceTree = ""; + }; + 7ABFCBCE24E4EBFD0012EF39 /* Products */ = { + isa = PBXGroup; + children = ( + 7ABFCBCD24E4EBFD0012EF39 /* wallet.app */, + 7ABFCBE324E4EC010012EF39 /* walletTests.xctest */, + 7ABFCBEE24E4EC010012EF39 /* walletUITests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 7ABFCBCF24E4EBFD0012EF39 /* wallet */ = { + isa = PBXGroup; + children = ( + 00665E8C24E5C79500030A13 /* wallet-Bridging-Header.h */, + 00665E8D24E5C79500030A13 /* walletTests-Bridging-Header.h */, + 7ABFCBD024E4EBFD0012EF39 /* AppDelegate.swift */, + 7ABFCBD224E4EBFD0012EF39 /* SceneDelegate.swift */, + 7ABFCBD624E4EC010012EF39 /* Assets.xcassets */, + 7ABFCBDB24E4EC010012EF39 /* LaunchScreen.storyboard */, + 7ABFCBDE24E4EC010012EF39 /* Info.plist */, + 7A2CC37024F2D7CD00E2605A /* Localizable.strings */, + 00665E7B24E5C72C00030A13 /* Lightning */, + 00665ECA24EC4B3600030A13 /* ViewControllers */, + 7A2CC37524F348DD00E2605A /* ViewModels */, + 7A2CC36524F2CD4500E2605A /* Views */, + 7A2CC37824F3493400E2605A /* Repository */, + 00665ECB24EC4B6900030A13 /* Utils */, + 7A2CC36424F1CD6B00E2605A /* Fonts */, + ); + path = wallet; + sourceTree = ""; + }; + 7ABFCBE624E4EC010012EF39 /* walletTests */ = { + isa = PBXGroup; + children = ( + 7ABFCBE724E4EC010012EF39 /* LightningTests.swift */, + 7ABFCBE924E4EC010012EF39 /* Info.plist */, + ); + path = walletTests; + sourceTree = ""; + }; + 7ABFCBF124E4EC010012EF39 /* walletUITests */ = { + isa = PBXGroup; + children = ( + 7ABFCBF224E4EC010012EF39 /* walletUITests.swift */, + 7ABFCBF424E4EC010012EF39 /* Info.plist */, + ); + path = walletUITests; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 7ABFCBCC24E4EBFD0012EF39 /* wallet */ = { + isa = PBXNativeTarget; + buildConfigurationList = 7ABFCBF724E4EC010012EF39 /* Build configuration list for PBXNativeTarget "wallet" */; + buildPhases = ( + 7718801B96D724EB8467234F /* [CP] Check Pods Manifest.lock */, + 7ABFCBC924E4EBFD0012EF39 /* Sources */, + 7ABFCBCA24E4EBFD0012EF39 /* Frameworks */, + 7ABFCBCB24E4EBFD0012EF39 /* Resources */, + DF09A66A781A608C4E89EDD4 /* [CP] Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = wallet; + productName = wallet; + productReference = 7ABFCBCD24E4EBFD0012EF39 /* wallet.app */; + productType = "com.apple.product-type.application"; + }; + 7ABFCBE224E4EC010012EF39 /* walletTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 7ABFCBFA24E4EC010012EF39 /* Build configuration list for PBXNativeTarget "walletTests" */; + buildPhases = ( + FC8940001A88E13B899C444A /* [CP] Check Pods Manifest.lock */, + 7ABFCBDF24E4EC010012EF39 /* Sources */, + 7ABFCBE024E4EC010012EF39 /* Frameworks */, + 7ABFCBE124E4EC010012EF39 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 7ABFCBE524E4EC010012EF39 /* PBXTargetDependency */, + ); + name = walletTests; + productName = walletTests; + productReference = 7ABFCBE324E4EC010012EF39 /* walletTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 7ABFCBED24E4EC010012EF39 /* walletUITests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 7ABFCBFD24E4EC010012EF39 /* Build configuration list for PBXNativeTarget "walletUITests" */; + buildPhases = ( + F4287B27E6E1CCCB5407B49D /* [CP] Check Pods Manifest.lock */, + 7ABFCBEA24E4EC010012EF39 /* Sources */, + 7ABFCBEB24E4EC010012EF39 /* Frameworks */, + 7ABFCBEC24E4EC010012EF39 /* Resources */, + C2BB38EB47EE7CF1B11AADA2 /* [CP] Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 7ABFCBF024E4EC010012EF39 /* PBXTargetDependency */, + ); + name = walletUITests; + productName = walletUITests; + productReference = 7ABFCBEE24E4EC010012EF39 /* walletUITests.xctest */; + productType = "com.apple.product-type.bundle.ui-testing"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 7ABFCBC524E4EBFD0012EF39 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1130; + LastUpgradeCheck = 1130; + ORGANIZATIONNAME = Jason; + TargetAttributes = { + 7ABFCBCC24E4EBFD0012EF39 = { + CreatedOnToolsVersion = 11.3.1; + LastSwiftMigration = 1160; + }; + 7ABFCBE224E4EC010012EF39 = { + CreatedOnToolsVersion = 11.3.1; + LastSwiftMigration = 1160; + TestTargetID = 7ABFCBCC24E4EBFD0012EF39; + }; + 7ABFCBED24E4EC010012EF39 = { + CreatedOnToolsVersion = 11.3.1; + TestTargetID = 7ABFCBCC24E4EBFD0012EF39; + }; + }; + }; + buildConfigurationList = 7ABFCBC824E4EBFD0012EF39 /* Build configuration list for PBXProject "wallet" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 7ABFCBC424E4EBFD0012EF39; + productRefGroup = 7ABFCBCE24E4EBFD0012EF39 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 7ABFCBCC24E4EBFD0012EF39 /* wallet */, + 7ABFCBE224E4EC010012EF39 /* walletTests */, + 7ABFCBED24E4EC010012EF39 /* walletUITests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 7ABFCBCB24E4EBFD0012EF39 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 7ABFCBDD24E4EC010012EF39 /* LaunchScreen.storyboard in Resources */, + 3A50665428B3768500073CA0 /* PaymentsVC.xib in Resources */, + 00665E8624E5C72C00030A13 /* lnd.conf in Resources */, + 7A2CC36324F1CD3400E2605A /* sofia_pro_bold.ttf in Resources */, + 7A2CC36E24F2D7CD00E2605A /* Localizable.strings in Resources */, + 3A0EBBC628AF752000989970 /* HomeVC.xib in Resources */, + 7A2CC36224F1CD3400E2605A /* sofia_pro_regular.ttf in Resources */, + 00FB66A82507FCBD003461CD /* lnd-regtest.conf in Resources */, + 3AFBD33B28B37B2800F8CC54 /* ChannelsVC.xib in Resources */, + 7A2CC36124F1CD3400E2605A /* sofia_pro_medium.ttf in Resources */, + 7ABFCBD724E4EC010012EF39 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 7ABFCBE124E4EC010012EF39 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 00665E8724E5C72C00030A13 /* lnd.conf in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 7ABFCBEC24E4EC010012EF39 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 7718801B96D724EB8467234F /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-wallet-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + C2BB38EB47EE7CF1B11AADA2 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-wallet-walletUITests/Pods-wallet-walletUITests-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + DF09A66A781A608C4E89EDD4 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-wallet/Pods-wallet-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-wallet/Pods-wallet-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-wallet/Pods-wallet-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + F4287B27E6E1CCCB5407B49D /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-wallet-walletUITests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + FC8940001A88E13B899C444A /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-walletTests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 7ABFCBC924E4EBFD0012EF39 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 7A811E9A24F8918D00F8D8C8 /* UIImage.swift in Sources */, + 00665ED724EF05B700030A13 /* NodePublicKey.swift in Sources */, + 7A2CC37224F2D82E00E2605A /* Strings.swift in Sources */, + 7A811EA824FC455400F8D8C8 /* Misc.swift in Sources */, + 00665EBA24E9185B00030A13 /* wtclient.pb.swift in Sources */, + 00665ED224EC510400030A13 /* EventBus.swift in Sources */, + 3AFBD33D28B3822D00F8CC54 /* PaymentsViewModel.swift in Sources */, + 7ABFCBD124E4EBFD0012EF39 /* AppDelegate.swift in Sources */, + 7A2CC36724F2CD6000E2605A /* LoadingView.swift in Sources */, + 7ABFCBD324E4EBFD0012EF39 /* SceneDelegate.swift in Sources */, + 3A0EBBC528AF752000989970 /* HomeVC.swift in Sources */, + 00665ECE24EC4B9000030A13 /* UIViewController.swift in Sources */, + 00665EA824E9185B00030A13 /* lncli.pb.swift in Sources */, + 7A2CC37424F3488F00E2605A /* Observable.swift in Sources */, + 00665EC924EC494A00030A13 /* HomeViewController.swift in Sources */, + 7A811E9E24F8A66B00F8D8C8 /* Dimens.swift in Sources */, + 7A2CC37C24F3510900E2605A /* ViewModel.swift in Sources */, + 00524CF0255B3024003DED89 /* CustomViewController.swift in Sources */, + 00665EB024E9185B00030A13 /* rpc.pb.swift in Sources */, + 00665EAA24E9185B00030A13 /* chainnotifier.pb.swift in Sources */, + 00665EB424E9185B00030A13 /* signer.pb.swift in Sources */, + 00665EBE24E9185B00030A13 /* invoices.pb.swift in Sources */, + 7A811E9C24F8930A00F8D8C8 /* Icons.swift in Sources */, + 7A811EA024FC103E00F8D8C8 /* LightningRepository.swift in Sources */, + 00665E8424E5C72C00030A13 /* Lightning.swift in Sources */, + 7A2CC33D24EF5C6E00E2605A /* Colors.swift in Sources */, + 00665EAC24E9185B00030A13 /* walletkit.pb.swift in Sources */, + 00665E8224E5C72C00030A13 /* LndCallbacks.swift in Sources */, + 7A2CC34424EF63E200E2605A /* Theme.swift in Sources */, + 00524CF5255B3170003DED89 /* CustomButton.swift in Sources */, + 00665ED424EC55B300030A13 /* LightningStateMonitor.swift in Sources */, + 3AFBD34528B66FF300F8CC54 /* Date.swift in Sources */, + 7A811EAC24FC7E1000F8D8C8 /* RequestViewModel.swift in Sources */, + 7A2CC37A24F3495500E2605A /* ExampleRepository.swift in Sources */, + 00665EAE24E9185B00030A13 /* router.pb.swift in Sources */, + 00665EBC24E9185B00030A13 /* verrpc.pb.swift in Sources */, + 3AFBD33A28B37B2800F8CC54 /* ChannelsVC.swift in Sources */, + 00B045C0250CDFDE0060D4D1 /* LightningError.swift in Sources */, + 3AFBD34328B66DAD00F8CC54 /* Int64.swift in Sources */, + 00665EB624E9185B00030A13 /* walletunlocker.pb.swift in Sources */, + 00665EB824E9185B00030A13 /* watchtower.pb.swift in Sources */, + 7A2CC36924F2D24900E2605A /* UIView.swift in Sources */, + 00665EDC24EF07E800030A13 /* Settings.swift in Sources */, + 7A2CC37724F348FE00E2605A /* HomeViewModel.swift in Sources */, + 3AFBD34128B4D0EC00F8CC54 /* ChannelsViewModel.swift in Sources */, + 7A2CC35124EF73AD00E2605A /* Navigation.swift in Sources */, + 3A50665328B3768500073CA0 /* PaymentsVC.swift in Sources */, + 7A2CC34924EF6F7A00E2605A /* Fonts.swift in Sources */, + 7A2CC36B24F2D37200E2605A /* ErrorView.swift in Sources */, + 00665EB224E9185B00030A13 /* autopilot.pb.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 7ABFCBDF24E4EC010012EF39 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 00665EB524E9185B00030A13 /* signer.pb.swift in Sources */, + 00665EB324E9185B00030A13 /* autopilot.pb.swift in Sources */, + 00665EAF24E9185B00030A13 /* router.pb.swift in Sources */, + 00665EBB24E9185B00030A13 /* wtclient.pb.swift in Sources */, + 00665EBD24E9185B00030A13 /* verrpc.pb.swift in Sources */, + 7ABFCBE824E4EC010012EF39 /* LightningTests.swift in Sources */, + 00665E8524E5C72C00030A13 /* Lightning.swift in Sources */, + 00665EAD24E9185B00030A13 /* walletkit.pb.swift in Sources */, + 00665EB924E9185B00030A13 /* watchtower.pb.swift in Sources */, + 00665EDA24EF067900030A13 /* LightningStateMonitor.swift in Sources */, + 00665EB124E9185B00030A13 /* rpc.pb.swift in Sources */, + 00665EBF24E9185B00030A13 /* invoices.pb.swift in Sources */, + 00665E8324E5C72C00030A13 /* LndCallbacks.swift in Sources */, + 00665ED924EF067900030A13 /* EventBus.swift in Sources */, + 00665ED824EF05B700030A13 /* NodePublicKey.swift in Sources */, + 00665EAB24E9185B00030A13 /* chainnotifier.pb.swift in Sources */, + 00665EB724E9185B00030A13 /* walletunlocker.pb.swift in Sources */, + 00665EA924E9185B00030A13 /* lncli.pb.swift in Sources */, + 00665EDD24EF07E800030A13 /* Settings.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 7ABFCBEA24E4EC010012EF39 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 7ABFCBF324E4EC010012EF39 /* walletUITests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 7ABFCBE524E4EC010012EF39 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 7ABFCBCC24E4EBFD0012EF39 /* wallet */; + targetProxy = 7ABFCBE424E4EC010012EF39 /* PBXContainerItemProxy */; + }; + 7ABFCBF024E4EC010012EF39 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 7ABFCBCC24E4EBFD0012EF39 /* wallet */; + targetProxy = 7ABFCBEF24E4EC010012EF39 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 7A2CC37024F2D7CD00E2605A /* Localizable.strings */ = { + isa = PBXVariantGroup; + children = ( + 7A2CC36F24F2D7CD00E2605A /* en */, + ); + name = Localizable.strings; + sourceTree = ""; + }; + 7ABFCBDB24E4EC010012EF39 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 7ABFCBDC24E4EC010012EF39 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 7ABFCBF524E4EC010012EF39 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 7ABFCBF624E4EC010012EF39 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 7ABFCBF824E4EC010012EF39 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = F77AAF824A3306842FDC9AC0 /* Pods-wallet.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = FPBE93KV38; + ENABLE_BITCODE = NO; + ENABLE_PREVIEWS = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)", + ); + INFOPLIST_FILE = wallet/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = app.lndtest.wallet; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "wallet/wallet-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = 1; + }; + name = Debug; + }; + 7ABFCBF924E4EC010012EF39 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 61751AE73E16766A4665327B /* Pods-wallet.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = FPBE93KV38; + ENABLE_BITCODE = NO; + ENABLE_PREVIEWS = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)", + ); + INFOPLIST_FILE = wallet/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = app.lndtest.wallet; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "wallet/wallet-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = 1; + }; + name = Release; + }; + 7ABFCBFB24E4EC010012EF39 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 49151D7AE89BC38CAB768074 /* Pods-walletTests.debug.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + BUNDLE_LOADER = "$(TEST_HOST)"; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = GW2KRSPAWB; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)", + ); + INFOPLIST_FILE = walletTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 13.2; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = app.cheddar.walletTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "wallet/walletTests-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/wallet.app/wallet"; + }; + name = Debug; + }; + 7ABFCBFC24E4EC010012EF39 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4C2A1A61CA82F3F36E6DB4B2 /* Pods-walletTests.release.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + BUNDLE_LOADER = "$(TEST_HOST)"; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = GW2KRSPAWB; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)", + ); + INFOPLIST_FILE = walletTests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 13.2; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = app.cheddar.walletTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "wallet/walletTests-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/wallet.app/wallet"; + }; + name = Release; + }; + 7ABFCBFE24E4EC010012EF39 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 59841CD97AB95EE18B1586B5 /* Pods-wallet-walletUITests.debug.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = GW2KRSPAWB; + INFOPLIST_FILE = walletUITests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = app.cheddar.walletUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = wallet; + }; + name = Debug; + }; + 7ABFCBFF24E4EC010012EF39 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 22C1F2815F66B3F1B4C860DC /* Pods-wallet-walletUITests.release.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = GW2KRSPAWB; + INFOPLIST_FILE = walletUITests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = app.cheddar.walletUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = wallet; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 7ABFCBC824E4EBFD0012EF39 /* Build configuration list for PBXProject "wallet" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 7ABFCBF524E4EC010012EF39 /* Debug */, + 7ABFCBF624E4EC010012EF39 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 7ABFCBF724E4EC010012EF39 /* Build configuration list for PBXNativeTarget "wallet" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 7ABFCBF824E4EC010012EF39 /* Debug */, + 7ABFCBF924E4EC010012EF39 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 7ABFCBFA24E4EC010012EF39 /* Build configuration list for PBXNativeTarget "walletTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 7ABFCBFB24E4EC010012EF39 /* Debug */, + 7ABFCBFC24E4EC010012EF39 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 7ABFCBFD24E4EC010012EF39 /* Build configuration list for PBXNativeTarget "walletUITests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 7ABFCBFE24E4EC010012EF39 /* Debug */, + 7ABFCBFF24E4EC010012EF39 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 7ABFCBC524E4EBFD0012EF39 /* Project object */; +} diff --git a/wallet.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/wallet.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..4a03d23 --- /dev/null +++ b/wallet.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/wallet.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/wallet.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/wallet.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/wallet.xcodeproj/project.xcworkspace/xcuserdata/adriana.xcuserdatad/UserInterfaceState.xcuserstate b/wallet.xcodeproj/project.xcworkspace/xcuserdata/adriana.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..7ea900e Binary files /dev/null and b/wallet.xcodeproj/project.xcworkspace/xcuserdata/adriana.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/wallet.xcodeproj/xcuserdata/adriana.xcuserdatad/xcschemes/xcschememanagement.plist b/wallet.xcodeproj/xcuserdata/adriana.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..bfb2db9 --- /dev/null +++ b/wallet.xcodeproj/xcuserdata/adriana.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + wallet.xcscheme_^#shared#^_ + + orderHint + 5 + + + + diff --git a/wallet.xcworkspace/contents.xcworkspacedata b/wallet.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..95672c5 --- /dev/null +++ b/wallet.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/wallet.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/wallet.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/wallet.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/wallet.xcworkspace/xcuserdata/adriana.xcuserdatad/IDEFindNavigatorScopes.plist b/wallet.xcworkspace/xcuserdata/adriana.xcuserdatad/IDEFindNavigatorScopes.plist new file mode 100644 index 0000000..5dd5da8 --- /dev/null +++ b/wallet.xcworkspace/xcuserdata/adriana.xcuserdatad/IDEFindNavigatorScopes.plist @@ -0,0 +1,5 @@ + + + + + diff --git a/wallet.xcworkspace/xcuserdata/adriana.xcuserdatad/UserInterfaceState.xcuserstate b/wallet.xcworkspace/xcuserdata/adriana.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..9a4bd0b Binary files /dev/null and b/wallet.xcworkspace/xcuserdata/adriana.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/wallet.xcworkspace/xcuserdata/adriana.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/wallet.xcworkspace/xcuserdata/adriana.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100644 index 0000000..f8fca9a --- /dev/null +++ b/wallet.xcworkspace/xcuserdata/adriana.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,6 @@ + + + diff --git a/wallet/AppDelegate.swift b/wallet/AppDelegate.swift new file mode 100644 index 0000000..b9f8762 --- /dev/null +++ b/wallet/AppDelegate.swift @@ -0,0 +1,37 @@ +// +// AppDelegate.swift +// wallet +// +// Created by Jason on 8/12/20. +// Copyright © 2020 Jason. All rights reserved. +// + +import UIKit + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + // Override point for customization after application launch. + return true + } + + // MARK: UISceneSession Lifecycle + + func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { + // Called when a new scene session is being created. + // Use this method to select a configuration to create the new scene with. + return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) + } + + func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { + // Called when the user discards a scene session. + // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. + // Use this method to release any resources that were specific to the discarded scenes, as they will not return. + } + + +} + diff --git a/wallet/Assets.xcassets/AppIcon.appiconset/Contents.json b/wallet/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..d8db8d6 --- /dev/null +++ b/wallet/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "83.5x83.5", + "scale" : "2x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/wallet/Assets.xcassets/Contents.json b/wallet/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/wallet/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/wallet/Assets.xcassets/ic_back.imageset/Contents.json b/wallet/Assets.xcassets/ic_back.imageset/Contents.json new file mode 100644 index 0000000..f04d459 --- /dev/null +++ b/wallet/Assets.xcassets/ic_back.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "ic_back.pdf", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/wallet/Assets.xcassets/ic_back.imageset/ic_back.pdf b/wallet/Assets.xcassets/ic_back.imageset/ic_back.pdf new file mode 100644 index 0000000..9bc7686 --- /dev/null +++ b/wallet/Assets.xcassets/ic_back.imageset/ic_back.pdf @@ -0,0 +1,107 @@ +%PDF-1.7 + +1 0 obj + << >> +endobj + +2 0 obj + << /Length 3 0 R >> +stream +/DeviceRGB CS +/DeviceRGB cs +q +0.000000 1.000000 -1.000000 0.000000 4.000000 11.166626 cm +0.000000 0.000000 0.000000 scn +1.833333 -18.000000 m +1.833333 2.000000 l +-0.166667 2.000000 l +-0.166667 -18.000000 l +1.833333 -18.000000 l +h +f +n +Q +q +0.000000 1.000000 -1.000000 0.000000 14.828369 7.000000 cm +0.000000 0.000000 0.000000 scn +-0.707107 8.535476 m +-1.414214 7.828369 l +0.000000 6.414155 l +0.707107 7.121263 l +-0.707107 8.535476 l +h +5.000000 12.828369 m +5.707107 13.535476 l +5.000000 14.242582 l +4.292893 13.535476 l +5.000000 12.828369 l +h +9.292893 7.121263 m +10.000000 6.414155 l +11.414213 7.828369 l +10.707107 8.535476 l +9.292893 7.121263 l +h +0.707107 7.121263 m +5.707107 12.121263 l +4.292893 13.535476 l +-0.707107 8.535476 l +0.707107 7.121263 l +h +4.292893 12.121263 m +9.292893 7.121263 l +10.707107 8.535476 l +5.707107 13.535476 l +4.292893 12.121263 l +h +f +n +Q + +endstream +endobj + +3 0 obj + 862 +endobj + +4 0 obj + << /Annots [] + /Type /Page + /MediaBox [ 0.000000 0.000000 24.000000 24.000000 ] + /Resources 1 0 R + /Contents 2 0 R + /Parent 5 0 R + >> +endobj + +5 0 obj + << /Kids [ 4 0 R ] + /Count 1 + /Type /Pages + >> +endobj + +6 0 obj + << /Type /Catalog + /Pages 5 0 R + >> +endobj + +xref +0 7 +0000000000 65535 f +0000000010 00000 n +0000000034 00000 n +0000000952 00000 n +0000000974 00000 n +0000001147 00000 n +0000001221 00000 n +trailer +<< /ID [ (some) (id) ] + /Root 6 0 R + /Size 7 +>> +startxref +1280 +%%EOF \ No newline at end of file diff --git a/wallet/Assets.xcassets/ic_backspace.imageset/Contents.json b/wallet/Assets.xcassets/ic_backspace.imageset/Contents.json new file mode 100644 index 0000000..c6eec0c --- /dev/null +++ b/wallet/Assets.xcassets/ic_backspace.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "ic_backspace.pdf", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/wallet/Assets.xcassets/ic_backspace.imageset/ic_backspace.pdf b/wallet/Assets.xcassets/ic_backspace.imageset/ic_backspace.pdf new file mode 100644 index 0000000..395f788 --- /dev/null +++ b/wallet/Assets.xcassets/ic_backspace.imageset/ic_backspace.pdf @@ -0,0 +1,91 @@ +%PDF-1.7 + +1 0 obj + << >> +endobj + +2 0 obj + << /Length 3 0 R >> +stream +/DeviceRGB CS +/DeviceRGB cs +q +1.000000 0.000000 -0.000000 1.000000 0.974976 4.000000 cm +0.000000 0.000000 0.000000 scn +22.025000 16.000000 m +7.025000 16.000000 l +6.725000 16.000000 6.425000 15.900000 6.225000 15.700000 c +0.225000 8.700000 l +-0.075000 8.299999 -0.075000 7.799999 0.225000 7.400000 c +6.225000 0.400000 l +6.425000 0.099999 6.725000 0.000000 7.025000 0.000000 c +22.025000 0.000000 l +22.625000 0.000000 23.025000 0.400000 23.025000 1.000000 c +23.025000 15.000000 l +23.025000 15.600000 22.625000 16.000000 22.025000 16.000000 c +h +16.424999 6.000000 m +15.025000 4.600000 l +13.025000 6.600000 l +11.025000 4.600000 l +9.625000 6.000000 l +11.625000 8.000000 l +9.625000 10.000000 l +11.025000 11.400000 l +13.025000 9.400000 l +15.025000 11.400000 l +16.424999 10.000000 l +14.424999 8.000000 l +16.424999 6.000000 l +h +f +n +Q + +endstream +endobj + +3 0 obj + 824 +endobj + +4 0 obj + << /Annots [] + /Type /Page + /MediaBox [ 0.000000 0.000000 24.000000 24.000000 ] + /Resources 1 0 R + /Contents 2 0 R + /Parent 5 0 R + >> +endobj + +5 0 obj + << /Kids [ 4 0 R ] + /Count 1 + /Type /Pages + >> +endobj + +6 0 obj + << /Type /Catalog + /Pages 5 0 R + >> +endobj + +xref +0 7 +0000000000 65535 f +0000000010 00000 n +0000000034 00000 n +0000000914 00000 n +0000000936 00000 n +0000001109 00000 n +0000001183 00000 n +trailer +<< /ID [ (some) (id) ] + /Root 6 0 R + /Size 7 +>> +startxref +1242 +%%EOF \ No newline at end of file diff --git a/wallet/Base.lproj/LaunchScreen.storyboard b/wallet/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..e27c353 --- /dev/null +++ b/wallet/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wallet/Fonts/sofia_pro_bold.ttf b/wallet/Fonts/sofia_pro_bold.ttf new file mode 100644 index 0000000..f6ba1b0 Binary files /dev/null and b/wallet/Fonts/sofia_pro_bold.ttf differ diff --git a/wallet/Fonts/sofia_pro_medium.ttf b/wallet/Fonts/sofia_pro_medium.ttf new file mode 100644 index 0000000..28ce022 Binary files /dev/null and b/wallet/Fonts/sofia_pro_medium.ttf differ diff --git a/wallet/Fonts/sofia_pro_regular.ttf b/wallet/Fonts/sofia_pro_regular.ttf new file mode 100644 index 0000000..636ee5d Binary files /dev/null and b/wallet/Fonts/sofia_pro_regular.ttf differ diff --git a/wallet/Info.plist b/wallet/Info.plist new file mode 100644 index 0000000..30718da --- /dev/null +++ b/wallet/Info.plist @@ -0,0 +1,67 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UIAppFonts + + + sofia_pro_bold.ttf + sofia_pro_medium.ttf + sofia_pro_regular.ttf + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneConfigurationName + Default Configuration + UISceneDelegateClassName + $(PRODUCT_MODULE_NAME).SceneDelegate + + + + + UILaunchStoryboardName + LaunchScreen + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + NSCameraUsageDescription + Scan QR + + diff --git a/wallet/Lightning/Lightning.swift b/wallet/Lightning/Lightning.swift new file mode 100644 index 0000000..472930f --- /dev/null +++ b/wallet/Lightning/Lightning.swift @@ -0,0 +1,451 @@ +// +// Lightning.swift +// +// +// Created by Jason van den Berg on 2020/08/02. +// + +import Foundation + +class Lightning { + static let shared = Lightning() + + private var storage: URL { + let documentsDirectory = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first! + let directory = documentsDirectory.appendingPathComponent("lnd") + + if !FileManager.default.fileExists(atPath: directory.path) { + try! FileManager.default.createDirectory(atPath: directory.path, withIntermediateDirectories: true) + } + + return directory + } + + private let confName = "lnd.conf" + + private var confFile: URL { + return storage.appendingPathComponent(confName) + } + + //Ensure it stays a singleton + private init() {} + + func start(_ completion: @escaping (Error?) -> Void, onRpcReady: @escaping (Error?) -> Void) { + print("LND Start Request") + + //Delete previous config if it exists + try? FileManager.default.removeItem(at: confFile) + //Copy new config into LND directory + do { + //TODO build this config file in code + let originalConf = "lnd.conf" + try FileManager.default.copyItem(at: Bundle.main.bundleURL.appendingPathComponent(originalConf), to: confFile) + } catch { + return completion(error) + } + + let args = "--lnddir=\(storage.path)" + + print(args) + + LndmobileStart( + args, + LndEmptyResponseCallback { (error) in + completion(error) + + if error == nil { + EventBus.postToMainThread(.lndStarted) + } + }, + LndEmptyResponseCallback { (error) in + onRpcReady(error) + + if error == nil { + EventBus.postToMainThread(.lndRpcReady) + } + } + ) + } + + func stop(_ completion: @escaping (Error?) -> Void) { + print("LND Stop Request") + + do { + LndmobileStopDaemon( + try Lnrpc_StopRequest().serializedData(), + LndCallback({ (response, error) in + completion(error) + + if error == nil { + EventBus.postToMainThread(.lndStopped) + } + }) + ) + completion(nil) //TODO figure out why callback is never hit by LndGenericCallback + } catch { + completion(error) + } + } + + func generateSeed(_ completion: @escaping ([String], Error?) -> Void) { + do { + LndmobileGenSeed( + try Lnrpc_GenSeedRequest().serializedData(), + LndCallback { (response, error) in + completion(response.cipherSeedMnemonic, error) + } + ) + } catch { + completion([], error) + } + } + + func createWallet(password: String, cipherSeedMnemonic: [String], completion: @escaping (Error?) -> Void) { + guard let passwordData = password.data(using: .utf8) else { + return completion(LightningError.invalidPassword) + } + + var request = Lnrpc_InitWalletRequest() + request.cipherSeedMnemonic = cipherSeedMnemonic + request.walletPassword = passwordData + + do { + LndmobileInitWallet( + try request.serializedData(), + LndEmptyResponseCallback { (error) in + completion(error) + + if error == nil { + EventBus.postToMainThread(.lndWalletUnlocked) + } + } + ) + } catch { + return completion(error) + } + } + + func unlockWalet(password: String, completion: @escaping (Error?) -> Void) { + guard let passwordData = password.data(using: .utf8) else { + return completion(LightningError.invalidPassword) + } + + var request = Lnrpc_UnlockWalletRequest() + request.walletPassword = passwordData + + do { + LndmobileUnlockWallet( + try request.serializedData(), + LndEmptyResponseCallback { (error) in + completion(error) + + if error == nil { + EventBus.postToMainThread(.lndWalletUnlocked) + } + } + ) + } catch { + return completion(error) + } + } + + func walletBalance(_ completion: @escaping (Lnrpc_WalletBalanceResponse, Error?) -> Void) { + do { + LndmobileWalletBalance(try Lnrpc_WalletBalanceRequest().serializedData(), LndCallback(completion)) + } catch { + completion(Lnrpc_WalletBalanceResponse(), error) + } + } + func lightningChannelBalance(_ completion: @escaping (Lnrpc_ChannelBalanceResponse, Error?) -> Void) { + + + do { + LndmobileChannelBalance(try Lnrpc_ChannelBalanceRequest().serializedData(), + LndCallback(completion)) + } catch { + completion(Lnrpc_ChannelBalanceResponse(), error) + } + } + func info(_ completion: @escaping (Lnrpc_GetInfoResponse, Error?) -> Void) { + do { + LndmobileGetInfo(try Lnrpc_GetInfoRequest().serializedData(), LndCallback(completion)) + } catch { + completion(Lnrpc_GetInfoResponse(), error) + } + } + + func newAddress(_ completion: @escaping (String, Error?) -> Void) { + do { + LndmobileNewAddress( + try Lnrpc_NewAddressRequest().serializedData(), + LndCallback { (response, error) in + completion(response.address, error) + } + ) + } catch { + completion("", error) + } + } + func listPeers(completion: @escaping (Lnrpc_ListPeersResponse, Error?) -> Void) { + LndmobileListPeers(try Data(), LndCallback(completion)) + } + func connectToNode(nodePubkey: NodePublicKey, hostAddress: String, hostPort: UInt, _ completion: @escaping (Lnrpc_ConnectPeerResponse, Error?) -> Void) { + var request = Lnrpc_ConnectPeerRequest() + var addr = Lnrpc_LightningAddress() + addr.pubkey = nodePubkey.hexString + addr.host = "\(hostAddress):\(hostPort)" + request.addr = addr + request.perm = true + + do { + LndmobileConnectPeer(try request.serializedData(), LndCallback(completion)) + } catch { + completion(Lnrpc_ConnectPeerResponse(), error) + } + } + + func openChannel(localFundingAmount: Int64, pushSat: Int64, closeAddress: String?, nodePubkey: NodePublicKey, _ completion: @escaping (Lnrpc_OpenStatusUpdate, Error?) -> Void) { + var request = Lnrpc_OpenChannelRequest() + request.localFundingAmount = localFundingAmount + if let closeAddress = closeAddress{ + request.closeAddress = closeAddress + } + request.nodePubkey = nodePubkey.data + request.pushSat = pushSat + + //TODO have the below config driven + request.minConfs = 2 + request.targetConf = 2 + request.spendUnconfirmed = false + + do { + LndmobileOpenChannel(try request.serializedData(), LndCallback(completion)) + } catch { + completion(Lnrpc_OpenStatusUpdate(), nil) + } + } + func closeChannel(channel: Lnrpc_Channel, _ completion: @escaping (Lnrpc_ClosedChannelsResponse, Error?) -> Void) { + var request = Lnrpc_CloseChannelRequest() + request.channelPoint = Lnrpc_ChannelPoint() + let ch = channel.channelPoint.split(separator: ":") + if ch.count == 2{ + request.channelPoint.fundingTxidStr = String(ch[0]) + request.channelPoint.outputIndex = UInt32(ch[1]) ?? 1 + } + + debugPrint("channel \(channel), point \(channel.channelPoint), property list \(channel.channelPoint.propertyList())") + do { + LndmobileCloseChannel(try request.serializedData(), LndCallback(completion)) + } catch { + completion(Lnrpc_ClosedChannelsResponse(), nil) + } + } + func listChannels(_ completion: @escaping (Lnrpc_ListChannelsResponse, Error?) -> Void) { + do { + LndmobileListChannels( + try Lnrpc_ListChannelsRequest().serializedData(), + LndCallback { (response, error) in + completion(response, error) + } + ) + } catch { + completion(Lnrpc_ListChannelsResponse(), error) + } + } + func listClosedChannels(_ completion: @escaping (Lnrpc_ClosedChannelsResponse, Error?) -> Void) { + do { + LndmobileClosedChannels( + try Lnrpc_ClosedChannelsRequest().serializedData(), + LndCallback { (response, error) in + completion(response, error) + } + ) + } catch { + completion(Lnrpc_ClosedChannelsResponse(), error) + } + } + func abandonChannel(pendingOpenChannel:Lnrpc_PendingChannelsResponse.PendingOpenChannel, _ completion: @escaping (Lnrpc_AbandonChannelResponse, Error?) -> Void) { + var request = Lnrpc_AbandonChannelRequest() + do { + request.channelPoint = try Lnrpc_ChannelPoint(jsonString: pendingOpenChannel.channel.channelPoint) + LndmobileListChannels( + try request.serializedData(), + LndCallback { (response, error) in + debugPrint("Response Abandon channel", response, error) + completion(response, error) + } + ) + + + } catch { + completion(Lnrpc_AbandonChannelResponse(), error) + } + } + func listPendingChannels(_ completion: @escaping (Lnrpc_PendingChannelsResponse, Error?) -> Void) { + do { + LndmobilePendingChannels( + try Lnrpc_PendingChannelsRequest().serializedData(), + LndCallback { (response, error) in + completion(response, error) + } + ) + } catch { + completion(Lnrpc_PendingChannelsResponse(), error) + } + } + func getChanInfo(id: UInt64, _ completion: @escaping (Lnrpc_ChannelEdge, Error?) -> Void) { + var request = Lnrpc_ChanInfoRequest() + request.chanID = id + do { + LndmobileGetChanInfo(try request.serializedData(), LndCallback(completion)) + + } catch { + completion(Lnrpc_ChannelEdge(), nil) + } + } + func decodePaymentRequest(_ paymentRequest: String, _ completion: @escaping (Lnrpc_PayReq, Error?) -> Void) { + var request = Lnrpc_PayReqString() + request.payReq = paymentRequest + + do { + LndmobileDecodePayReq(try request.serializedData(), LndCallback(completion)) + } catch { + completion(Lnrpc_PayReq(), nil) + } + } + + func listInvoices(completion: @escaping(Lnrpc_ListInvoiceResponse, Error?) -> Void){ + do { + LndmobileListInvoices( + try Lnrpc_ListInvoiceRequest().serializedData(), + LndCallback{ (response, error) in + completion(response, error) + } + ) + } catch { + completion(Lnrpc_ListInvoiceResponse(), error) + } + } + func listPayments(completion: @escaping(Lnrpc_ListPaymentsResponse, Error?) -> Void){ + do { + LndmobileListPayments( + try Lnrpc_ListPaymentsRequest().serializedData(), + LndCallback{ (response, error) in + completion(response, error) + } + ) + } catch { + completion(Lnrpc_ListPaymentsResponse(), error) + } + } + func payRequest(_ paymentRequest: String, _ completion: @escaping (Lnrpc_SendResponse, Error?) -> Void) { + var request = Lnrpc_SendRequest() + request.paymentRequest = paymentRequest + + do { + //LND returns payment errors in the response and not with a real error. This just intercepts the callback and will return the custom error if applicable. + LndmobileSendPaymentSync( + try request.serializedData(), + LndCallback { (response, error) in + completion(response, error) + }) + + } catch { + completion(Lnrpc_SendResponse(), nil) + } + } + func createPayRequest(amount: Int, memo: String, _ completion: @escaping (Lnrpc_AddInvoiceResponse, Error?) -> Void) { + let request = Lnrpc_Invoice(amount: amount, memo: memo, expiry: .oneDay) + do { + LndmobileAddInvoice( + try request.serializedData(), + LndCallback{ (response, error) in + guard response.paymentRequest.isEmpty else { + completion(response, error) + return + } + + completion(response, error) + + }) + + } catch { + completion(Lnrpc_AddInvoiceResponse(), nil) + } + } + func queryRequestFee(key: String, _ completion: @escaping (Lnrpc_QueryRoutesResponse, Error?) -> Void) { + var request = Lnrpc_QueryRoutesRequest() + request.pubKey = key + do { + LndmobileQueryRoutes( + try request.serializedData(), + LndCallback{ (response, error) in + completion(response, error) + }) + } catch { + completion(Lnrpc_QueryRoutesResponse(), nil) + } + } + func estimateFee(_ paymentRequest: String, amount:Int64, _ completion: @escaping (Lnrpc_EstimateFeeResponse, Error?) -> Void) { + var request = Lnrpc_EstimateFeeRequest() + request.addrToAmount = [paymentRequest:amount] + do { + LndmobileEstimateFee( + try request.serializedData(), + LndCallback{ (response, error) in + completion(response, error) + }) + } catch { + completion(Lnrpc_EstimateFeeResponse(), nil) + } + } + func feeReport(_ completion: @escaping (Lnrpc_FeeReportResponse, Error?) -> Void) { + let request = Lnrpc_FeeReportRequest() + do { + LndmobileFeeReport( + try request.serializedData(), + LndCallback{ (response, error) in + completion(response, error) + }) + } catch { + completion(Lnrpc_FeeReportResponse(), nil) + } + } +} + +//Utils +extension Lightning { + func purge() { + //TODO ensure testnet only + print("WARNING: removing existing LND directory") + try! FileManager.default.removeItem(at: storage) + } +} + +extension Lnrpc_Invoice { + init(amount: Int?, memo: String?, expiry: ExpiryTime?) { + self.init() + if let amount = amount { + value = Int64(amount) + } + if let memo = memo { + self.memo = memo + } + if let expiry = expiry { + self.expiry = Int64(expiry.rawValue) + } + `private` = true + } +} + +public enum ExpiryTime: Int, Codable, CaseIterable { + case oneMinute = 60 + case tenMinutes = 600 // 60 * 10 + case thirtyMinutes = 1800 // 60 * 30 + case oneHour = 3600 // 60 * 60 + case sixHours = 21600 // 60 * 60 * 6 + case oneDay = 86400 // 60 * 60 * 24 + case oneWeek = 604800 // 60 * 60 * 24 * 7 + case thirtyDays = 2592000 // 60 * 60 * 24 * 30 + case oneYear = 31536000 // 60 * 60 * 24 * 365 +} diff --git a/wallet/Lightning/LndCallbacks.swift b/wallet/Lightning/LndCallbacks.swift new file mode 100644 index 0000000..7fbf50f --- /dev/null +++ b/wallet/Lightning/LndCallbacks.swift @@ -0,0 +1,71 @@ +// +// LndCallbacks.swift +// PayUp +// +// Created by Jason van den Berg on 2020/08/03. +// Copyright © 2020 Jason van den Berg. All rights reserved. +// + +import Foundation +import SwiftProtobuf + +extension Lightning { + + /// Generic callback for LND function which will map responses back into the protobuf message type. + class LndCallback: NSObject, LndmobileCallbackProtocol, LndmobileRecvStreamProtocol { + let completion: (T, Error?) -> Void + + init(_ completion: @escaping (T, Error?) -> Void) { + let startedOnMainThread = Thread.current.isMainThread + self.completion = { (response, error) in + if startedOnMainThread { + DispatchQueue.main.async { completion(response, error) } + } else { + completion(response, error) + } + } + } + + func onResponse(_ p0: Data?) { + guard let data = p0 else { + completion(T(), nil) //For calls like balance checks, an empty response should just be `T` defaults + return + } + + do { + completion(try T(serializedData: data), nil) + } catch { + completion(T(), LightningError.mapping) + } + } + + func onError(_ p0: Error?) { + completion(T(), p0 ?? LightningError.unknown) + } + } + + /// For LND callbacks that don't pass back any messages but can return errors + class LndEmptyResponseCallback: NSObject, LndmobileCallbackProtocol { + let completion: (Error?) -> Void + + init(_ completion: @escaping (Error?) -> Void) { + let startedOnMainThread = Thread.current.isMainThread + self.completion = { error in + + if startedOnMainThread { + DispatchQueue.main.async { completion(error) } + } else { + completion(error) + } + } + } + + func onResponse(_ p0: Data?) { + completion(nil) + } + + func onError(_ p0: Error?) { + completion(p0 ?? LightningError.unknown) + } + } +} diff --git a/wallet/Lightning/Utils/EventBus.swift b/wallet/Lightning/Utils/EventBus.swift new file mode 100644 index 0000000..4026779 --- /dev/null +++ b/wallet/Lightning/Utils/EventBus.swift @@ -0,0 +1,104 @@ +// +// EventBus.swift +// wallet +// +// Created by Jason van den Berg on 2020/08/18. +// Copyright © 2020 Jason. All rights reserved. +// + +import Foundation + +public enum EventTypes: String { + case lndStateChange = "lnd-state-change" + case lndStarted = "lnd-started" + case lndStopped = "lnd-stopped" + case lndRpcReady = "lnd-rpc-ready" + case lndWalletUnlocked = "lnd-wallet-unlocked" + case lndWalletLocked = "lnd-wallet-locked" + case lndChannelUpdate = "lnd-channel-update" +} + +private let identifier = "app.lndtest.wallet.eventbus" + +open class EventBus { + static let shared = EventBus() + static let queue = DispatchQueue(label: identifier, attributes: []) + + struct NamedObserver { + let observer: NSObjectProtocol + let eventType: EventTypes + } + + var cache = [UInt: [NamedObserver]]() + + // MARK: Publish + + open class func postToMainThread(_ eventType: EventTypes, sender: Any? = nil) { + DispatchQueue.main.async { + NotificationCenter.default.post(name: Notification.Name(rawValue: eventType.rawValue), object: sender) + } + } + + // MARK: Subscribe + + @discardableResult + open class func on(_ target: AnyObject, eventType: EventTypes, sender: Any? = nil, queue: OperationQueue?, handler: @escaping ((Notification?) -> Void)) -> NSObjectProtocol { + let id = UInt(bitPattern: ObjectIdentifier(target)) + let observer = NotificationCenter.default.addObserver(forName: NSNotification.Name(rawValue: eventType.rawValue), object: sender, queue: queue, using: handler) + let namedObserver = NamedObserver(observer: observer, eventType: eventType) + + EventBus.queue.sync { + if let namedObservers = EventBus.shared.cache[id] { + EventBus.shared.cache[id] = namedObservers + [namedObserver] + } else { + EventBus.shared.cache[id] = [namedObserver] + } + } + + return observer + } + + @discardableResult + open class func onMainThread(_ target: AnyObject, eventType: EventTypes, sender: Any? = nil, handler: @escaping ((Notification?) -> Void)) -> NSObjectProtocol { + return EventBus.on(target, eventType: eventType, sender: sender, queue: OperationQueue.main, handler: handler) + } + + @discardableResult + open class func onBackgroundThread(_ target: AnyObject, eventType: EventTypes, sender: Any? = nil, handler: @escaping ((Notification?) -> Void)) -> NSObjectProtocol { + return EventBus.on(target, eventType: eventType, sender: sender, queue: OperationQueue(), handler: handler) + } + + // MARK: Unregister + + open class func unregister(_ target: AnyObject) { + let id = UInt(bitPattern: ObjectIdentifier(target)) + let center = NotificationCenter.default + + EventBus.queue.sync { + if let namedObservers = EventBus.shared.cache.removeValue(forKey: id) { + for namedObserver in namedObservers { + center.removeObserver(namedObserver.observer) + } + } + } + } + + open class func unregister(_ target: AnyObject, eventType: EventTypes) { + let id = UInt(bitPattern: ObjectIdentifier(target)) + let center = NotificationCenter.default + + EventBus.queue.sync { + if let namedObservers = EventBus.shared.cache[id] { + EventBus.shared.cache[id] = namedObservers.filter({ (namedObserver: NamedObserver) -> Bool in + if namedObserver.eventType == eventType { + center.removeObserver(namedObserver.observer) + return false + } else { + return true + } + }) + } + } + } + +} diff --git a/wallet/Lightning/Utils/LightningError.swift b/wallet/Lightning/Utils/LightningError.swift new file mode 100644 index 0000000..aae39ca --- /dev/null +++ b/wallet/Lightning/Utils/LightningError.swift @@ -0,0 +1,32 @@ +// +// LightningError.swift +// wallet +// +// Created by Jason van den Berg on 2020/09/12. +// Copyright © 2020 Jason. All rights reserved. +// + +import Foundation + +enum LightningError: Error { + case unknown + case mapping + case invalidPassword + case paymentError(String) +} + +extension LightningError: LocalizedError { + public var errorDescription: String? { + switch self { + case .unknown: + return NSLocalizedString("LND_ERROR_UNKNOWN", comment: "LND error") + case .mapping: + return NSLocalizedString("LND_ERROR_MAPPING", comment: "LND error") + case .invalidPassword: + return NSLocalizedString("LND_ERROR_INVALID_PASSWORD", comment: "LND error") + case .paymentError(let lndKey): + //TODO get all possible error keys and create custom messages for them + return String(format: NSLocalizedString("LND_ERROR_PAYMENT", comment: "LND error"), lndKey) + } + } +} diff --git a/wallet/Lightning/Utils/LightningStateMonitor.swift b/wallet/Lightning/Utils/LightningStateMonitor.swift new file mode 100644 index 0000000..399f2f7 --- /dev/null +++ b/wallet/Lightning/Utils/LightningStateMonitor.swift @@ -0,0 +1,76 @@ +// +// LightningStateMonitor.swift +// wallet +// +// Created by Jason van den Berg on 2020/08/18. +// Copyright © 2020 Jason. All rights reserved. +// + +import Foundation + +class LightningMonitorState { + var lndRunning = false { didSet { onUpdate() } } + var rpcReady = false { didSet { onUpdate() } } + var walletUnlocked = false { didSet { onUpdate() } } + var walletInfo = Lnrpc_GetInfoResponse() { didSet { onUpdate() } } + + var debuggingStatus: [String] { + var entries: [String] = [] + entries.append("LND running: \(lndRunning ? "✅" : "❌")") + entries.append("RPC ready: \(rpcReady ? "✅" : "❌")") + entries.append("Wallet unlocked: \(walletUnlocked ? "✅" : "❌")") + + if walletUnlocked { + entries.append("Synced to chain: \(walletInfo.syncedToChain ? "✅" : "❌")") + entries.append("Block height: \(walletInfo.blockHeight)") + entries.append("Peers: \(walletInfo.numPeers)") + } + + return entries + } + + //ALlow other components to subscribe to state changes from one place + private func onUpdate() { + EventBus.postToMainThread(.lndStateChange, sender: self) + } +} + +class LightningStateMonitor { + public static let shared = LightningStateMonitor() + + var state = LightningMonitorState() + + private init() { + EventBus.onMainThread(self, eventType: .lndStarted) { [weak self] (_) in + self?.state.lndRunning = true + } + + EventBus.onMainThread(self, eventType: .lndStopped) { [weak self] (_) in + self?.state.lndRunning = false + self?.state.walletUnlocked = false + self?.state.rpcReady = false + } + + EventBus.onMainThread(self, eventType: .lndRpcReady) { [weak self] (_) in + self?.state.rpcReady = true + } + + EventBus.onMainThread(self, eventType: .lndWalletUnlocked) { [weak self] (_) in + self?.state.walletUnlocked = true + } + + //TODO find better way to subscribe to LND events than this + _ = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(updateInfo), userInfo: nil, repeats: true) + } + + @objc private func updateInfo() { + Lightning.shared.info { [weak self] (response, error) in + guard let self = self else { return } + guard error == nil else { + return self.state.walletInfo = .init() + } + + self.state.walletInfo = response + } + } +} diff --git a/wallet/Lightning/Utils/NodePublicKey.swift b/wallet/Lightning/Utils/NodePublicKey.swift new file mode 100644 index 0000000..6fcfba7 --- /dev/null +++ b/wallet/Lightning/Utils/NodePublicKey.swift @@ -0,0 +1,59 @@ +// +// NodePublicKey.swift +// wallet +// +// Created by Jason van den Berg on 2020/08/20. +// Copyright © 2020 Jason. All rights reserved. +// + +import Foundation + +class NodePublicKey { + enum NodePublicKeyErrors: Error { + case invalidHexString + case invalidByte + case invalidByteLength + } + + private let bytes: [UInt8] + let hexString: String + + var data: Data { + return Data(bytes) + } + + init(_ hexString: String) throws { + let length = hexString.count + + // Must start with 02 or 03 as according to SECP256K1 + guard hexString.hasPrefix("02") || hexString.hasPrefix("03") else { + throw NodePublicKeyErrors.invalidHexString + } + + // Must be even characters + guard length & 1 == 0 else { + throw NodePublicKeyErrors.invalidHexString + } + + var bytes = [UInt8]() + bytes.reserveCapacity(length / 2) + + var index = hexString.startIndex + for _ in 0.. = [:] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + } + + init() {} +} + +struct Autopilotrpc_SetScoresRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The name of the heuristic to provide scores to. + var heuristic: String = String() + + /// + ///A map from hex-encoded public keys to scores. Scores must be in the range + ///[0.0, 1.0]. + var scores: Dictionary = [:] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Autopilotrpc_SetScoresResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "autopilotrpc" + +extension Autopilotrpc_StatusRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".StatusRequest" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Autopilotrpc_StatusRequest, rhs: Autopilotrpc_StatusRequest) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Autopilotrpc_StatusResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".StatusResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "active"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBoolField(value: &self.active) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.active != false { + try visitor.visitSingularBoolField(value: self.active, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Autopilotrpc_StatusResponse, rhs: Autopilotrpc_StatusResponse) -> Bool { + if lhs.active != rhs.active {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Autopilotrpc_ModifyStatusRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ModifyStatusRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "enable"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBoolField(value: &self.enable) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.enable != false { + try visitor.visitSingularBoolField(value: self.enable, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Autopilotrpc_ModifyStatusRequest, rhs: Autopilotrpc_ModifyStatusRequest) -> Bool { + if lhs.enable != rhs.enable {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Autopilotrpc_ModifyStatusResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ModifyStatusResponse" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Autopilotrpc_ModifyStatusResponse, rhs: Autopilotrpc_ModifyStatusResponse) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Autopilotrpc_QueryScoresRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".QueryScoresRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "pubkeys"), + 2: .standard(proto: "ignore_local_state"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedStringField(value: &self.pubkeys) + case 2: try decoder.decodeSingularBoolField(value: &self.ignoreLocalState) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.pubkeys.isEmpty { + try visitor.visitRepeatedStringField(value: self.pubkeys, fieldNumber: 1) + } + if self.ignoreLocalState != false { + try visitor.visitSingularBoolField(value: self.ignoreLocalState, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Autopilotrpc_QueryScoresRequest, rhs: Autopilotrpc_QueryScoresRequest) -> Bool { + if lhs.pubkeys != rhs.pubkeys {return false} + if lhs.ignoreLocalState != rhs.ignoreLocalState {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Autopilotrpc_QueryScoresResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".QueryScoresResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "results"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedMessageField(value: &self.results) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.results.isEmpty { + try visitor.visitRepeatedMessageField(value: self.results, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Autopilotrpc_QueryScoresResponse, rhs: Autopilotrpc_QueryScoresResponse) -> Bool { + if lhs.results != rhs.results {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Autopilotrpc_QueryScoresResponse.HeuristicResult: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = Autopilotrpc_QueryScoresResponse.protoMessageName + ".HeuristicResult" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "heuristic"), + 2: .same(proto: "scores"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.heuristic) + case 2: try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: &self.scores) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.heuristic.isEmpty { + try visitor.visitSingularStringField(value: self.heuristic, fieldNumber: 1) + } + if !self.scores.isEmpty { + try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: self.scores, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Autopilotrpc_QueryScoresResponse.HeuristicResult, rhs: Autopilotrpc_QueryScoresResponse.HeuristicResult) -> Bool { + if lhs.heuristic != rhs.heuristic {return false} + if lhs.scores != rhs.scores {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Autopilotrpc_SetScoresRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SetScoresRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "heuristic"), + 2: .same(proto: "scores"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.heuristic) + case 2: try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: &self.scores) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.heuristic.isEmpty { + try visitor.visitSingularStringField(value: self.heuristic, fieldNumber: 1) + } + if !self.scores.isEmpty { + try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: self.scores, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Autopilotrpc_SetScoresRequest, rhs: Autopilotrpc_SetScoresRequest) -> Bool { + if lhs.heuristic != rhs.heuristic {return false} + if lhs.scores != rhs.scores {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Autopilotrpc_SetScoresResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SetScoresResponse" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Autopilotrpc_SetScoresResponse, rhs: Autopilotrpc_SetScoresResponse) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/wallet/Lightning/rpc/chainrpc/chainnotifier.pb.swift b/wallet/Lightning/rpc/chainrpc/chainnotifier.pb.swift new file mode 100644 index 0000000..b9a8d42 --- /dev/null +++ b/wallet/Lightning/rpc/chainrpc/chainnotifier.pb.swift @@ -0,0 +1,681 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: chainrpc/chainnotifier.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +import Foundation +import SwiftProtobuf + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +struct Chainrpc_ConfRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The transaction hash for which we should request a confirmation notification + ///for. If set to a hash of all zeros, then the confirmation notification will + ///be requested for the script instead. + var txid: Data = SwiftProtobuf.Internal.emptyData + + /// + ///An output script within a transaction with the hash above which will be used + ///by light clients to match block filters. If the transaction hash is set to a + ///hash of all zeros, then a confirmation notification will be requested for + ///this script instead. + var script: Data = SwiftProtobuf.Internal.emptyData + + /// + ///The number of desired confirmations the transaction/output script should + ///reach before dispatching a confirmation notification. + var numConfs: UInt32 = 0 + + /// + ///The earliest height in the chain for which the transaction/output script + ///could have been included in a block. This should in most cases be set to the + ///broadcast height of the transaction/output script. + var heightHint: UInt32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Chainrpc_ConfDetails { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The raw bytes of the confirmed transaction. + var rawTx: Data = SwiftProtobuf.Internal.emptyData + + /// The hash of the block in which the confirmed transaction was included in. + var blockHash: Data = SwiftProtobuf.Internal.emptyData + + /// The height of the block in which the confirmed transaction was included + /// in. + var blockHeight: UInt32 = 0 + + /// The index of the confirmed transaction within the transaction. + var txIndex: UInt32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +/// TODO(wilmer): need to know how the client will use this first. +struct Chainrpc_Reorg { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Chainrpc_ConfEvent { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var event: Chainrpc_ConfEvent.OneOf_Event? = nil + + /// + ///An event that includes the confirmation details of the request + ///(txid/ouput script). + var conf: Chainrpc_ConfDetails { + get { + if case .conf(let v)? = event {return v} + return Chainrpc_ConfDetails() + } + set {event = .conf(newValue)} + } + + /// + ///An event send when the transaction of the request is reorged out of the + ///chain. + var reorg: Chainrpc_Reorg { + get { + if case .reorg(let v)? = event {return v} + return Chainrpc_Reorg() + } + set {event = .reorg(newValue)} + } + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum OneOf_Event: Equatable { + /// + ///An event that includes the confirmation details of the request + ///(txid/ouput script). + case conf(Chainrpc_ConfDetails) + /// + ///An event send when the transaction of the request is reorged out of the + ///chain. + case reorg(Chainrpc_Reorg) + + #if !swift(>=4.1) + static func ==(lhs: Chainrpc_ConfEvent.OneOf_Event, rhs: Chainrpc_ConfEvent.OneOf_Event) -> Bool { + switch (lhs, rhs) { + case (.conf(let l), .conf(let r)): return l == r + case (.reorg(let l), .reorg(let r)): return l == r + default: return false + } + } + #endif + } + + init() {} +} + +struct Chainrpc_Outpoint { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The hash of the transaction. + var hash: Data = SwiftProtobuf.Internal.emptyData + + /// The index of the output within the transaction. + var index: UInt32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Chainrpc_SpendRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The outpoint for which we should request a spend notification for. If set to + ///a zero outpoint, then the spend notification will be requested for the + ///script instead. + var outpoint: Chainrpc_Outpoint { + get {return _outpoint ?? Chainrpc_Outpoint()} + set {_outpoint = newValue} + } + /// Returns true if `outpoint` has been explicitly set. + var hasOutpoint: Bool {return self._outpoint != nil} + /// Clears the value of `outpoint`. Subsequent reads from it will return its default value. + mutating func clearOutpoint() {self._outpoint = nil} + + /// + ///The output script for the outpoint above. This will be used by light clients + ///to match block filters. If the outpoint is set to a zero outpoint, then a + ///spend notification will be requested for this script instead. + var script: Data = SwiftProtobuf.Internal.emptyData + + /// + ///The earliest height in the chain for which the outpoint/output script could + ///have been spent. This should in most cases be set to the broadcast height of + ///the outpoint/output script. + var heightHint: UInt32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _outpoint: Chainrpc_Outpoint? = nil +} + +struct Chainrpc_SpendDetails { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The outpoint was that spent. + var spendingOutpoint: Chainrpc_Outpoint { + get {return _spendingOutpoint ?? Chainrpc_Outpoint()} + set {_spendingOutpoint = newValue} + } + /// Returns true if `spendingOutpoint` has been explicitly set. + var hasSpendingOutpoint: Bool {return self._spendingOutpoint != nil} + /// Clears the value of `spendingOutpoint`. Subsequent reads from it will return its default value. + mutating func clearSpendingOutpoint() {self._spendingOutpoint = nil} + + /// The raw bytes of the spending transaction. + var rawSpendingTx: Data = SwiftProtobuf.Internal.emptyData + + /// The hash of the spending transaction. + var spendingTxHash: Data = SwiftProtobuf.Internal.emptyData + + /// The input of the spending transaction that fulfilled the spend request. + var spendingInputIndex: UInt32 = 0 + + /// The height at which the spending transaction was included in a block. + var spendingHeight: UInt32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _spendingOutpoint: Chainrpc_Outpoint? = nil +} + +struct Chainrpc_SpendEvent { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var event: Chainrpc_SpendEvent.OneOf_Event? = nil + + /// + ///An event that includes the details of the spending transaction of the + ///request (outpoint/output script). + var spend: Chainrpc_SpendDetails { + get { + if case .spend(let v)? = event {return v} + return Chainrpc_SpendDetails() + } + set {event = .spend(newValue)} + } + + /// + ///An event sent when the spending transaction of the request was + ///reorged out of the chain. + var reorg: Chainrpc_Reorg { + get { + if case .reorg(let v)? = event {return v} + return Chainrpc_Reorg() + } + set {event = .reorg(newValue)} + } + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum OneOf_Event: Equatable { + /// + ///An event that includes the details of the spending transaction of the + ///request (outpoint/output script). + case spend(Chainrpc_SpendDetails) + /// + ///An event sent when the spending transaction of the request was + ///reorged out of the chain. + case reorg(Chainrpc_Reorg) + + #if !swift(>=4.1) + static func ==(lhs: Chainrpc_SpendEvent.OneOf_Event, rhs: Chainrpc_SpendEvent.OneOf_Event) -> Bool { + switch (lhs, rhs) { + case (.spend(let l), .spend(let r)): return l == r + case (.reorg(let l), .reorg(let r)): return l == r + default: return false + } + } + #endif + } + + init() {} +} + +struct Chainrpc_BlockEpoch { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The hash of the block. + var hash: Data = SwiftProtobuf.Internal.emptyData + + /// The height of the block. + var height: UInt32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "chainrpc" + +extension Chainrpc_ConfRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ConfRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "txid"), + 2: .same(proto: "script"), + 3: .standard(proto: "num_confs"), + 4: .standard(proto: "height_hint"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.txid) + case 2: try decoder.decodeSingularBytesField(value: &self.script) + case 3: try decoder.decodeSingularUInt32Field(value: &self.numConfs) + case 4: try decoder.decodeSingularUInt32Field(value: &self.heightHint) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.txid.isEmpty { + try visitor.visitSingularBytesField(value: self.txid, fieldNumber: 1) + } + if !self.script.isEmpty { + try visitor.visitSingularBytesField(value: self.script, fieldNumber: 2) + } + if self.numConfs != 0 { + try visitor.visitSingularUInt32Field(value: self.numConfs, fieldNumber: 3) + } + if self.heightHint != 0 { + try visitor.visitSingularUInt32Field(value: self.heightHint, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Chainrpc_ConfRequest, rhs: Chainrpc_ConfRequest) -> Bool { + if lhs.txid != rhs.txid {return false} + if lhs.script != rhs.script {return false} + if lhs.numConfs != rhs.numConfs {return false} + if lhs.heightHint != rhs.heightHint {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Chainrpc_ConfDetails: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ConfDetails" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "raw_tx"), + 2: .standard(proto: "block_hash"), + 3: .standard(proto: "block_height"), + 4: .standard(proto: "tx_index"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.rawTx) + case 2: try decoder.decodeSingularBytesField(value: &self.blockHash) + case 3: try decoder.decodeSingularUInt32Field(value: &self.blockHeight) + case 4: try decoder.decodeSingularUInt32Field(value: &self.txIndex) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.rawTx.isEmpty { + try visitor.visitSingularBytesField(value: self.rawTx, fieldNumber: 1) + } + if !self.blockHash.isEmpty { + try visitor.visitSingularBytesField(value: self.blockHash, fieldNumber: 2) + } + if self.blockHeight != 0 { + try visitor.visitSingularUInt32Field(value: self.blockHeight, fieldNumber: 3) + } + if self.txIndex != 0 { + try visitor.visitSingularUInt32Field(value: self.txIndex, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Chainrpc_ConfDetails, rhs: Chainrpc_ConfDetails) -> Bool { + if lhs.rawTx != rhs.rawTx {return false} + if lhs.blockHash != rhs.blockHash {return false} + if lhs.blockHeight != rhs.blockHeight {return false} + if lhs.txIndex != rhs.txIndex {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Chainrpc_Reorg: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Reorg" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Chainrpc_Reorg, rhs: Chainrpc_Reorg) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Chainrpc_ConfEvent: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ConfEvent" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "conf"), + 2: .same(proto: "reorg"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: + var v: Chainrpc_ConfDetails? + if let current = self.event { + try decoder.handleConflictingOneOf() + if case .conf(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {self.event = .conf(v)} + case 2: + var v: Chainrpc_Reorg? + if let current = self.event { + try decoder.handleConflictingOneOf() + if case .reorg(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {self.event = .reorg(v)} + default: break + } + } + } + + func traverse(visitor: inout V) throws { + switch self.event { + case .conf(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + case .reorg(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + case nil: break + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Chainrpc_ConfEvent, rhs: Chainrpc_ConfEvent) -> Bool { + if lhs.event != rhs.event {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Chainrpc_Outpoint: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Outpoint" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "hash"), + 2: .same(proto: "index"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.hash) + case 2: try decoder.decodeSingularUInt32Field(value: &self.index) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.hash.isEmpty { + try visitor.visitSingularBytesField(value: self.hash, fieldNumber: 1) + } + if self.index != 0 { + try visitor.visitSingularUInt32Field(value: self.index, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Chainrpc_Outpoint, rhs: Chainrpc_Outpoint) -> Bool { + if lhs.hash != rhs.hash {return false} + if lhs.index != rhs.index {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Chainrpc_SpendRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SpendRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "outpoint"), + 2: .same(proto: "script"), + 3: .standard(proto: "height_hint"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &self._outpoint) + case 2: try decoder.decodeSingularBytesField(value: &self.script) + case 3: try decoder.decodeSingularUInt32Field(value: &self.heightHint) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._outpoint { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + if !self.script.isEmpty { + try visitor.visitSingularBytesField(value: self.script, fieldNumber: 2) + } + if self.heightHint != 0 { + try visitor.visitSingularUInt32Field(value: self.heightHint, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Chainrpc_SpendRequest, rhs: Chainrpc_SpendRequest) -> Bool { + if lhs._outpoint != rhs._outpoint {return false} + if lhs.script != rhs.script {return false} + if lhs.heightHint != rhs.heightHint {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Chainrpc_SpendDetails: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SpendDetails" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "spending_outpoint"), + 2: .standard(proto: "raw_spending_tx"), + 3: .standard(proto: "spending_tx_hash"), + 4: .standard(proto: "spending_input_index"), + 5: .standard(proto: "spending_height"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &self._spendingOutpoint) + case 2: try decoder.decodeSingularBytesField(value: &self.rawSpendingTx) + case 3: try decoder.decodeSingularBytesField(value: &self.spendingTxHash) + case 4: try decoder.decodeSingularUInt32Field(value: &self.spendingInputIndex) + case 5: try decoder.decodeSingularUInt32Field(value: &self.spendingHeight) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._spendingOutpoint { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + if !self.rawSpendingTx.isEmpty { + try visitor.visitSingularBytesField(value: self.rawSpendingTx, fieldNumber: 2) + } + if !self.spendingTxHash.isEmpty { + try visitor.visitSingularBytesField(value: self.spendingTxHash, fieldNumber: 3) + } + if self.spendingInputIndex != 0 { + try visitor.visitSingularUInt32Field(value: self.spendingInputIndex, fieldNumber: 4) + } + if self.spendingHeight != 0 { + try visitor.visitSingularUInt32Field(value: self.spendingHeight, fieldNumber: 5) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Chainrpc_SpendDetails, rhs: Chainrpc_SpendDetails) -> Bool { + if lhs._spendingOutpoint != rhs._spendingOutpoint {return false} + if lhs.rawSpendingTx != rhs.rawSpendingTx {return false} + if lhs.spendingTxHash != rhs.spendingTxHash {return false} + if lhs.spendingInputIndex != rhs.spendingInputIndex {return false} + if lhs.spendingHeight != rhs.spendingHeight {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Chainrpc_SpendEvent: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SpendEvent" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "spend"), + 2: .same(proto: "reorg"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: + var v: Chainrpc_SpendDetails? + if let current = self.event { + try decoder.handleConflictingOneOf() + if case .spend(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {self.event = .spend(v)} + case 2: + var v: Chainrpc_Reorg? + if let current = self.event { + try decoder.handleConflictingOneOf() + if case .reorg(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {self.event = .reorg(v)} + default: break + } + } + } + + func traverse(visitor: inout V) throws { + switch self.event { + case .spend(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + case .reorg(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + case nil: break + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Chainrpc_SpendEvent, rhs: Chainrpc_SpendEvent) -> Bool { + if lhs.event != rhs.event {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Chainrpc_BlockEpoch: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".BlockEpoch" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "hash"), + 2: .same(proto: "height"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.hash) + case 2: try decoder.decodeSingularUInt32Field(value: &self.height) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.hash.isEmpty { + try visitor.visitSingularBytesField(value: self.hash, fieldNumber: 1) + } + if self.height != 0 { + try visitor.visitSingularUInt32Field(value: self.height, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Chainrpc_BlockEpoch, rhs: Chainrpc_BlockEpoch) -> Bool { + if lhs.hash != rhs.hash {return false} + if lhs.height != rhs.height {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/wallet/Lightning/rpc/invoicesrpc/invoices.pb.swift b/wallet/Lightning/rpc/invoicesrpc/invoices.pb.swift new file mode 100644 index 0000000..9046f36 --- /dev/null +++ b/wallet/Lightning/rpc/invoicesrpc/invoices.pb.swift @@ -0,0 +1,393 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: invoicesrpc/invoices.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +import Foundation +import SwiftProtobuf + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +struct Invoicesrpc_CancelInvoiceMsg { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Hash corresponding to the (hold) invoice to cancel. + var paymentHash: Data = SwiftProtobuf.Internal.emptyData + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Invoicesrpc_CancelInvoiceResp { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Invoicesrpc_AddHoldInvoiceRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///An optional memo to attach along with the invoice. Used for record keeping + ///purposes for the invoice's creator, and will also be set in the description + ///field of the encoded payment request if the description_hash field is not + ///being used. + var memo: String = String() + + /// The hash of the preimage + var hash: Data = SwiftProtobuf.Internal.emptyData + + /// + ///The value of this invoice in satoshis + /// + ///The fields value and value_msat are mutually exclusive. + var value: Int64 = 0 + + /// + ///The value of this invoice in millisatoshis + /// + ///The fields value and value_msat are mutually exclusive. + var valueMsat: Int64 = 0 + + /// + ///Hash (SHA-256) of a description of the payment. Used if the description of + ///payment (memo) is too long to naturally fit within the description field + ///of an encoded payment request. + var descriptionHash: Data = SwiftProtobuf.Internal.emptyData + + /// Payment request expiry time in seconds. Default is 3600 (1 hour). + var expiry: Int64 = 0 + + /// Fallback on-chain address. + var fallbackAddr: String = String() + + /// Delta to use for the time-lock of the CLTV extended to the final hop. + var cltvExpiry: UInt64 = 0 + + /// + ///Route hints that can each be individually used to assist in reaching the + ///invoice's destination. + var routeHints: [Lnrpc_RouteHint] = [] + + /// Whether this invoice should include routing hints for private channels. + var `private`: Bool = false + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Invoicesrpc_AddHoldInvoiceResp { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///A bare-bones invoice for a payment within the Lightning Network. With the + ///details of the invoice, the sender has all the data necessary to send a + ///payment to the recipient. + var paymentRequest: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Invoicesrpc_SettleInvoiceMsg { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Externally discovered pre-image that should be used to settle the hold + /// invoice. + var preimage: Data = SwiftProtobuf.Internal.emptyData + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Invoicesrpc_SettleInvoiceResp { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Invoicesrpc_SubscribeSingleInvoiceRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Hash corresponding to the (hold) invoice to subscribe to. + var rHash: Data = SwiftProtobuf.Internal.emptyData + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "invoicesrpc" + +extension Invoicesrpc_CancelInvoiceMsg: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".CancelInvoiceMsg" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "payment_hash"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.paymentHash) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.paymentHash.isEmpty { + try visitor.visitSingularBytesField(value: self.paymentHash, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Invoicesrpc_CancelInvoiceMsg, rhs: Invoicesrpc_CancelInvoiceMsg) -> Bool { + if lhs.paymentHash != rhs.paymentHash {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Invoicesrpc_CancelInvoiceResp: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".CancelInvoiceResp" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Invoicesrpc_CancelInvoiceResp, rhs: Invoicesrpc_CancelInvoiceResp) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Invoicesrpc_AddHoldInvoiceRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".AddHoldInvoiceRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "memo"), + 2: .same(proto: "hash"), + 3: .same(proto: "value"), + 10: .standard(proto: "value_msat"), + 4: .standard(proto: "description_hash"), + 5: .same(proto: "expiry"), + 6: .standard(proto: "fallback_addr"), + 7: .standard(proto: "cltv_expiry"), + 8: .standard(proto: "route_hints"), + 9: .same(proto: "private"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.memo) + case 2: try decoder.decodeSingularBytesField(value: &self.hash) + case 3: try decoder.decodeSingularInt64Field(value: &self.value) + case 4: try decoder.decodeSingularBytesField(value: &self.descriptionHash) + case 5: try decoder.decodeSingularInt64Field(value: &self.expiry) + case 6: try decoder.decodeSingularStringField(value: &self.fallbackAddr) + case 7: try decoder.decodeSingularUInt64Field(value: &self.cltvExpiry) + case 8: try decoder.decodeRepeatedMessageField(value: &self.routeHints) + case 9: try decoder.decodeSingularBoolField(value: &self.`private`) + case 10: try decoder.decodeSingularInt64Field(value: &self.valueMsat) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.memo.isEmpty { + try visitor.visitSingularStringField(value: self.memo, fieldNumber: 1) + } + if !self.hash.isEmpty { + try visitor.visitSingularBytesField(value: self.hash, fieldNumber: 2) + } + if self.value != 0 { + try visitor.visitSingularInt64Field(value: self.value, fieldNumber: 3) + } + if !self.descriptionHash.isEmpty { + try visitor.visitSingularBytesField(value: self.descriptionHash, fieldNumber: 4) + } + if self.expiry != 0 { + try visitor.visitSingularInt64Field(value: self.expiry, fieldNumber: 5) + } + if !self.fallbackAddr.isEmpty { + try visitor.visitSingularStringField(value: self.fallbackAddr, fieldNumber: 6) + } + if self.cltvExpiry != 0 { + try visitor.visitSingularUInt64Field(value: self.cltvExpiry, fieldNumber: 7) + } + if !self.routeHints.isEmpty { + try visitor.visitRepeatedMessageField(value: self.routeHints, fieldNumber: 8) + } + if self.`private` != false { + try visitor.visitSingularBoolField(value: self.`private`, fieldNumber: 9) + } + if self.valueMsat != 0 { + try visitor.visitSingularInt64Field(value: self.valueMsat, fieldNumber: 10) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Invoicesrpc_AddHoldInvoiceRequest, rhs: Invoicesrpc_AddHoldInvoiceRequest) -> Bool { + if lhs.memo != rhs.memo {return false} + if lhs.hash != rhs.hash {return false} + if lhs.value != rhs.value {return false} + if lhs.valueMsat != rhs.valueMsat {return false} + if lhs.descriptionHash != rhs.descriptionHash {return false} + if lhs.expiry != rhs.expiry {return false} + if lhs.fallbackAddr != rhs.fallbackAddr {return false} + if lhs.cltvExpiry != rhs.cltvExpiry {return false} + if lhs.routeHints != rhs.routeHints {return false} + if lhs.`private` != rhs.`private` {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Invoicesrpc_AddHoldInvoiceResp: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".AddHoldInvoiceResp" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "payment_request"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.paymentRequest) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.paymentRequest.isEmpty { + try visitor.visitSingularStringField(value: self.paymentRequest, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Invoicesrpc_AddHoldInvoiceResp, rhs: Invoicesrpc_AddHoldInvoiceResp) -> Bool { + if lhs.paymentRequest != rhs.paymentRequest {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Invoicesrpc_SettleInvoiceMsg: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SettleInvoiceMsg" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "preimage"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.preimage) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.preimage.isEmpty { + try visitor.visitSingularBytesField(value: self.preimage, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Invoicesrpc_SettleInvoiceMsg, rhs: Invoicesrpc_SettleInvoiceMsg) -> Bool { + if lhs.preimage != rhs.preimage {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Invoicesrpc_SettleInvoiceResp: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SettleInvoiceResp" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Invoicesrpc_SettleInvoiceResp, rhs: Invoicesrpc_SettleInvoiceResp) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Invoicesrpc_SubscribeSingleInvoiceRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SubscribeSingleInvoiceRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 2: .standard(proto: "r_hash"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 2: try decoder.decodeSingularBytesField(value: &self.rHash) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.rHash.isEmpty { + try visitor.visitSingularBytesField(value: self.rHash, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Invoicesrpc_SubscribeSingleInvoiceRequest, rhs: Invoicesrpc_SubscribeSingleInvoiceRequest) -> Bool { + if lhs.rHash != rhs.rHash {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/wallet/Lightning/rpc/lnclipb/lncli.pb.swift b/wallet/Lightning/rpc/lnclipb/lncli.pb.swift new file mode 100644 index 0000000..166fade --- /dev/null +++ b/wallet/Lightning/rpc/lnclipb/lncli.pb.swift @@ -0,0 +1,93 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: lnclipb/lncli.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +import Foundation +import SwiftProtobuf + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +struct Lnclipb_VersionResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The version information for lncli. + var lncli: Verrpc_Version { + get {return _lncli ?? Verrpc_Version()} + set {_lncli = newValue} + } + /// Returns true if `lncli` has been explicitly set. + var hasLncli: Bool {return self._lncli != nil} + /// Clears the value of `lncli`. Subsequent reads from it will return its default value. + mutating func clearLncli() {self._lncli = nil} + + /// The version information for lnd. + var lnd: Verrpc_Version { + get {return _lnd ?? Verrpc_Version()} + set {_lnd = newValue} + } + /// Returns true if `lnd` has been explicitly set. + var hasLnd: Bool {return self._lnd != nil} + /// Clears the value of `lnd`. Subsequent reads from it will return its default value. + mutating func clearLnd() {self._lnd = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _lncli: Verrpc_Version? = nil + fileprivate var _lnd: Verrpc_Version? = nil +} + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "lnclipb" + +extension Lnclipb_VersionResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".VersionResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "lncli"), + 2: .same(proto: "lnd"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &self._lncli) + case 2: try decoder.decodeSingularMessageField(value: &self._lnd) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._lncli { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + if let v = self._lnd { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnclipb_VersionResponse, rhs: Lnclipb_VersionResponse) -> Bool { + if lhs._lncli != rhs._lncli {return false} + if lhs._lnd != rhs._lnd {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/wallet/Lightning/rpc/routerrpc/router.pb.swift b/wallet/Lightning/rpc/routerrpc/router.pb.swift new file mode 100644 index 0000000..2ea07f4 --- /dev/null +++ b/wallet/Lightning/rpc/routerrpc/router.pb.swift @@ -0,0 +1,2392 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: routerrpc/router.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +import Foundation +import SwiftProtobuf + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +enum Routerrpc_FailureDetail: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknown // = 0 + case noDetail // = 1 + case onionDecode // = 2 + case linkNotEligible // = 3 + case onChainTimeout // = 4 + case htlcExceedsMax // = 5 + case insufficientBalance // = 6 + case incompleteForward // = 7 + case htlcAddFailed // = 8 + case forwardsDisabled // = 9 + case invoiceCanceled // = 10 + case invoiceUnderpaid // = 11 + case invoiceExpiryTooSoon // = 12 + case invoiceNotOpen // = 13 + case mppInvoiceTimeout // = 14 + case addressMismatch // = 15 + case setTotalMismatch // = 16 + case setTotalTooLow // = 17 + case setOverpaid // = 18 + case unknownInvoice // = 19 + case invalidKeysend // = 20 + case mppInProgress // = 21 + case circularRoute // = 22 + case UNRECOGNIZED(Int) + + init() { + self = .unknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknown + case 1: self = .noDetail + case 2: self = .onionDecode + case 3: self = .linkNotEligible + case 4: self = .onChainTimeout + case 5: self = .htlcExceedsMax + case 6: self = .insufficientBalance + case 7: self = .incompleteForward + case 8: self = .htlcAddFailed + case 9: self = .forwardsDisabled + case 10: self = .invoiceCanceled + case 11: self = .invoiceUnderpaid + case 12: self = .invoiceExpiryTooSoon + case 13: self = .invoiceNotOpen + case 14: self = .mppInvoiceTimeout + case 15: self = .addressMismatch + case 16: self = .setTotalMismatch + case 17: self = .setTotalTooLow + case 18: self = .setOverpaid + case 19: self = .unknownInvoice + case 20: self = .invalidKeysend + case 21: self = .mppInProgress + case 22: self = .circularRoute + default: self = .UNRECOGNIZED(rawValue) + } + } + + var rawValue: Int { + switch self { + case .unknown: return 0 + case .noDetail: return 1 + case .onionDecode: return 2 + case .linkNotEligible: return 3 + case .onChainTimeout: return 4 + case .htlcExceedsMax: return 5 + case .insufficientBalance: return 6 + case .incompleteForward: return 7 + case .htlcAddFailed: return 8 + case .forwardsDisabled: return 9 + case .invoiceCanceled: return 10 + case .invoiceUnderpaid: return 11 + case .invoiceExpiryTooSoon: return 12 + case .invoiceNotOpen: return 13 + case .mppInvoiceTimeout: return 14 + case .addressMismatch: return 15 + case .setTotalMismatch: return 16 + case .setTotalTooLow: return 17 + case .setOverpaid: return 18 + case .unknownInvoice: return 19 + case .invalidKeysend: return 20 + case .mppInProgress: return 21 + case .circularRoute: return 22 + case .UNRECOGNIZED(let i): return i + } + } + +} + +#if swift(>=4.2) + +extension Routerrpc_FailureDetail: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static var allCases: [Routerrpc_FailureDetail] = [ + .unknown, + .noDetail, + .onionDecode, + .linkNotEligible, + .onChainTimeout, + .htlcExceedsMax, + .insufficientBalance, + .incompleteForward, + .htlcAddFailed, + .forwardsDisabled, + .invoiceCanceled, + .invoiceUnderpaid, + .invoiceExpiryTooSoon, + .invoiceNotOpen, + .mppInvoiceTimeout, + .addressMismatch, + .setTotalMismatch, + .setTotalTooLow, + .setOverpaid, + .unknownInvoice, + .invalidKeysend, + .mppInProgress, + .circularRoute, + ] +} + +#endif // swift(>=4.2) + +enum Routerrpc_PaymentState: SwiftProtobuf.Enum { + typealias RawValue = Int + + /// + ///Payment is still in flight. + case inFlight // = 0 + + /// + ///Payment completed successfully. + case succeeded // = 1 + + /// + ///There are more routes to try, but the payment timeout was exceeded. + case failedTimeout // = 2 + + /// + ///All possible routes were tried and failed permanently. Or were no + ///routes to the destination at all. + case failedNoRoute // = 3 + + /// + ///A non-recoverable error has occured. + case failedError // = 4 + + /// + ///Payment details incorrect (unknown hash, invalid amt or + ///invalid final cltv delta) + case failedIncorrectPaymentDetails // = 5 + + /// + ///Insufficient local balance. + case failedInsufficientBalance // = 6 + case UNRECOGNIZED(Int) + + init() { + self = .inFlight + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .inFlight + case 1: self = .succeeded + case 2: self = .failedTimeout + case 3: self = .failedNoRoute + case 4: self = .failedError + case 5: self = .failedIncorrectPaymentDetails + case 6: self = .failedInsufficientBalance + default: self = .UNRECOGNIZED(rawValue) + } + } + + var rawValue: Int { + switch self { + case .inFlight: return 0 + case .succeeded: return 1 + case .failedTimeout: return 2 + case .failedNoRoute: return 3 + case .failedError: return 4 + case .failedIncorrectPaymentDetails: return 5 + case .failedInsufficientBalance: return 6 + case .UNRECOGNIZED(let i): return i + } + } + +} + +#if swift(>=4.2) + +extension Routerrpc_PaymentState: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static var allCases: [Routerrpc_PaymentState] = [ + .inFlight, + .succeeded, + .failedTimeout, + .failedNoRoute, + .failedError, + .failedIncorrectPaymentDetails, + .failedInsufficientBalance, + ] +} + +#endif // swift(>=4.2) + +enum Routerrpc_ResolveHoldForwardAction: SwiftProtobuf.Enum { + typealias RawValue = Int + case settle // = 0 + case fail // = 1 + case resume // = 2 + case UNRECOGNIZED(Int) + + init() { + self = .settle + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .settle + case 1: self = .fail + case 2: self = .resume + default: self = .UNRECOGNIZED(rawValue) + } + } + + var rawValue: Int { + switch self { + case .settle: return 0 + case .fail: return 1 + case .resume: return 2 + case .UNRECOGNIZED(let i): return i + } + } + +} + +#if swift(>=4.2) + +extension Routerrpc_ResolveHoldForwardAction: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static var allCases: [Routerrpc_ResolveHoldForwardAction] = [ + .settle, + .fail, + .resume, + ] +} + +#endif // swift(>=4.2) + +struct Routerrpc_SendPaymentRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The identity pubkey of the payment recipient + var dest: Data { + get {return _storage._dest} + set {_uniqueStorage()._dest = newValue} + } + + /// + ///Number of satoshis to send. + /// + ///The fields amt and amt_msat are mutually exclusive. + var amt: Int64 { + get {return _storage._amt} + set {_uniqueStorage()._amt = newValue} + } + + /// + ///Number of millisatoshis to send. + /// + ///The fields amt and amt_msat are mutually exclusive. + var amtMsat: Int64 { + get {return _storage._amtMsat} + set {_uniqueStorage()._amtMsat = newValue} + } + + /// The hash to use within the payment's HTLC + var paymentHash: Data { + get {return _storage._paymentHash} + set {_uniqueStorage()._paymentHash = newValue} + } + + /// + ///The CLTV delta from the current height that should be used to set the + ///timelock for the final hop. + var finalCltvDelta: Int32 { + get {return _storage._finalCltvDelta} + set {_uniqueStorage()._finalCltvDelta = newValue} + } + + /// + ///A bare-bones invoice for a payment within the Lightning Network. With the + ///details of the invoice, the sender has all the data necessary to send a + ///payment to the recipient. The amount in the payment request may be zero. In + ///that case it is required to set the amt field as well. If no payment request + ///is specified, the following fields are required: dest, amt and payment_hash. + var paymentRequest: String { + get {return _storage._paymentRequest} + set {_uniqueStorage()._paymentRequest = newValue} + } + + /// + ///An upper limit on the amount of time we should spend when attempting to + ///fulfill the payment. This is expressed in seconds. If we cannot make a + ///successful payment within this time frame, an error will be returned. + ///This field must be non-zero. + var timeoutSeconds: Int32 { + get {return _storage._timeoutSeconds} + set {_uniqueStorage()._timeoutSeconds = newValue} + } + + /// + ///The maximum number of satoshis that will be paid as a fee of the payment. + ///If this field is left to the default value of 0, only zero-fee routes will + ///be considered. This usually means single hop routes connecting directly to + ///the destination. To send the payment without a fee limit, use max int here. + /// + ///The fields fee_limit_sat and fee_limit_msat are mutually exclusive. + var feeLimitSat: Int64 { + get {return _storage._feeLimitSat} + set {_uniqueStorage()._feeLimitSat = newValue} + } + + /// + ///The maximum number of millisatoshis that will be paid as a fee of the + ///payment. If this field is left to the default value of 0, only zero-fee + ///routes will be considered. This usually means single hop routes connecting + ///directly to the destination. To send the payment without a fee limit, use + ///max int here. + /// + ///The fields fee_limit_sat and fee_limit_msat are mutually exclusive. + var feeLimitMsat: Int64 { + get {return _storage._feeLimitMsat} + set {_uniqueStorage()._feeLimitMsat = newValue} + } + + /// + ///Deprecated, use outgoing_chan_ids. The channel id of the channel that must + ///be taken to the first hop. If zero, any channel may be used (unless + ///outgoing_chan_ids are set). + var outgoingChanID: UInt64 { + get {return _storage._outgoingChanID} + set {_uniqueStorage()._outgoingChanID = newValue} + } + + /// + ///The channel ids of the channels are allowed for the first hop. If empty, + ///any channel may be used. + var outgoingChanIds: [UInt64] { + get {return _storage._outgoingChanIds} + set {_uniqueStorage()._outgoingChanIds = newValue} + } + + /// + ///The pubkey of the last hop of the route. If empty, any hop may be used. + var lastHopPubkey: Data { + get {return _storage._lastHopPubkey} + set {_uniqueStorage()._lastHopPubkey = newValue} + } + + /// + ///An optional maximum total time lock for the route. This should not exceed + ///lnd's `--max-cltv-expiry` setting. If zero, then the value of + ///`--max-cltv-expiry` is enforced. + var cltvLimit: Int32 { + get {return _storage._cltvLimit} + set {_uniqueStorage()._cltvLimit = newValue} + } + + /// + ///Optional route hints to reach the destination through private channels. + var routeHints: [Lnrpc_RouteHint] { + get {return _storage._routeHints} + set {_uniqueStorage()._routeHints = newValue} + } + + /// + ///An optional field that can be used to pass an arbitrary set of TLV records + ///to a peer which understands the new records. This can be used to pass + ///application specific data during the payment attempt. Record types are + ///required to be in the custom range >= 65536. When using REST, the values + ///must be encoded as base64. + var destCustomRecords: Dictionary { + get {return _storage._destCustomRecords} + set {_uniqueStorage()._destCustomRecords = newValue} + } + + /// If set, circular payments to self are permitted. + var allowSelfPayment: Bool { + get {return _storage._allowSelfPayment} + set {_uniqueStorage()._allowSelfPayment = newValue} + } + + /// + ///Features assumed to be supported by the final node. All transitive feature + ///dependencies must also be set properly. For a given feature bit pair, either + ///optional or remote may be set, but not both. If this field is nil or empty, + ///the router will try to load destination features from the graph as a + ///fallback. + var destFeatures: [Lnrpc_FeatureBit] { + get {return _storage._destFeatures} + set {_uniqueStorage()._destFeatures = newValue} + } + + /// + ///The maximum number of partial payments that may be use to complete the full + ///amount. + var maxParts: UInt32 { + get {return _storage._maxParts} + set {_uniqueStorage()._maxParts = newValue} + } + + /// + ///If set, only the final payment update is streamed back. Intermediate updates + ///that show which htlcs are still in flight are suppressed. + var noInflightUpdates: Bool { + get {return _storage._noInflightUpdates} + set {_uniqueStorage()._noInflightUpdates = newValue} + } + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _storage = _StorageClass.defaultInstance +} + +struct Routerrpc_TrackPaymentRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The hash of the payment to look up. + var paymentHash: Data = SwiftProtobuf.Internal.emptyData + + /// + ///If set, only the final payment update is streamed back. Intermediate updates + ///that show which htlcs are still in flight are suppressed. + var noInflightUpdates: Bool = false + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Routerrpc_RouteFeeRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The destination once wishes to obtain a routing fee quote to. + var dest: Data = SwiftProtobuf.Internal.emptyData + + /// + ///The amount one wishes to send to the target destination. + var amtSat: Int64 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Routerrpc_RouteFeeResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///A lower bound of the estimated fee to the target destination within the + ///network, expressed in milli-satoshis. + var routingFeeMsat: Int64 = 0 + + /// + ///An estimate of the worst case time delay that can occur. Note that callers + ///will still need to factor in the final CLTV delta of the last hop into this + ///value. + var timeLockDelay: Int64 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Routerrpc_SendToRouteRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The payment hash to use for the HTLC. + var paymentHash: Data = SwiftProtobuf.Internal.emptyData + + /// Route that should be used to attempt to complete the payment. + var route: Lnrpc_Route { + get {return _route ?? Lnrpc_Route()} + set {_route = newValue} + } + /// Returns true if `route` has been explicitly set. + var hasRoute: Bool {return self._route != nil} + /// Clears the value of `route`. Subsequent reads from it will return its default value. + mutating func clearRoute() {self._route = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _route: Lnrpc_Route? = nil +} + +struct Routerrpc_SendToRouteResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The preimage obtained by making the payment. + var preimage: Data = SwiftProtobuf.Internal.emptyData + + /// The failure message in case the payment failed. + var failure: Lnrpc_Failure { + get {return _failure ?? Lnrpc_Failure()} + set {_failure = newValue} + } + /// Returns true if `failure` has been explicitly set. + var hasFailure: Bool {return self._failure != nil} + /// Clears the value of `failure`. Subsequent reads from it will return its default value. + mutating func clearFailure() {self._failure = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _failure: Lnrpc_Failure? = nil +} + +struct Routerrpc_ResetMissionControlRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Routerrpc_ResetMissionControlResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Routerrpc_QueryMissionControlRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +/// QueryMissionControlResponse contains mission control state. +struct Routerrpc_QueryMissionControlResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Node pair-level mission control state. + var pairs: [Routerrpc_PairHistory] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +/// PairHistory contains the mission control state for a particular node pair. +struct Routerrpc_PairHistory { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The source node pubkey of the pair. + var nodeFrom: Data = SwiftProtobuf.Internal.emptyData + + /// The destination node pubkey of the pair. + var nodeTo: Data = SwiftProtobuf.Internal.emptyData + + var history: Routerrpc_PairData { + get {return _history ?? Routerrpc_PairData()} + set {_history = newValue} + } + /// Returns true if `history` has been explicitly set. + var hasHistory: Bool {return self._history != nil} + /// Clears the value of `history`. Subsequent reads from it will return its default value. + mutating func clearHistory() {self._history = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _history: Routerrpc_PairData? = nil +} + +struct Routerrpc_PairData { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Time of last failure. + var failTime: Int64 = 0 + + /// + ///Lowest amount that failed to forward rounded to whole sats. This may be + ///set to zero if the failure is independent of amount. + var failAmtSat: Int64 = 0 + + /// + ///Lowest amount that failed to forward in millisats. This may be + ///set to zero if the failure is independent of amount. + var failAmtMsat: Int64 = 0 + + /// Time of last success. + var successTime: Int64 = 0 + + /// Highest amount that we could successfully forward rounded to whole sats. + var successAmtSat: Int64 = 0 + + /// Highest amount that we could successfully forward in millisats. + var successAmtMsat: Int64 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Routerrpc_QueryProbabilityRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The source node pubkey of the pair. + var fromNode: Data = SwiftProtobuf.Internal.emptyData + + /// The destination node pubkey of the pair. + var toNode: Data = SwiftProtobuf.Internal.emptyData + + /// The amount for which to calculate a probability. + var amtMsat: Int64 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Routerrpc_QueryProbabilityResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The success probability for the requested pair. + var probability: Double = 0 + + /// The historical data for the requested pair. + var history: Routerrpc_PairData { + get {return _history ?? Routerrpc_PairData()} + set {_history = newValue} + } + /// Returns true if `history` has been explicitly set. + var hasHistory: Bool {return self._history != nil} + /// Clears the value of `history`. Subsequent reads from it will return its default value. + mutating func clearHistory() {self._history = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _history: Routerrpc_PairData? = nil +} + +struct Routerrpc_BuildRouteRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The amount to send expressed in msat. If set to zero, the minimum routable + ///amount is used. + var amtMsat: Int64 = 0 + + /// + ///CLTV delta from the current height that should be used for the timelock + ///of the final hop + var finalCltvDelta: Int32 = 0 + + /// + ///The channel id of the channel that must be taken to the first hop. If zero, + ///any channel may be used. + var outgoingChanID: UInt64 = 0 + + /// + ///A list of hops that defines the route. This does not include the source hop + ///pubkey. + var hopPubkeys: [Data] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Routerrpc_BuildRouteResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///Fully specified route that can be used to execute the payment. + var route: Lnrpc_Route { + get {return _route ?? Lnrpc_Route()} + set {_route = newValue} + } + /// Returns true if `route` has been explicitly set. + var hasRoute: Bool {return self._route != nil} + /// Clears the value of `route`. Subsequent reads from it will return its default value. + mutating func clearRoute() {self._route = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _route: Lnrpc_Route? = nil +} + +struct Routerrpc_SubscribeHtlcEventsRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +/// +///HtlcEvent contains the htlc event that was processed. These are served on a +///best-effort basis; events are not persisted, delivery is not guaranteed +///(in the event of a crash in the switch, forward events may be lost) and +///some events may be replayed upon restart. Events consumed from this package +///should be de-duplicated by the htlc's unique combination of incoming and +///outgoing channel id and htlc id. [EXPERIMENTAL] +struct Routerrpc_HtlcEvent { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The short channel id that the incoming htlc arrived at our node on. This + ///value is zero for sends. + var incomingChannelID: UInt64 = 0 + + /// + ///The short channel id that the outgoing htlc left our node on. This value + ///is zero for receives. + var outgoingChannelID: UInt64 = 0 + + /// + ///Incoming id is the index of the incoming htlc in the incoming channel. + ///This value is zero for sends. + var incomingHtlcID: UInt64 = 0 + + /// + ///Outgoing id is the index of the outgoing htlc in the outgoing channel. + ///This value is zero for receives. + var outgoingHtlcID: UInt64 = 0 + + /// + ///The time in unix nanoseconds that the event occurred. + var timestampNs: UInt64 = 0 + + /// + ///The event type indicates whether the htlc was part of a send, receive or + ///forward. + var eventType: Routerrpc_HtlcEvent.EventType = .unknown + + var event: Routerrpc_HtlcEvent.OneOf_Event? = nil + + var forwardEvent: Routerrpc_ForwardEvent { + get { + if case .forwardEvent(let v)? = event {return v} + return Routerrpc_ForwardEvent() + } + set {event = .forwardEvent(newValue)} + } + + var forwardFailEvent: Routerrpc_ForwardFailEvent { + get { + if case .forwardFailEvent(let v)? = event {return v} + return Routerrpc_ForwardFailEvent() + } + set {event = .forwardFailEvent(newValue)} + } + + var settleEvent: Routerrpc_SettleEvent { + get { + if case .settleEvent(let v)? = event {return v} + return Routerrpc_SettleEvent() + } + set {event = .settleEvent(newValue)} + } + + var linkFailEvent: Routerrpc_LinkFailEvent { + get { + if case .linkFailEvent(let v)? = event {return v} + return Routerrpc_LinkFailEvent() + } + set {event = .linkFailEvent(newValue)} + } + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum OneOf_Event: Equatable { + case forwardEvent(Routerrpc_ForwardEvent) + case forwardFailEvent(Routerrpc_ForwardFailEvent) + case settleEvent(Routerrpc_SettleEvent) + case linkFailEvent(Routerrpc_LinkFailEvent) + + #if !swift(>=4.1) + static func ==(lhs: Routerrpc_HtlcEvent.OneOf_Event, rhs: Routerrpc_HtlcEvent.OneOf_Event) -> Bool { + switch (lhs, rhs) { + case (.forwardEvent(let l), .forwardEvent(let r)): return l == r + case (.forwardFailEvent(let l), .forwardFailEvent(let r)): return l == r + case (.settleEvent(let l), .settleEvent(let r)): return l == r + case (.linkFailEvent(let l), .linkFailEvent(let r)): return l == r + default: return false + } + } + #endif + } + + enum EventType: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknown // = 0 + case send // = 1 + case receive // = 2 + case forward // = 3 + case UNRECOGNIZED(Int) + + init() { + self = .unknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknown + case 1: self = .send + case 2: self = .receive + case 3: self = .forward + default: self = .UNRECOGNIZED(rawValue) + } + } + + var rawValue: Int { + switch self { + case .unknown: return 0 + case .send: return 1 + case .receive: return 2 + case .forward: return 3 + case .UNRECOGNIZED(let i): return i + } + } + + } + + init() {} +} + +#if swift(>=4.2) + +extension Routerrpc_HtlcEvent.EventType: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static var allCases: [Routerrpc_HtlcEvent.EventType] = [ + .unknown, + .send, + .receive, + .forward, + ] +} + +#endif // swift(>=4.2) + +struct Routerrpc_HtlcInfo { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The timelock on the incoming htlc. + var incomingTimelock: UInt32 = 0 + + /// The timelock on the outgoing htlc. + var outgoingTimelock: UInt32 = 0 + + /// The amount of the incoming htlc. + var incomingAmtMsat: UInt64 = 0 + + /// The amount of the outgoing htlc. + var outgoingAmtMsat: UInt64 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Routerrpc_ForwardEvent { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Info contains details about the htlc that was forwarded. + var info: Routerrpc_HtlcInfo { + get {return _info ?? Routerrpc_HtlcInfo()} + set {_info = newValue} + } + /// Returns true if `info` has been explicitly set. + var hasInfo: Bool {return self._info != nil} + /// Clears the value of `info`. Subsequent reads from it will return its default value. + mutating func clearInfo() {self._info = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _info: Routerrpc_HtlcInfo? = nil +} + +struct Routerrpc_ForwardFailEvent { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Routerrpc_SettleEvent { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Routerrpc_LinkFailEvent { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Info contains details about the htlc that we failed. + var info: Routerrpc_HtlcInfo { + get {return _info ?? Routerrpc_HtlcInfo()} + set {_info = newValue} + } + /// Returns true if `info` has been explicitly set. + var hasInfo: Bool {return self._info != nil} + /// Clears the value of `info`. Subsequent reads from it will return its default value. + mutating func clearInfo() {self._info = nil} + + /// FailureCode is the BOLT error code for the failure. + var wireFailure: Lnrpc_Failure.FailureCode = .reserved + + /// + ///FailureDetail provides additional information about the reason for the + ///failure. This detail enriches the information provided by the wire message + ///and may be 'no detail' if the wire message requires no additional metadata. + var failureDetail: Routerrpc_FailureDetail = .unknown + + /// A string representation of the link failure. + var failureString: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _info: Routerrpc_HtlcInfo? = nil +} + +struct Routerrpc_PaymentStatus { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Current state the payment is in. + var state: Routerrpc_PaymentState = .inFlight + + /// + ///The pre-image of the payment when state is SUCCEEDED. + var preimage: Data = SwiftProtobuf.Internal.emptyData + + /// + ///The HTLCs made in attempt to settle the payment [EXPERIMENTAL]. + var htlcs: [Lnrpc_HTLCAttempt] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Routerrpc_CircuitKey { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + //// The id of the channel that the is part of this circuit. + var chanID: UInt64 = 0 + + //// The index of the incoming htlc in the incoming channel. + var htlcID: UInt64 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Routerrpc_ForwardHtlcInterceptRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The key of this forwarded htlc. It defines the incoming channel id and + ///the index in this channel. + var incomingCircuitKey: Routerrpc_CircuitKey { + get {return _incomingCircuitKey ?? Routerrpc_CircuitKey()} + set {_incomingCircuitKey = newValue} + } + /// Returns true if `incomingCircuitKey` has been explicitly set. + var hasIncomingCircuitKey: Bool {return self._incomingCircuitKey != nil} + /// Clears the value of `incomingCircuitKey`. Subsequent reads from it will return its default value. + mutating func clearIncomingCircuitKey() {self._incomingCircuitKey = nil} + + /// The incoming htlc amount. + var incomingAmountMsat: UInt64 = 0 + + /// The incoming htlc expiry. + var incomingExpiry: UInt32 = 0 + + /// + ///The htlc payment hash. This value is not guaranteed to be unique per + ///request. + var paymentHash: Data = SwiftProtobuf.Internal.emptyData + + /// The requested outgoing channel id for this forwarded htlc. Because of + /// non-strict forwarding, this isn't necessarily the channel over which the + /// packet will be forwarded eventually. A different channel to the same peer + /// may be selected as well. + var outgoingRequestedChanID: UInt64 = 0 + + /// The outgoing htlc amount. + var outgoingAmountMsat: UInt64 = 0 + + /// The outgoing htlc expiry. + var outgoingExpiry: UInt32 = 0 + + /// Any custom records that were present in the payload. + var customRecords: Dictionary = [:] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _incomingCircuitKey: Routerrpc_CircuitKey? = nil +} + +///* +///ForwardHtlcInterceptResponse enables the caller to resolve a previously hold +///forward. The caller can choose either to: +///- `Resume`: Execute the default behavior (usually forward). +///- `Reject`: Fail the htlc backwards. +///- `Settle`: Settle this htlc with a given preimage. +struct Routerrpc_ForwardHtlcInterceptResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + ///* + ///The key of this forwarded htlc. It defines the incoming channel id and + ///the index in this channel. + var incomingCircuitKey: Routerrpc_CircuitKey { + get {return _incomingCircuitKey ?? Routerrpc_CircuitKey()} + set {_incomingCircuitKey = newValue} + } + /// Returns true if `incomingCircuitKey` has been explicitly set. + var hasIncomingCircuitKey: Bool {return self._incomingCircuitKey != nil} + /// Clears the value of `incomingCircuitKey`. Subsequent reads from it will return its default value. + mutating func clearIncomingCircuitKey() {self._incomingCircuitKey = nil} + + /// The resolve action for this intercepted htlc. + var action: Routerrpc_ResolveHoldForwardAction = .settle + + /// The preimage in case the resolve action is Settle. + var preimage: Data = SwiftProtobuf.Internal.emptyData + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _incomingCircuitKey: Routerrpc_CircuitKey? = nil +} + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "routerrpc" + +extension Routerrpc_FailureDetail: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN"), + 1: .same(proto: "NO_DETAIL"), + 2: .same(proto: "ONION_DECODE"), + 3: .same(proto: "LINK_NOT_ELIGIBLE"), + 4: .same(proto: "ON_CHAIN_TIMEOUT"), + 5: .same(proto: "HTLC_EXCEEDS_MAX"), + 6: .same(proto: "INSUFFICIENT_BALANCE"), + 7: .same(proto: "INCOMPLETE_FORWARD"), + 8: .same(proto: "HTLC_ADD_FAILED"), + 9: .same(proto: "FORWARDS_DISABLED"), + 10: .same(proto: "INVOICE_CANCELED"), + 11: .same(proto: "INVOICE_UNDERPAID"), + 12: .same(proto: "INVOICE_EXPIRY_TOO_SOON"), + 13: .same(proto: "INVOICE_NOT_OPEN"), + 14: .same(proto: "MPP_INVOICE_TIMEOUT"), + 15: .same(proto: "ADDRESS_MISMATCH"), + 16: .same(proto: "SET_TOTAL_MISMATCH"), + 17: .same(proto: "SET_TOTAL_TOO_LOW"), + 18: .same(proto: "SET_OVERPAID"), + 19: .same(proto: "UNKNOWN_INVOICE"), + 20: .same(proto: "INVALID_KEYSEND"), + 21: .same(proto: "MPP_IN_PROGRESS"), + 22: .same(proto: "CIRCULAR_ROUTE"), + ] +} + +extension Routerrpc_PaymentState: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "IN_FLIGHT"), + 1: .same(proto: "SUCCEEDED"), + 2: .same(proto: "FAILED_TIMEOUT"), + 3: .same(proto: "FAILED_NO_ROUTE"), + 4: .same(proto: "FAILED_ERROR"), + 5: .same(proto: "FAILED_INCORRECT_PAYMENT_DETAILS"), + 6: .same(proto: "FAILED_INSUFFICIENT_BALANCE"), + ] +} + +extension Routerrpc_ResolveHoldForwardAction: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "SETTLE"), + 1: .same(proto: "FAIL"), + 2: .same(proto: "RESUME"), + ] +} + +extension Routerrpc_SendPaymentRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SendPaymentRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "dest"), + 2: .same(proto: "amt"), + 12: .standard(proto: "amt_msat"), + 3: .standard(proto: "payment_hash"), + 4: .standard(proto: "final_cltv_delta"), + 5: .standard(proto: "payment_request"), + 6: .standard(proto: "timeout_seconds"), + 7: .standard(proto: "fee_limit_sat"), + 13: .standard(proto: "fee_limit_msat"), + 8: .standard(proto: "outgoing_chan_id"), + 19: .standard(proto: "outgoing_chan_ids"), + 14: .standard(proto: "last_hop_pubkey"), + 9: .standard(proto: "cltv_limit"), + 10: .standard(proto: "route_hints"), + 11: .standard(proto: "dest_custom_records"), + 15: .standard(proto: "allow_self_payment"), + 16: .standard(proto: "dest_features"), + 17: .standard(proto: "max_parts"), + 18: .standard(proto: "no_inflight_updates"), + ] + + fileprivate class _StorageClass { + var _dest: Data = SwiftProtobuf.Internal.emptyData + var _amt: Int64 = 0 + var _amtMsat: Int64 = 0 + var _paymentHash: Data = SwiftProtobuf.Internal.emptyData + var _finalCltvDelta: Int32 = 0 + var _paymentRequest: String = String() + var _timeoutSeconds: Int32 = 0 + var _feeLimitSat: Int64 = 0 + var _feeLimitMsat: Int64 = 0 + var _outgoingChanID: UInt64 = 0 + var _outgoingChanIds: [UInt64] = [] + var _lastHopPubkey: Data = SwiftProtobuf.Internal.emptyData + var _cltvLimit: Int32 = 0 + var _routeHints: [Lnrpc_RouteHint] = [] + var _destCustomRecords: Dictionary = [:] + var _allowSelfPayment: Bool = false + var _destFeatures: [Lnrpc_FeatureBit] = [] + var _maxParts: UInt32 = 0 + var _noInflightUpdates: Bool = false + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _dest = source._dest + _amt = source._amt + _amtMsat = source._amtMsat + _paymentHash = source._paymentHash + _finalCltvDelta = source._finalCltvDelta + _paymentRequest = source._paymentRequest + _timeoutSeconds = source._timeoutSeconds + _feeLimitSat = source._feeLimitSat + _feeLimitMsat = source._feeLimitMsat + _outgoingChanID = source._outgoingChanID + _outgoingChanIds = source._outgoingChanIds + _lastHopPubkey = source._lastHopPubkey + _cltvLimit = source._cltvLimit + _routeHints = source._routeHints + _destCustomRecords = source._destCustomRecords + _allowSelfPayment = source._allowSelfPayment + _destFeatures = source._destFeatures + _maxParts = source._maxParts + _noInflightUpdates = source._noInflightUpdates + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &_storage._dest) + case 2: try decoder.decodeSingularInt64Field(value: &_storage._amt) + case 3: try decoder.decodeSingularBytesField(value: &_storage._paymentHash) + case 4: try decoder.decodeSingularInt32Field(value: &_storage._finalCltvDelta) + case 5: try decoder.decodeSingularStringField(value: &_storage._paymentRequest) + case 6: try decoder.decodeSingularInt32Field(value: &_storage._timeoutSeconds) + case 7: try decoder.decodeSingularInt64Field(value: &_storage._feeLimitSat) + case 8: try decoder.decodeSingularUInt64Field(value: &_storage._outgoingChanID) + case 9: try decoder.decodeSingularInt32Field(value: &_storage._cltvLimit) + case 10: try decoder.decodeRepeatedMessageField(value: &_storage._routeHints) + case 11: try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: &_storage._destCustomRecords) + case 12: try decoder.decodeSingularInt64Field(value: &_storage._amtMsat) + case 13: try decoder.decodeSingularInt64Field(value: &_storage._feeLimitMsat) + case 14: try decoder.decodeSingularBytesField(value: &_storage._lastHopPubkey) + case 15: try decoder.decodeSingularBoolField(value: &_storage._allowSelfPayment) + case 16: try decoder.decodeRepeatedEnumField(value: &_storage._destFeatures) + case 17: try decoder.decodeSingularUInt32Field(value: &_storage._maxParts) + case 18: try decoder.decodeSingularBoolField(value: &_storage._noInflightUpdates) + case 19: try decoder.decodeRepeatedUInt64Field(value: &_storage._outgoingChanIds) + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if !_storage._dest.isEmpty { + try visitor.visitSingularBytesField(value: _storage._dest, fieldNumber: 1) + } + if _storage._amt != 0 { + try visitor.visitSingularInt64Field(value: _storage._amt, fieldNumber: 2) + } + if !_storage._paymentHash.isEmpty { + try visitor.visitSingularBytesField(value: _storage._paymentHash, fieldNumber: 3) + } + if _storage._finalCltvDelta != 0 { + try visitor.visitSingularInt32Field(value: _storage._finalCltvDelta, fieldNumber: 4) + } + if !_storage._paymentRequest.isEmpty { + try visitor.visitSingularStringField(value: _storage._paymentRequest, fieldNumber: 5) + } + if _storage._timeoutSeconds != 0 { + try visitor.visitSingularInt32Field(value: _storage._timeoutSeconds, fieldNumber: 6) + } + if _storage._feeLimitSat != 0 { + try visitor.visitSingularInt64Field(value: _storage._feeLimitSat, fieldNumber: 7) + } + if _storage._outgoingChanID != 0 { + try visitor.visitSingularUInt64Field(value: _storage._outgoingChanID, fieldNumber: 8) + } + if _storage._cltvLimit != 0 { + try visitor.visitSingularInt32Field(value: _storage._cltvLimit, fieldNumber: 9) + } + if !_storage._routeHints.isEmpty { + try visitor.visitRepeatedMessageField(value: _storage._routeHints, fieldNumber: 10) + } + if !_storage._destCustomRecords.isEmpty { + try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: _storage._destCustomRecords, fieldNumber: 11) + } + if _storage._amtMsat != 0 { + try visitor.visitSingularInt64Field(value: _storage._amtMsat, fieldNumber: 12) + } + if _storage._feeLimitMsat != 0 { + try visitor.visitSingularInt64Field(value: _storage._feeLimitMsat, fieldNumber: 13) + } + if !_storage._lastHopPubkey.isEmpty { + try visitor.visitSingularBytesField(value: _storage._lastHopPubkey, fieldNumber: 14) + } + if _storage._allowSelfPayment != false { + try visitor.visitSingularBoolField(value: _storage._allowSelfPayment, fieldNumber: 15) + } + if !_storage._destFeatures.isEmpty { + try visitor.visitPackedEnumField(value: _storage._destFeatures, fieldNumber: 16) + } + if _storage._maxParts != 0 { + try visitor.visitSingularUInt32Field(value: _storage._maxParts, fieldNumber: 17) + } + if _storage._noInflightUpdates != false { + try visitor.visitSingularBoolField(value: _storage._noInflightUpdates, fieldNumber: 18) + } + if !_storage._outgoingChanIds.isEmpty { + try visitor.visitPackedUInt64Field(value: _storage._outgoingChanIds, fieldNumber: 19) + } + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Routerrpc_SendPaymentRequest, rhs: Routerrpc_SendPaymentRequest) -> Bool { + if lhs._storage !== rhs._storage { + let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let rhs_storage = _args.1 + if _storage._dest != rhs_storage._dest {return false} + if _storage._amt != rhs_storage._amt {return false} + if _storage._amtMsat != rhs_storage._amtMsat {return false} + if _storage._paymentHash != rhs_storage._paymentHash {return false} + if _storage._finalCltvDelta != rhs_storage._finalCltvDelta {return false} + if _storage._paymentRequest != rhs_storage._paymentRequest {return false} + if _storage._timeoutSeconds != rhs_storage._timeoutSeconds {return false} + if _storage._feeLimitSat != rhs_storage._feeLimitSat {return false} + if _storage._feeLimitMsat != rhs_storage._feeLimitMsat {return false} + if _storage._outgoingChanID != rhs_storage._outgoingChanID {return false} + if _storage._outgoingChanIds != rhs_storage._outgoingChanIds {return false} + if _storage._lastHopPubkey != rhs_storage._lastHopPubkey {return false} + if _storage._cltvLimit != rhs_storage._cltvLimit {return false} + if _storage._routeHints != rhs_storage._routeHints {return false} + if _storage._destCustomRecords != rhs_storage._destCustomRecords {return false} + if _storage._allowSelfPayment != rhs_storage._allowSelfPayment {return false} + if _storage._destFeatures != rhs_storage._destFeatures {return false} + if _storage._maxParts != rhs_storage._maxParts {return false} + if _storage._noInflightUpdates != rhs_storage._noInflightUpdates {return false} + return true + } + if !storagesAreEqual {return false} + } + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Routerrpc_TrackPaymentRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".TrackPaymentRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "payment_hash"), + 2: .standard(proto: "no_inflight_updates"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.paymentHash) + case 2: try decoder.decodeSingularBoolField(value: &self.noInflightUpdates) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.paymentHash.isEmpty { + try visitor.visitSingularBytesField(value: self.paymentHash, fieldNumber: 1) + } + if self.noInflightUpdates != false { + try visitor.visitSingularBoolField(value: self.noInflightUpdates, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Routerrpc_TrackPaymentRequest, rhs: Routerrpc_TrackPaymentRequest) -> Bool { + if lhs.paymentHash != rhs.paymentHash {return false} + if lhs.noInflightUpdates != rhs.noInflightUpdates {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Routerrpc_RouteFeeRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".RouteFeeRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "dest"), + 2: .standard(proto: "amt_sat"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.dest) + case 2: try decoder.decodeSingularInt64Field(value: &self.amtSat) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.dest.isEmpty { + try visitor.visitSingularBytesField(value: self.dest, fieldNumber: 1) + } + if self.amtSat != 0 { + try visitor.visitSingularInt64Field(value: self.amtSat, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Routerrpc_RouteFeeRequest, rhs: Routerrpc_RouteFeeRequest) -> Bool { + if lhs.dest != rhs.dest {return false} + if lhs.amtSat != rhs.amtSat {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Routerrpc_RouteFeeResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".RouteFeeResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "routing_fee_msat"), + 2: .standard(proto: "time_lock_delay"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularInt64Field(value: &self.routingFeeMsat) + case 2: try decoder.decodeSingularInt64Field(value: &self.timeLockDelay) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.routingFeeMsat != 0 { + try visitor.visitSingularInt64Field(value: self.routingFeeMsat, fieldNumber: 1) + } + if self.timeLockDelay != 0 { + try visitor.visitSingularInt64Field(value: self.timeLockDelay, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Routerrpc_RouteFeeResponse, rhs: Routerrpc_RouteFeeResponse) -> Bool { + if lhs.routingFeeMsat != rhs.routingFeeMsat {return false} + if lhs.timeLockDelay != rhs.timeLockDelay {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Routerrpc_SendToRouteRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SendToRouteRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "payment_hash"), + 2: .same(proto: "route"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.paymentHash) + case 2: try decoder.decodeSingularMessageField(value: &self._route) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.paymentHash.isEmpty { + try visitor.visitSingularBytesField(value: self.paymentHash, fieldNumber: 1) + } + if let v = self._route { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Routerrpc_SendToRouteRequest, rhs: Routerrpc_SendToRouteRequest) -> Bool { + if lhs.paymentHash != rhs.paymentHash {return false} + if lhs._route != rhs._route {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Routerrpc_SendToRouteResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SendToRouteResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "preimage"), + 2: .same(proto: "failure"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.preimage) + case 2: try decoder.decodeSingularMessageField(value: &self._failure) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.preimage.isEmpty { + try visitor.visitSingularBytesField(value: self.preimage, fieldNumber: 1) + } + if let v = self._failure { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Routerrpc_SendToRouteResponse, rhs: Routerrpc_SendToRouteResponse) -> Bool { + if lhs.preimage != rhs.preimage {return false} + if lhs._failure != rhs._failure {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Routerrpc_ResetMissionControlRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ResetMissionControlRequest" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Routerrpc_ResetMissionControlRequest, rhs: Routerrpc_ResetMissionControlRequest) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Routerrpc_ResetMissionControlResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ResetMissionControlResponse" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Routerrpc_ResetMissionControlResponse, rhs: Routerrpc_ResetMissionControlResponse) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Routerrpc_QueryMissionControlRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".QueryMissionControlRequest" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Routerrpc_QueryMissionControlRequest, rhs: Routerrpc_QueryMissionControlRequest) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Routerrpc_QueryMissionControlResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".QueryMissionControlResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 2: .same(proto: "pairs"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 2: try decoder.decodeRepeatedMessageField(value: &self.pairs) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.pairs.isEmpty { + try visitor.visitRepeatedMessageField(value: self.pairs, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Routerrpc_QueryMissionControlResponse, rhs: Routerrpc_QueryMissionControlResponse) -> Bool { + if lhs.pairs != rhs.pairs {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Routerrpc_PairHistory: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".PairHistory" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "node_from"), + 2: .standard(proto: "node_to"), + 7: .same(proto: "history"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.nodeFrom) + case 2: try decoder.decodeSingularBytesField(value: &self.nodeTo) + case 7: try decoder.decodeSingularMessageField(value: &self._history) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.nodeFrom.isEmpty { + try visitor.visitSingularBytesField(value: self.nodeFrom, fieldNumber: 1) + } + if !self.nodeTo.isEmpty { + try visitor.visitSingularBytesField(value: self.nodeTo, fieldNumber: 2) + } + if let v = self._history { + try visitor.visitSingularMessageField(value: v, fieldNumber: 7) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Routerrpc_PairHistory, rhs: Routerrpc_PairHistory) -> Bool { + if lhs.nodeFrom != rhs.nodeFrom {return false} + if lhs.nodeTo != rhs.nodeTo {return false} + if lhs._history != rhs._history {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Routerrpc_PairData: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".PairData" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "fail_time"), + 2: .standard(proto: "fail_amt_sat"), + 4: .standard(proto: "fail_amt_msat"), + 5: .standard(proto: "success_time"), + 6: .standard(proto: "success_amt_sat"), + 7: .standard(proto: "success_amt_msat"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularInt64Field(value: &self.failTime) + case 2: try decoder.decodeSingularInt64Field(value: &self.failAmtSat) + case 4: try decoder.decodeSingularInt64Field(value: &self.failAmtMsat) + case 5: try decoder.decodeSingularInt64Field(value: &self.successTime) + case 6: try decoder.decodeSingularInt64Field(value: &self.successAmtSat) + case 7: try decoder.decodeSingularInt64Field(value: &self.successAmtMsat) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.failTime != 0 { + try visitor.visitSingularInt64Field(value: self.failTime, fieldNumber: 1) + } + if self.failAmtSat != 0 { + try visitor.visitSingularInt64Field(value: self.failAmtSat, fieldNumber: 2) + } + if self.failAmtMsat != 0 { + try visitor.visitSingularInt64Field(value: self.failAmtMsat, fieldNumber: 4) + } + if self.successTime != 0 { + try visitor.visitSingularInt64Field(value: self.successTime, fieldNumber: 5) + } + if self.successAmtSat != 0 { + try visitor.visitSingularInt64Field(value: self.successAmtSat, fieldNumber: 6) + } + if self.successAmtMsat != 0 { + try visitor.visitSingularInt64Field(value: self.successAmtMsat, fieldNumber: 7) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Routerrpc_PairData, rhs: Routerrpc_PairData) -> Bool { + if lhs.failTime != rhs.failTime {return false} + if lhs.failAmtSat != rhs.failAmtSat {return false} + if lhs.failAmtMsat != rhs.failAmtMsat {return false} + if lhs.successTime != rhs.successTime {return false} + if lhs.successAmtSat != rhs.successAmtSat {return false} + if lhs.successAmtMsat != rhs.successAmtMsat {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Routerrpc_QueryProbabilityRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".QueryProbabilityRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "from_node"), + 2: .standard(proto: "to_node"), + 3: .standard(proto: "amt_msat"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.fromNode) + case 2: try decoder.decodeSingularBytesField(value: &self.toNode) + case 3: try decoder.decodeSingularInt64Field(value: &self.amtMsat) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.fromNode.isEmpty { + try visitor.visitSingularBytesField(value: self.fromNode, fieldNumber: 1) + } + if !self.toNode.isEmpty { + try visitor.visitSingularBytesField(value: self.toNode, fieldNumber: 2) + } + if self.amtMsat != 0 { + try visitor.visitSingularInt64Field(value: self.amtMsat, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Routerrpc_QueryProbabilityRequest, rhs: Routerrpc_QueryProbabilityRequest) -> Bool { + if lhs.fromNode != rhs.fromNode {return false} + if lhs.toNode != rhs.toNode {return false} + if lhs.amtMsat != rhs.amtMsat {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Routerrpc_QueryProbabilityResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".QueryProbabilityResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "probability"), + 2: .same(proto: "history"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularDoubleField(value: &self.probability) + case 2: try decoder.decodeSingularMessageField(value: &self._history) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.probability != 0 { + try visitor.visitSingularDoubleField(value: self.probability, fieldNumber: 1) + } + if let v = self._history { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Routerrpc_QueryProbabilityResponse, rhs: Routerrpc_QueryProbabilityResponse) -> Bool { + if lhs.probability != rhs.probability {return false} + if lhs._history != rhs._history {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Routerrpc_BuildRouteRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".BuildRouteRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "amt_msat"), + 2: .standard(proto: "final_cltv_delta"), + 3: .standard(proto: "outgoing_chan_id"), + 4: .standard(proto: "hop_pubkeys"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularInt64Field(value: &self.amtMsat) + case 2: try decoder.decodeSingularInt32Field(value: &self.finalCltvDelta) + case 3: try decoder.decodeSingularUInt64Field(value: &self.outgoingChanID) + case 4: try decoder.decodeRepeatedBytesField(value: &self.hopPubkeys) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.amtMsat != 0 { + try visitor.visitSingularInt64Field(value: self.amtMsat, fieldNumber: 1) + } + if self.finalCltvDelta != 0 { + try visitor.visitSingularInt32Field(value: self.finalCltvDelta, fieldNumber: 2) + } + if self.outgoingChanID != 0 { + try visitor.visitSingularUInt64Field(value: self.outgoingChanID, fieldNumber: 3) + } + if !self.hopPubkeys.isEmpty { + try visitor.visitRepeatedBytesField(value: self.hopPubkeys, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Routerrpc_BuildRouteRequest, rhs: Routerrpc_BuildRouteRequest) -> Bool { + if lhs.amtMsat != rhs.amtMsat {return false} + if lhs.finalCltvDelta != rhs.finalCltvDelta {return false} + if lhs.outgoingChanID != rhs.outgoingChanID {return false} + if lhs.hopPubkeys != rhs.hopPubkeys {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Routerrpc_BuildRouteResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".BuildRouteResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "route"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &self._route) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._route { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Routerrpc_BuildRouteResponse, rhs: Routerrpc_BuildRouteResponse) -> Bool { + if lhs._route != rhs._route {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Routerrpc_SubscribeHtlcEventsRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SubscribeHtlcEventsRequest" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Routerrpc_SubscribeHtlcEventsRequest, rhs: Routerrpc_SubscribeHtlcEventsRequest) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Routerrpc_HtlcEvent: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".HtlcEvent" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "incoming_channel_id"), + 2: .standard(proto: "outgoing_channel_id"), + 3: .standard(proto: "incoming_htlc_id"), + 4: .standard(proto: "outgoing_htlc_id"), + 5: .standard(proto: "timestamp_ns"), + 6: .standard(proto: "event_type"), + 7: .standard(proto: "forward_event"), + 8: .standard(proto: "forward_fail_event"), + 9: .standard(proto: "settle_event"), + 10: .standard(proto: "link_fail_event"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt64Field(value: &self.incomingChannelID) + case 2: try decoder.decodeSingularUInt64Field(value: &self.outgoingChannelID) + case 3: try decoder.decodeSingularUInt64Field(value: &self.incomingHtlcID) + case 4: try decoder.decodeSingularUInt64Field(value: &self.outgoingHtlcID) + case 5: try decoder.decodeSingularUInt64Field(value: &self.timestampNs) + case 6: try decoder.decodeSingularEnumField(value: &self.eventType) + case 7: + var v: Routerrpc_ForwardEvent? + if let current = self.event { + try decoder.handleConflictingOneOf() + if case .forwardEvent(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {self.event = .forwardEvent(v)} + case 8: + var v: Routerrpc_ForwardFailEvent? + if let current = self.event { + try decoder.handleConflictingOneOf() + if case .forwardFailEvent(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {self.event = .forwardFailEvent(v)} + case 9: + var v: Routerrpc_SettleEvent? + if let current = self.event { + try decoder.handleConflictingOneOf() + if case .settleEvent(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {self.event = .settleEvent(v)} + case 10: + var v: Routerrpc_LinkFailEvent? + if let current = self.event { + try decoder.handleConflictingOneOf() + if case .linkFailEvent(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {self.event = .linkFailEvent(v)} + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.incomingChannelID != 0 { + try visitor.visitSingularUInt64Field(value: self.incomingChannelID, fieldNumber: 1) + } + if self.outgoingChannelID != 0 { + try visitor.visitSingularUInt64Field(value: self.outgoingChannelID, fieldNumber: 2) + } + if self.incomingHtlcID != 0 { + try visitor.visitSingularUInt64Field(value: self.incomingHtlcID, fieldNumber: 3) + } + if self.outgoingHtlcID != 0 { + try visitor.visitSingularUInt64Field(value: self.outgoingHtlcID, fieldNumber: 4) + } + if self.timestampNs != 0 { + try visitor.visitSingularUInt64Field(value: self.timestampNs, fieldNumber: 5) + } + if self.eventType != .unknown { + try visitor.visitSingularEnumField(value: self.eventType, fieldNumber: 6) + } + switch self.event { + case .forwardEvent(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 7) + case .forwardFailEvent(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 8) + case .settleEvent(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 9) + case .linkFailEvent(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 10) + case nil: break + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Routerrpc_HtlcEvent, rhs: Routerrpc_HtlcEvent) -> Bool { + if lhs.incomingChannelID != rhs.incomingChannelID {return false} + if lhs.outgoingChannelID != rhs.outgoingChannelID {return false} + if lhs.incomingHtlcID != rhs.incomingHtlcID {return false} + if lhs.outgoingHtlcID != rhs.outgoingHtlcID {return false} + if lhs.timestampNs != rhs.timestampNs {return false} + if lhs.eventType != rhs.eventType {return false} + if lhs.event != rhs.event {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Routerrpc_HtlcEvent.EventType: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN"), + 1: .same(proto: "SEND"), + 2: .same(proto: "RECEIVE"), + 3: .same(proto: "FORWARD"), + ] +} + +extension Routerrpc_HtlcInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".HtlcInfo" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "incoming_timelock"), + 2: .standard(proto: "outgoing_timelock"), + 3: .standard(proto: "incoming_amt_msat"), + 4: .standard(proto: "outgoing_amt_msat"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt32Field(value: &self.incomingTimelock) + case 2: try decoder.decodeSingularUInt32Field(value: &self.outgoingTimelock) + case 3: try decoder.decodeSingularUInt64Field(value: &self.incomingAmtMsat) + case 4: try decoder.decodeSingularUInt64Field(value: &self.outgoingAmtMsat) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.incomingTimelock != 0 { + try visitor.visitSingularUInt32Field(value: self.incomingTimelock, fieldNumber: 1) + } + if self.outgoingTimelock != 0 { + try visitor.visitSingularUInt32Field(value: self.outgoingTimelock, fieldNumber: 2) + } + if self.incomingAmtMsat != 0 { + try visitor.visitSingularUInt64Field(value: self.incomingAmtMsat, fieldNumber: 3) + } + if self.outgoingAmtMsat != 0 { + try visitor.visitSingularUInt64Field(value: self.outgoingAmtMsat, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Routerrpc_HtlcInfo, rhs: Routerrpc_HtlcInfo) -> Bool { + if lhs.incomingTimelock != rhs.incomingTimelock {return false} + if lhs.outgoingTimelock != rhs.outgoingTimelock {return false} + if lhs.incomingAmtMsat != rhs.incomingAmtMsat {return false} + if lhs.outgoingAmtMsat != rhs.outgoingAmtMsat {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Routerrpc_ForwardEvent: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ForwardEvent" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "info"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &self._info) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._info { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Routerrpc_ForwardEvent, rhs: Routerrpc_ForwardEvent) -> Bool { + if lhs._info != rhs._info {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Routerrpc_ForwardFailEvent: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ForwardFailEvent" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Routerrpc_ForwardFailEvent, rhs: Routerrpc_ForwardFailEvent) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Routerrpc_SettleEvent: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SettleEvent" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Routerrpc_SettleEvent, rhs: Routerrpc_SettleEvent) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Routerrpc_LinkFailEvent: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".LinkFailEvent" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "info"), + 2: .standard(proto: "wire_failure"), + 3: .standard(proto: "failure_detail"), + 4: .standard(proto: "failure_string"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &self._info) + case 2: try decoder.decodeSingularEnumField(value: &self.wireFailure) + case 3: try decoder.decodeSingularEnumField(value: &self.failureDetail) + case 4: try decoder.decodeSingularStringField(value: &self.failureString) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._info { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + if self.wireFailure != .reserved { + try visitor.visitSingularEnumField(value: self.wireFailure, fieldNumber: 2) + } + if self.failureDetail != .unknown { + try visitor.visitSingularEnumField(value: self.failureDetail, fieldNumber: 3) + } + if !self.failureString.isEmpty { + try visitor.visitSingularStringField(value: self.failureString, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Routerrpc_LinkFailEvent, rhs: Routerrpc_LinkFailEvent) -> Bool { + if lhs._info != rhs._info {return false} + if lhs.wireFailure != rhs.wireFailure {return false} + if lhs.failureDetail != rhs.failureDetail {return false} + if lhs.failureString != rhs.failureString {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Routerrpc_PaymentStatus: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".PaymentStatus" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "state"), + 2: .same(proto: "preimage"), + 4: .same(proto: "htlcs"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularEnumField(value: &self.state) + case 2: try decoder.decodeSingularBytesField(value: &self.preimage) + case 4: try decoder.decodeRepeatedMessageField(value: &self.htlcs) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.state != .inFlight { + try visitor.visitSingularEnumField(value: self.state, fieldNumber: 1) + } + if !self.preimage.isEmpty { + try visitor.visitSingularBytesField(value: self.preimage, fieldNumber: 2) + } + if !self.htlcs.isEmpty { + try visitor.visitRepeatedMessageField(value: self.htlcs, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Routerrpc_PaymentStatus, rhs: Routerrpc_PaymentStatus) -> Bool { + if lhs.state != rhs.state {return false} + if lhs.preimage != rhs.preimage {return false} + if lhs.htlcs != rhs.htlcs {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Routerrpc_CircuitKey: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".CircuitKey" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "chan_id"), + 2: .standard(proto: "htlc_id"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt64Field(value: &self.chanID) + case 2: try decoder.decodeSingularUInt64Field(value: &self.htlcID) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.chanID != 0 { + try visitor.visitSingularUInt64Field(value: self.chanID, fieldNumber: 1) + } + if self.htlcID != 0 { + try visitor.visitSingularUInt64Field(value: self.htlcID, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Routerrpc_CircuitKey, rhs: Routerrpc_CircuitKey) -> Bool { + if lhs.chanID != rhs.chanID {return false} + if lhs.htlcID != rhs.htlcID {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Routerrpc_ForwardHtlcInterceptRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ForwardHtlcInterceptRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "incoming_circuit_key"), + 5: .standard(proto: "incoming_amount_msat"), + 6: .standard(proto: "incoming_expiry"), + 2: .standard(proto: "payment_hash"), + 7: .standard(proto: "outgoing_requested_chan_id"), + 3: .standard(proto: "outgoing_amount_msat"), + 4: .standard(proto: "outgoing_expiry"), + 8: .standard(proto: "custom_records"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &self._incomingCircuitKey) + case 2: try decoder.decodeSingularBytesField(value: &self.paymentHash) + case 3: try decoder.decodeSingularUInt64Field(value: &self.outgoingAmountMsat) + case 4: try decoder.decodeSingularUInt32Field(value: &self.outgoingExpiry) + case 5: try decoder.decodeSingularUInt64Field(value: &self.incomingAmountMsat) + case 6: try decoder.decodeSingularUInt32Field(value: &self.incomingExpiry) + case 7: try decoder.decodeSingularUInt64Field(value: &self.outgoingRequestedChanID) + case 8: try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: &self.customRecords) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._incomingCircuitKey { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + if !self.paymentHash.isEmpty { + try visitor.visitSingularBytesField(value: self.paymentHash, fieldNumber: 2) + } + if self.outgoingAmountMsat != 0 { + try visitor.visitSingularUInt64Field(value: self.outgoingAmountMsat, fieldNumber: 3) + } + if self.outgoingExpiry != 0 { + try visitor.visitSingularUInt32Field(value: self.outgoingExpiry, fieldNumber: 4) + } + if self.incomingAmountMsat != 0 { + try visitor.visitSingularUInt64Field(value: self.incomingAmountMsat, fieldNumber: 5) + } + if self.incomingExpiry != 0 { + try visitor.visitSingularUInt32Field(value: self.incomingExpiry, fieldNumber: 6) + } + if self.outgoingRequestedChanID != 0 { + try visitor.visitSingularUInt64Field(value: self.outgoingRequestedChanID, fieldNumber: 7) + } + if !self.customRecords.isEmpty { + try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: self.customRecords, fieldNumber: 8) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Routerrpc_ForwardHtlcInterceptRequest, rhs: Routerrpc_ForwardHtlcInterceptRequest) -> Bool { + if lhs._incomingCircuitKey != rhs._incomingCircuitKey {return false} + if lhs.incomingAmountMsat != rhs.incomingAmountMsat {return false} + if lhs.incomingExpiry != rhs.incomingExpiry {return false} + if lhs.paymentHash != rhs.paymentHash {return false} + if lhs.outgoingRequestedChanID != rhs.outgoingRequestedChanID {return false} + if lhs.outgoingAmountMsat != rhs.outgoingAmountMsat {return false} + if lhs.outgoingExpiry != rhs.outgoingExpiry {return false} + if lhs.customRecords != rhs.customRecords {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Routerrpc_ForwardHtlcInterceptResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ForwardHtlcInterceptResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "incoming_circuit_key"), + 2: .same(proto: "action"), + 3: .same(proto: "preimage"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &self._incomingCircuitKey) + case 2: try decoder.decodeSingularEnumField(value: &self.action) + case 3: try decoder.decodeSingularBytesField(value: &self.preimage) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._incomingCircuitKey { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + if self.action != .settle { + try visitor.visitSingularEnumField(value: self.action, fieldNumber: 2) + } + if !self.preimage.isEmpty { + try visitor.visitSingularBytesField(value: self.preimage, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Routerrpc_ForwardHtlcInterceptResponse, rhs: Routerrpc_ForwardHtlcInterceptResponse) -> Bool { + if lhs._incomingCircuitKey != rhs._incomingCircuitKey {return false} + if lhs.action != rhs.action {return false} + if lhs.preimage != rhs.preimage {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/wallet/Lightning/rpc/rpc.pb.swift b/wallet/Lightning/rpc/rpc.pb.swift new file mode 100644 index 0000000..a0bc690 --- /dev/null +++ b/wallet/Lightning/rpc/rpc.pb.swift @@ -0,0 +1,13584 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: rpc.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +import Foundation +import SwiftProtobuf + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +/// +///`AddressType` has to be one of: +/// +///- `p2wkh`: Pay to witness key hash (`WITNESS_PUBKEY_HASH` = 0) +///- `np2wkh`: Pay to nested witness key hash (`NESTED_PUBKEY_HASH` = 1) +enum Lnrpc_AddressType: SwiftProtobuf.Enum { + typealias RawValue = Int + case witnessPubkeyHash // = 0 + case nestedPubkeyHash // = 1 + case unusedWitnessPubkeyHash // = 2 + case unusedNestedPubkeyHash // = 3 + case UNRECOGNIZED(Int) + + init() { + self = .witnessPubkeyHash + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .witnessPubkeyHash + case 1: self = .nestedPubkeyHash + case 2: self = .unusedWitnessPubkeyHash + case 3: self = .unusedNestedPubkeyHash + default: self = .UNRECOGNIZED(rawValue) + } + } + + var rawValue: Int { + switch self { + case .witnessPubkeyHash: return 0 + case .nestedPubkeyHash: return 1 + case .unusedWitnessPubkeyHash: return 2 + case .unusedNestedPubkeyHash: return 3 + case .UNRECOGNIZED(let i): return i + } + } + +} + +#if swift(>=4.2) + +extension Lnrpc_AddressType: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static var allCases: [Lnrpc_AddressType] = [ + .witnessPubkeyHash, + .nestedPubkeyHash, + .unusedWitnessPubkeyHash, + .unusedNestedPubkeyHash, + ] +} + +#endif // swift(>=4.2) + +enum Lnrpc_CommitmentType: SwiftProtobuf.Enum { + typealias RawValue = Int + + /// + ///A channel using the legacy commitment format having tweaked to_remote + ///keys. + case legacy // = 0 + + /// + ///A channel that uses the modern commitment format where the key in the + ///output of the remote party does not change each state. This makes back + ///up and recovery easier as when the channel is closed, the funds go + ///directly to that key. + case staticRemoteKey // = 1 + + /// + ///A channel that uses a commitment format that has anchor outputs on the + ///commitments, allowing fee bumping after a force close transaction has + ///been broadcast. + case anchors // = 2 + + /// + ///Returned when the commitment type isn't known or unavailable. + case unknownCommitmentType // = 999 + case UNRECOGNIZED(Int) + + init() { + self = .legacy + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .legacy + case 1: self = .staticRemoteKey + case 2: self = .anchors + case 999: self = .unknownCommitmentType + default: self = .UNRECOGNIZED(rawValue) + } + } + + var rawValue: Int { + switch self { + case .legacy: return 0 + case .staticRemoteKey: return 1 + case .anchors: return 2 + case .unknownCommitmentType: return 999 + case .UNRECOGNIZED(let i): return i + } + } + +} + +#if swift(>=4.2) + +extension Lnrpc_CommitmentType: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static var allCases: [Lnrpc_CommitmentType] = [ + .legacy, + .staticRemoteKey, + .anchors, + .unknownCommitmentType, + ] +} + +#endif // swift(>=4.2) + +enum Lnrpc_Initiator: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknown // = 0 + case local // = 1 + case remote // = 2 + case both // = 3 + case UNRECOGNIZED(Int) + + init() { + self = .unknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknown + case 1: self = .local + case 2: self = .remote + case 3: self = .both + default: self = .UNRECOGNIZED(rawValue) + } + } + + var rawValue: Int { + switch self { + case .unknown: return 0 + case .local: return 1 + case .remote: return 2 + case .both: return 3 + case .UNRECOGNIZED(let i): return i + } + } + +} + +#if swift(>=4.2) + +extension Lnrpc_Initiator: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static var allCases: [Lnrpc_Initiator] = [ + .unknown, + .local, + .remote, + .both, + ] +} + +#endif // swift(>=4.2) + +enum Lnrpc_ResolutionType: SwiftProtobuf.Enum { + typealias RawValue = Int + case typeUnknown // = 0 + + /// We resolved an anchor output. + case anchor // = 1 + + /// + ///We are resolving an incoming htlc on chain. This if this htlc is + ///claimed, we swept the incoming htlc with the preimage. If it is timed + ///out, our peer swept the timeout path. + case incomingHtlc // = 2 + + /// + ///We are resolving an outgoing htlc on chain. If this htlc is claimed, + ///the remote party swept the htlc with the preimage. If it is timed out, + ///we swept it with the timeout path. + case outgoingHtlc // = 3 + + /// We force closed and need to sweep our time locked commitment output. + case commit // = 4 + case UNRECOGNIZED(Int) + + init() { + self = .typeUnknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .typeUnknown + case 1: self = .anchor + case 2: self = .incomingHtlc + case 3: self = .outgoingHtlc + case 4: self = .commit + default: self = .UNRECOGNIZED(rawValue) + } + } + + var rawValue: Int { + switch self { + case .typeUnknown: return 0 + case .anchor: return 1 + case .incomingHtlc: return 2 + case .outgoingHtlc: return 3 + case .commit: return 4 + case .UNRECOGNIZED(let i): return i + } + } + +} + +#if swift(>=4.2) + +extension Lnrpc_ResolutionType: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static var allCases: [Lnrpc_ResolutionType] = [ + .typeUnknown, + .anchor, + .incomingHtlc, + .outgoingHtlc, + .commit, + ] +} + +#endif // swift(>=4.2) + +enum Lnrpc_ResolutionOutcome: SwiftProtobuf.Enum { + typealias RawValue = Int + + /// Outcome unknown. + case outcomeUnknown // = 0 + + /// An output was claimed on chain. + case claimed // = 1 + + /// An output was left unclaimed on chain. + case unclaimed // = 2 + + /// + ///ResolverOutcomeAbandoned indicates that an output that we did not + ///claim on chain, for example an anchor that we did not sweep and a + ///third party claimed on chain, or a htlc that we could not decode + ///so left unclaimed. + case abandoned // = 3 + + /// + ///If we force closed our channel, our htlcs need to be claimed in two + ///stages. This outcome represents the broadcast of a timeout or success + ///transaction for this two stage htlc claim. + case firstStage // = 4 + + /// A htlc was timed out on chain. + case timeout // = 5 + case UNRECOGNIZED(Int) + + init() { + self = .outcomeUnknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .outcomeUnknown + case 1: self = .claimed + case 2: self = .unclaimed + case 3: self = .abandoned + case 4: self = .firstStage + case 5: self = .timeout + default: self = .UNRECOGNIZED(rawValue) + } + } + + var rawValue: Int { + switch self { + case .outcomeUnknown: return 0 + case .claimed: return 1 + case .unclaimed: return 2 + case .abandoned: return 3 + case .firstStage: return 4 + case .timeout: return 5 + case .UNRECOGNIZED(let i): return i + } + } + +} + +#if swift(>=4.2) + +extension Lnrpc_ResolutionOutcome: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static var allCases: [Lnrpc_ResolutionOutcome] = [ + .outcomeUnknown, + .claimed, + .unclaimed, + .abandoned, + .firstStage, + .timeout, + ] +} + +#endif // swift(>=4.2) + +enum Lnrpc_NodeMetricType: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknown // = 0 + case betweennessCentrality // = 1 + case UNRECOGNIZED(Int) + + init() { + self = .unknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknown + case 1: self = .betweennessCentrality + default: self = .UNRECOGNIZED(rawValue) + } + } + + var rawValue: Int { + switch self { + case .unknown: return 0 + case .betweennessCentrality: return 1 + case .UNRECOGNIZED(let i): return i + } + } + +} + +#if swift(>=4.2) + +extension Lnrpc_NodeMetricType: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static var allCases: [Lnrpc_NodeMetricType] = [ + .unknown, + .betweennessCentrality, + ] +} + +#endif // swift(>=4.2) + +enum Lnrpc_InvoiceHTLCState: SwiftProtobuf.Enum { + typealias RawValue = Int + case accepted // = 0 + case settled // = 1 + case canceled // = 2 + case UNRECOGNIZED(Int) + + init() { + self = .accepted + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .accepted + case 1: self = .settled + case 2: self = .canceled + default: self = .UNRECOGNIZED(rawValue) + } + } + + var rawValue: Int { + switch self { + case .accepted: return 0 + case .settled: return 1 + case .canceled: return 2 + case .UNRECOGNIZED(let i): return i + } + } + +} + +#if swift(>=4.2) + +extension Lnrpc_InvoiceHTLCState: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static var allCases: [Lnrpc_InvoiceHTLCState] = [ + .accepted, + .settled, + .canceled, + ] +} + +#endif // swift(>=4.2) + +enum Lnrpc_PaymentFailureReason: SwiftProtobuf.Enum { + typealias RawValue = Int + + /// + ///Payment isn't failed (yet). + case failureReasonNone // = 0 + + /// + ///There are more routes to try, but the payment timeout was exceeded. + case failureReasonTimeout // = 1 + + /// + ///All possible routes were tried and failed permanently. Or were no + ///routes to the destination at all. + case failureReasonNoRoute // = 2 + + /// + ///A non-recoverable error has occured. + case failureReasonError // = 3 + + /// + ///Payment details incorrect (unknown hash, invalid amt or + ///invalid final cltv delta) + case failureReasonIncorrectPaymentDetails // = 4 + + /// + ///Insufficient local balance. + case failureReasonInsufficientBalance // = 5 + case UNRECOGNIZED(Int) + + init() { + self = .failureReasonNone + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .failureReasonNone + case 1: self = .failureReasonTimeout + case 2: self = .failureReasonNoRoute + case 3: self = .failureReasonError + case 4: self = .failureReasonIncorrectPaymentDetails + case 5: self = .failureReasonInsufficientBalance + default: self = .UNRECOGNIZED(rawValue) + } + } + + var rawValue: Int { + switch self { + case .failureReasonNone: return 0 + case .failureReasonTimeout: return 1 + case .failureReasonNoRoute: return 2 + case .failureReasonError: return 3 + case .failureReasonIncorrectPaymentDetails: return 4 + case .failureReasonInsufficientBalance: return 5 + case .UNRECOGNIZED(let i): return i + } + } + +} + +#if swift(>=4.2) + +extension Lnrpc_PaymentFailureReason: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static var allCases: [Lnrpc_PaymentFailureReason] = [ + .failureReasonNone, + .failureReasonTimeout, + .failureReasonNoRoute, + .failureReasonError, + .failureReasonIncorrectPaymentDetails, + .failureReasonInsufficientBalance, + ] +} + +#endif // swift(>=4.2) + +enum Lnrpc_FeatureBit: SwiftProtobuf.Enum { + typealias RawValue = Int + case datalossProtectReq // = 0 + case datalossProtectOpt // = 1 + case initialRouingSync // = 3 + case upfrontShutdownScriptReq // = 4 + case upfrontShutdownScriptOpt // = 5 + case gossipQueriesReq // = 6 + case gossipQueriesOpt // = 7 + case tlvOnionReq // = 8 + case tlvOnionOpt // = 9 + case extGossipQueriesReq // = 10 + case extGossipQueriesOpt // = 11 + case staticRemoteKeyReq // = 12 + case staticRemoteKeyOpt // = 13 + case paymentAddrReq // = 14 + case paymentAddrOpt // = 15 + case mppReq // = 16 + case mppOpt // = 17 + case UNRECOGNIZED(Int) + + init() { + self = .datalossProtectReq + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .datalossProtectReq + case 1: self = .datalossProtectOpt + case 3: self = .initialRouingSync + case 4: self = .upfrontShutdownScriptReq + case 5: self = .upfrontShutdownScriptOpt + case 6: self = .gossipQueriesReq + case 7: self = .gossipQueriesOpt + case 8: self = .tlvOnionReq + case 9: self = .tlvOnionOpt + case 10: self = .extGossipQueriesReq + case 11: self = .extGossipQueriesOpt + case 12: self = .staticRemoteKeyReq + case 13: self = .staticRemoteKeyOpt + case 14: self = .paymentAddrReq + case 15: self = .paymentAddrOpt + case 16: self = .mppReq + case 17: self = .mppOpt + default: self = .UNRECOGNIZED(rawValue) + } + } + + var rawValue: Int { + switch self { + case .datalossProtectReq: return 0 + case .datalossProtectOpt: return 1 + case .initialRouingSync: return 3 + case .upfrontShutdownScriptReq: return 4 + case .upfrontShutdownScriptOpt: return 5 + case .gossipQueriesReq: return 6 + case .gossipQueriesOpt: return 7 + case .tlvOnionReq: return 8 + case .tlvOnionOpt: return 9 + case .extGossipQueriesReq: return 10 + case .extGossipQueriesOpt: return 11 + case .staticRemoteKeyReq: return 12 + case .staticRemoteKeyOpt: return 13 + case .paymentAddrReq: return 14 + case .paymentAddrOpt: return 15 + case .mppReq: return 16 + case .mppOpt: return 17 + case .UNRECOGNIZED(let i): return i + } + } + +} + +#if swift(>=4.2) + +extension Lnrpc_FeatureBit: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static var allCases: [Lnrpc_FeatureBit] = [ + .datalossProtectReq, + .datalossProtectOpt, + .initialRouingSync, + .upfrontShutdownScriptReq, + .upfrontShutdownScriptOpt, + .gossipQueriesReq, + .gossipQueriesOpt, + .tlvOnionReq, + .tlvOnionOpt, + .extGossipQueriesReq, + .extGossipQueriesOpt, + .staticRemoteKeyReq, + .staticRemoteKeyOpt, + .paymentAddrReq, + .paymentAddrOpt, + .mppReq, + .mppOpt, + ] +} + +#endif // swift(>=4.2) + +struct Lnrpc_Utxo { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The type of address + var addressType: Lnrpc_AddressType = .witnessPubkeyHash + + /// The address + var address: String = String() + + /// The value of the unspent coin in satoshis + var amountSat: Int64 = 0 + + /// The pkscript in hex + var pkScript: String = String() + + /// The outpoint in format txid:n + var outpoint: Lnrpc_OutPoint { + get {return _outpoint ?? Lnrpc_OutPoint()} + set {_outpoint = newValue} + } + /// Returns true if `outpoint` has been explicitly set. + var hasOutpoint: Bool {return self._outpoint != nil} + /// Clears the value of `outpoint`. Subsequent reads from it will return its default value. + mutating func clearOutpoint() {self._outpoint = nil} + + /// The number of confirmations for the Utxo + var confirmations: Int64 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _outpoint: Lnrpc_OutPoint? = nil +} + +struct Lnrpc_Transaction { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The transaction hash + var txHash: String = String() + + /// The transaction amount, denominated in satoshis + var amount: Int64 = 0 + + /// The number of confirmations + var numConfirmations: Int32 = 0 + + /// The hash of the block this transaction was included in + var blockHash: String = String() + + /// The height of the block this transaction was included in + var blockHeight: Int32 = 0 + + /// Timestamp of this transaction + var timeStamp: Int64 = 0 + + /// Fees paid for this transaction + var totalFees: Int64 = 0 + + /// Addresses that received funds for this transaction + var destAddresses: [String] = [] + + /// The raw transaction hex. + var rawTxHex: String = String() + + /// A label that was optionally set on transaction broadcast. + var label: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_GetTransactionsRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The height from which to list transactions, inclusive. If this value is + ///greater than end_height, transactions will be read in reverse. + var startHeight: Int32 = 0 + + /// + ///The height until which to list transactions, inclusive. To include + ///unconfirmed transactions, this value should be set to -1, which will + ///return transactions from start_height until the current chain tip and + ///unconfirmed transactions. If no end_height is provided, the call will + ///default to this option. + var endHeight: Int32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_TransactionDetails { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The list of transactions relevant to the wallet. + var transactions: [Lnrpc_Transaction] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_FeeLimit { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var limit: Lnrpc_FeeLimit.OneOf_Limit? = nil + + /// + ///The fee limit expressed as a fixed amount of satoshis. + /// + ///The fields fixed and fixed_msat are mutually exclusive. + var fixed: Int64 { + get { + if case .fixed(let v)? = limit {return v} + return 0 + } + set {limit = .fixed(newValue)} + } + + /// + ///The fee limit expressed as a fixed amount of millisatoshis. + /// + ///The fields fixed and fixed_msat are mutually exclusive. + var fixedMsat: Int64 { + get { + if case .fixedMsat(let v)? = limit {return v} + return 0 + } + set {limit = .fixedMsat(newValue)} + } + + /// The fee limit expressed as a percentage of the payment amount. + var percent: Int64 { + get { + if case .percent(let v)? = limit {return v} + return 0 + } + set {limit = .percent(newValue)} + } + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum OneOf_Limit: Equatable { + /// + ///The fee limit expressed as a fixed amount of satoshis. + /// + ///The fields fixed and fixed_msat are mutually exclusive. + case fixed(Int64) + /// + ///The fee limit expressed as a fixed amount of millisatoshis. + /// + ///The fields fixed and fixed_msat are mutually exclusive. + case fixedMsat(Int64) + /// The fee limit expressed as a percentage of the payment amount. + case percent(Int64) + + #if !swift(>=4.1) + static func ==(lhs: Lnrpc_FeeLimit.OneOf_Limit, rhs: Lnrpc_FeeLimit.OneOf_Limit) -> Bool { + switch (lhs, rhs) { + case (.fixed(let l), .fixed(let r)): return l == r + case (.fixedMsat(let l), .fixedMsat(let r)): return l == r + case (.percent(let l), .percent(let r)): return l == r + default: return false + } + } + #endif + } + + init() {} +} + +struct Lnrpc_SendRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The identity pubkey of the payment recipient. When using REST, this field + ///must be encoded as base64. + var dest: Data = SwiftProtobuf.Internal.emptyData + + /// + ///The hex-encoded identity pubkey of the payment recipient. Deprecated now + ///that the REST gateway supports base64 encoding of bytes fields. + var destString: String = String() + + /// + ///The amount to send expressed in satoshis. + /// + ///The fields amt and amt_msat are mutually exclusive. + var amt: Int64 = 0 + + /// + ///The amount to send expressed in millisatoshis. + /// + ///The fields amt and amt_msat are mutually exclusive. + var amtMsat: Int64 = 0 + + /// + ///The hash to use within the payment's HTLC. When using REST, this field + ///must be encoded as base64. + var paymentHash: Data = SwiftProtobuf.Internal.emptyData + + /// + ///The hex-encoded hash to use within the payment's HTLC. Deprecated now + ///that the REST gateway supports base64 encoding of bytes fields. + var paymentHashString: String = String() + + /// + ///A bare-bones invoice for a payment within the Lightning Network. With the + ///details of the invoice, the sender has all the data necessary to send a + ///payment to the recipient. + var paymentRequest: String = String() + + /// + ///The CLTV delta from the current height that should be used to set the + ///timelock for the final hop. + var finalCltvDelta: Int32 = 0 + + /// + ///The maximum number of satoshis that will be paid as a fee of the payment. + ///This value can be represented either as a percentage of the amount being + ///sent, or as a fixed amount of the maximum fee the user is willing the pay to + ///send the payment. + var feeLimit: Lnrpc_FeeLimit { + get {return _feeLimit ?? Lnrpc_FeeLimit()} + set {_feeLimit = newValue} + } + /// Returns true if `feeLimit` has been explicitly set. + var hasFeeLimit: Bool {return self._feeLimit != nil} + /// Clears the value of `feeLimit`. Subsequent reads from it will return its default value. + mutating func clearFeeLimit() {self._feeLimit = nil} + + /// + ///The channel id of the channel that must be taken to the first hop. If zero, + ///any channel may be used. + var outgoingChanID: UInt64 = 0 + + /// + ///The pubkey of the last hop of the route. If empty, any hop may be used. + var lastHopPubkey: Data = SwiftProtobuf.Internal.emptyData + + /// + ///An optional maximum total time lock for the route. This should not exceed + ///lnd's `--max-cltv-expiry` setting. If zero, then the value of + ///`--max-cltv-expiry` is enforced. + var cltvLimit: UInt32 = 0 + + /// + ///An optional field that can be used to pass an arbitrary set of TLV records + ///to a peer which understands the new records. This can be used to pass + ///application specific data during the payment attempt. Record types are + ///required to be in the custom range >= 65536. When using REST, the values + ///must be encoded as base64. + var destCustomRecords: Dictionary = [:] + + /// If set, circular payments to self are permitted. + var allowSelfPayment: Bool = false + + /// + ///Features assumed to be supported by the final node. All transitive feature + ///dependencies must also be set properly. For a given feature bit pair, either + ///optional or remote may be set, but not both. If this field is nil or empty, + ///the router will try to load destination features from the graph as a + ///fallback. + var destFeatures: [Lnrpc_FeatureBit] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _feeLimit: Lnrpc_FeeLimit? = nil +} + +struct Lnrpc_SendResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var paymentError: String = String() + + var paymentPreimage: Data = SwiftProtobuf.Internal.emptyData + + var paymentRoute: Lnrpc_Route { + get {return _paymentRoute ?? Lnrpc_Route()} + set {_paymentRoute = newValue} + } + /// Returns true if `paymentRoute` has been explicitly set. + var hasPaymentRoute: Bool {return self._paymentRoute != nil} + /// Clears the value of `paymentRoute`. Subsequent reads from it will return its default value. + mutating func clearPaymentRoute() {self._paymentRoute = nil} + + var paymentHash: Data = SwiftProtobuf.Internal.emptyData + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _paymentRoute: Lnrpc_Route? = nil +} + +struct Lnrpc_SendToRouteRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The payment hash to use for the HTLC. When using REST, this field must be + ///encoded as base64. + var paymentHash: Data = SwiftProtobuf.Internal.emptyData + + /// + ///An optional hex-encoded payment hash to be used for the HTLC. Deprecated now + ///that the REST gateway supports base64 encoding of bytes fields. + var paymentHashString: String = String() + + /// Route that should be used to attempt to complete the payment. + var route: Lnrpc_Route { + get {return _route ?? Lnrpc_Route()} + set {_route = newValue} + } + /// Returns true if `route` has been explicitly set. + var hasRoute: Bool {return self._route != nil} + /// Clears the value of `route`. Subsequent reads from it will return its default value. + mutating func clearRoute() {self._route = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _route: Lnrpc_Route? = nil +} + +struct Lnrpc_ChannelAcceptRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The pubkey of the node that wishes to open an inbound channel. + var nodePubkey: Data = SwiftProtobuf.Internal.emptyData + + /// The hash of the genesis block that the proposed channel resides in. + var chainHash: Data = SwiftProtobuf.Internal.emptyData + + /// The pending channel id. + var pendingChanID: Data = SwiftProtobuf.Internal.emptyData + + /// The funding amount in satoshis that initiator wishes to use in the + /// channel. + var fundingAmt: UInt64 = 0 + + /// The push amount of the proposed channel in millisatoshis. + var pushAmt: UInt64 = 0 + + /// The dust limit of the initiator's commitment tx. + var dustLimit: UInt64 = 0 + + /// The maximum amount of coins in millisatoshis that can be pending in this + /// channel. + var maxValueInFlight: UInt64 = 0 + + /// The minimum amount of satoshis the initiator requires us to have at all + /// times. + var channelReserve: UInt64 = 0 + + /// The smallest HTLC in millisatoshis that the initiator will accept. + var minHtlc: UInt64 = 0 + + /// The initial fee rate that the initiator suggests for both commitment + /// transactions. + var feePerKw: UInt64 = 0 + + /// + ///The number of blocks to use for the relative time lock in the pay-to-self + ///output of both commitment transactions. + var csvDelay: UInt32 = 0 + + /// The total number of incoming HTLC's that the initiator will accept. + var maxAcceptedHtlcs: UInt32 = 0 + + /// A bit-field which the initiator uses to specify proposed channel + /// behavior. + var channelFlags: UInt32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_ChannelAcceptResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Whether or not the client accepts the channel. + var accept: Bool = false + + /// The pending channel id to which this response applies. + var pendingChanID: Data = SwiftProtobuf.Internal.emptyData + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_ChannelPoint { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var fundingTxid: Lnrpc_ChannelPoint.OneOf_FundingTxid? = nil + + /// + ///Txid of the funding transaction. When using REST, this field must be + ///encoded as base64. + var fundingTxidBytes: Data { + get { + if case .fundingTxidBytes(let v)? = fundingTxid {return v} + return SwiftProtobuf.Internal.emptyData + } + set {fundingTxid = .fundingTxidBytes(newValue)} + } + + /// + ///Hex-encoded string representing the byte-reversed hash of the funding + ///transaction. + var fundingTxidStr: String { + get { + if case .fundingTxidStr(let v)? = fundingTxid {return v} + return String() + } + set {fundingTxid = .fundingTxidStr(newValue)} + } + + /// The index of the output of the funding transaction + var outputIndex: UInt32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum OneOf_FundingTxid: Equatable { + /// + ///Txid of the funding transaction. When using REST, this field must be + ///encoded as base64. + case fundingTxidBytes(Data) + /// + ///Hex-encoded string representing the byte-reversed hash of the funding + ///transaction. + case fundingTxidStr(String) + + #if !swift(>=4.1) + static func ==(lhs: Lnrpc_ChannelPoint.OneOf_FundingTxid, rhs: Lnrpc_ChannelPoint.OneOf_FundingTxid) -> Bool { + switch (lhs, rhs) { + case (.fundingTxidBytes(let l), .fundingTxidBytes(let r)): return l == r + case (.fundingTxidStr(let l), .fundingTxidStr(let r)): return l == r + default: return false + } + } + #endif + } + + init() {} +} + +struct Lnrpc_OutPoint { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Raw bytes representing the transaction id. + var txidBytes: Data = SwiftProtobuf.Internal.emptyData + + /// Reversed, hex-encoded string representing the transaction id. + var txidStr: String = String() + + /// The index of the output on the transaction. + var outputIndex: UInt32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_LightningAddress { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The identity pubkey of the Lightning node + var pubkey: String = String() + + /// The network location of the lightning node, e.g. `69.69.69.69:1337` or + /// `localhost:10011` + var host: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_EstimateFeeRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The map from addresses to amounts for the transaction. + var addrToAmount: Dictionary = [:] + + /// The target number of blocks that this transaction should be confirmed + /// by. + var targetConf: Int32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_EstimateFeeResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The total fee in satoshis. + var feeSat: Int64 = 0 + + /// The fee rate in satoshi/byte. + var feerateSatPerByte: Int64 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_SendManyRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The map from addresses to amounts + var addrToAmount: Dictionary = [:] + + /// The target number of blocks that this transaction should be confirmed + /// by. + var targetConf: Int32 = 0 + + /// A manual fee rate set in sat/byte that should be used when crafting the + /// transaction. + var satPerByte: Int64 = 0 + + /// An optional label for the transaction, limited to 500 characters. + var label: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_SendManyResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The id of the transaction + var txid: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_SendCoinsRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The address to send coins to + var addr: String = String() + + /// The amount in satoshis to send + var amount: Int64 = 0 + + /// The target number of blocks that this transaction should be confirmed + /// by. + var targetConf: Int32 = 0 + + /// A manual fee rate set in sat/byte that should be used when crafting the + /// transaction. + var satPerByte: Int64 = 0 + + /// + ///If set, then the amount field will be ignored, and lnd will attempt to + ///send all the coins under control of the internal wallet to the specified + ///address. + var sendAll: Bool = false + + /// An optional label for the transaction, limited to 500 characters. + var label: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_SendCoinsResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The transaction ID of the transaction + var txid: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_ListUnspentRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The minimum number of confirmations to be included. + var minConfs: Int32 = 0 + + /// The maximum number of confirmations to be included. + var maxConfs: Int32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_ListUnspentResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// A list of utxos + var utxos: [Lnrpc_Utxo] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_NewAddressRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The address type + var type: Lnrpc_AddressType = .witnessPubkeyHash + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_NewAddressResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The newly generated wallet address + var address: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_SignMessageRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The message to be signed. When using REST, this field must be encoded as + ///base64. + var msg: Data = SwiftProtobuf.Internal.emptyData + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_SignMessageResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The signature for the given message + var signature: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_VerifyMessageRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The message over which the signature is to be verified. When using REST, + ///this field must be encoded as base64. + var msg: Data = SwiftProtobuf.Internal.emptyData + + /// The signature to be verified over the given message + var signature: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_VerifyMessageResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Whether the signature was valid over the given message + var valid: Bool = false + + /// The pubkey recovered from the signature + var pubkey: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_ConnectPeerRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Lightning address of the peer, in the format `@host` + var addr: Lnrpc_LightningAddress { + get {return _addr ?? Lnrpc_LightningAddress()} + set {_addr = newValue} + } + /// Returns true if `addr` has been explicitly set. + var hasAddr: Bool {return self._addr != nil} + /// Clears the value of `addr`. Subsequent reads from it will return its default value. + mutating func clearAddr() {self._addr = nil} + + /// If set, the daemon will attempt to persistently connect to the target + /// peer. Otherwise, the call will be synchronous. + var perm: Bool = false + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _addr: Lnrpc_LightningAddress? = nil +} + +struct Lnrpc_ConnectPeerResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_DisconnectPeerRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The pubkey of the node to disconnect from + var pubKey: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_DisconnectPeerResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_HTLC { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var incoming: Bool = false + + var amount: Int64 = 0 + + var hashLock: Data = SwiftProtobuf.Internal.emptyData + + var expirationHeight: UInt32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_ChannelConstraints { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The CSV delay expressed in relative blocks. If the channel is force closed, + ///we will need to wait for this many blocks before we can regain our funds. + var csvDelay: UInt32 = 0 + + /// The minimum satoshis this node is required to reserve in its balance. + var chanReserveSat: UInt64 = 0 + + /// The dust limit (in satoshis) of the initiator's commitment tx. + var dustLimitSat: UInt64 = 0 + + /// The maximum amount of coins in millisatoshis that can be pending in this + /// channel. + var maxPendingAmtMsat: UInt64 = 0 + + /// The smallest HTLC in millisatoshis that the initiator will accept. + var minHtlcMsat: UInt64 = 0 + + /// The total number of incoming HTLC's that the initiator will accept. + var maxAcceptedHtlcs: UInt32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_Channel { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Whether this channel is active or not + var active: Bool { + get {return _storage._active} + set {_uniqueStorage()._active = newValue} + } + + /// The identity pubkey of the remote node + var remotePubkey: String { + get {return _storage._remotePubkey} + set {_uniqueStorage()._remotePubkey = newValue} + } + + /// + ///The outpoint (txid:index) of the funding transaction. With this value, Bob + ///will be able to generate a signature for Alice's version of the commitment + ///transaction. + var channelPoint: String { + get {return _storage._channelPoint} + set {_uniqueStorage()._channelPoint = newValue} + } + + /// + ///The unique channel ID for the channel. The first 3 bytes are the block + ///height, the next 3 the index within the block, and the last 2 bytes are the + ///output index for the channel. + var chanID: UInt64 { + get {return _storage._chanID} + set {_uniqueStorage()._chanID = newValue} + } + + /// The total amount of funds held in this channel + var capacity: Int64 { + get {return _storage._capacity} + set {_uniqueStorage()._capacity = newValue} + } + + /// This node's current balance in this channel + var localBalance: Int64 { + get {return _storage._localBalance} + set {_uniqueStorage()._localBalance = newValue} + } + + /// The counterparty's current balance in this channel + var remoteBalance: Int64 { + get {return _storage._remoteBalance} + set {_uniqueStorage()._remoteBalance = newValue} + } + + /// + ///The amount calculated to be paid in fees for the current set of commitment + ///transactions. The fee amount is persisted with the channel in order to + ///allow the fee amount to be removed and recalculated with each channel state + ///update, including updates that happen after a system restart. + var commitFee: Int64 { + get {return _storage._commitFee} + set {_uniqueStorage()._commitFee = newValue} + } + + /// The weight of the commitment transaction + var commitWeight: Int64 { + get {return _storage._commitWeight} + set {_uniqueStorage()._commitWeight = newValue} + } + + /// + ///The required number of satoshis per kilo-weight that the requester will pay + ///at all times, for both the funding transaction and commitment transaction. + ///This value can later be updated once the channel is open. + var feePerKw: Int64 { + get {return _storage._feePerKw} + set {_uniqueStorage()._feePerKw = newValue} + } + + /// The unsettled balance in this channel + var unsettledBalance: Int64 { + get {return _storage._unsettledBalance} + set {_uniqueStorage()._unsettledBalance = newValue} + } + + /// + ///The total number of satoshis we've sent within this channel. + var totalSatoshisSent: Int64 { + get {return _storage._totalSatoshisSent} + set {_uniqueStorage()._totalSatoshisSent = newValue} + } + + /// + ///The total number of satoshis we've received within this channel. + var totalSatoshisReceived: Int64 { + get {return _storage._totalSatoshisReceived} + set {_uniqueStorage()._totalSatoshisReceived = newValue} + } + + /// + ///The total number of updates conducted within this channel. + var numUpdates: UInt64 { + get {return _storage._numUpdates} + set {_uniqueStorage()._numUpdates = newValue} + } + + /// + ///The list of active, uncleared HTLCs currently pending within the channel. + var pendingHtlcs: [Lnrpc_HTLC] { + get {return _storage._pendingHtlcs} + set {_uniqueStorage()._pendingHtlcs = newValue} + } + + /// + ///Deprecated. The CSV delay expressed in relative blocks. If the channel is + ///force closed, we will need to wait for this many blocks before we can regain + ///our funds. + var csvDelay: UInt32 { + get {return _storage._csvDelay} + set {_uniqueStorage()._csvDelay = newValue} + } + + /// Whether this channel is advertised to the network or not. + var `private`: Bool { + get {return _storage._private} + set {_uniqueStorage()._private = newValue} + } + + /// True if we were the ones that created the channel. + var initiator: Bool { + get {return _storage._initiator} + set {_uniqueStorage()._initiator = newValue} + } + + /// A set of flags showing the current state of the channel. + var chanStatusFlags: String { + get {return _storage._chanStatusFlags} + set {_uniqueStorage()._chanStatusFlags = newValue} + } + + /// Deprecated. The minimum satoshis this node is required to reserve in its + /// balance. + var localChanReserveSat: Int64 { + get {return _storage._localChanReserveSat} + set {_uniqueStorage()._localChanReserveSat = newValue} + } + + /// + ///Deprecated. The minimum satoshis the other node is required to reserve in + ///its balance. + var remoteChanReserveSat: Int64 { + get {return _storage._remoteChanReserveSat} + set {_uniqueStorage()._remoteChanReserveSat = newValue} + } + + /// Deprecated. Use commitment_type. + var staticRemoteKey: Bool { + get {return _storage._staticRemoteKey} + set {_uniqueStorage()._staticRemoteKey = newValue} + } + + /// The commitment type used by this channel. + var commitmentType: Lnrpc_CommitmentType { + get {return _storage._commitmentType} + set {_uniqueStorage()._commitmentType = newValue} + } + + /// + ///The number of seconds that the channel has been monitored by the channel + ///scoring system. Scores are currently not persisted, so this value may be + ///less than the lifetime of the channel [EXPERIMENTAL]. + var lifetime: Int64 { + get {return _storage._lifetime} + set {_uniqueStorage()._lifetime = newValue} + } + + /// + ///The number of seconds that the remote peer has been observed as being online + ///by the channel scoring system over the lifetime of the channel + ///[EXPERIMENTAL]. + var uptime: Int64 { + get {return _storage._uptime} + set {_uniqueStorage()._uptime = newValue} + } + + /// + ///Close address is the address that we will enforce payout to on cooperative + ///close if the channel was opened utilizing option upfront shutdown. This + ///value can be set on channel open by setting close_address in an open channel + ///request. If this value is not set, you can still choose a payout address by + ///cooperatively closing with the delivery_address field set. + var closeAddress: String { + get {return _storage._closeAddress} + set {_uniqueStorage()._closeAddress = newValue} + } + + /// + ///The amount that the initiator of the channel optionally pushed to the remote + ///party on channel open. This amount will be zero if the channel initiator did + ///not push any funds to the remote peer. If the initiator field is true, we + ///pushed this amount to our peer, if it is false, the remote peer pushed this + ///amount to us. + var pushAmountSat: UInt64 { + get {return _storage._pushAmountSat} + set {_uniqueStorage()._pushAmountSat = newValue} + } + + /// + ///This uint32 indicates if this channel is to be considered 'frozen'. A + ///frozen channel doest not allow a cooperative channel close by the + ///initiator. The thaw_height is the height that this restriction stops + ///applying to the channel. This field is optional, not setting it or using a + ///value of zero will mean the channel has no additional restrictions. The + ///height can be interpreted in two ways: as a relative height if the value is + ///less than 500,000, or as an absolute height otherwise. + var thawHeight: UInt32 { + get {return _storage._thawHeight} + set {_uniqueStorage()._thawHeight = newValue} + } + + /// List constraints for the local node. + var localConstraints: Lnrpc_ChannelConstraints { + get {return _storage._localConstraints ?? Lnrpc_ChannelConstraints()} + set {_uniqueStorage()._localConstraints = newValue} + } + /// Returns true if `localConstraints` has been explicitly set. + var hasLocalConstraints: Bool {return _storage._localConstraints != nil} + /// Clears the value of `localConstraints`. Subsequent reads from it will return its default value. + mutating func clearLocalConstraints() {_uniqueStorage()._localConstraints = nil} + + /// List constraints for the remote node. + var remoteConstraints: Lnrpc_ChannelConstraints { + get {return _storage._remoteConstraints ?? Lnrpc_ChannelConstraints()} + set {_uniqueStorage()._remoteConstraints = newValue} + } + /// Returns true if `remoteConstraints` has been explicitly set. + var hasRemoteConstraints: Bool {return _storage._remoteConstraints != nil} + /// Clears the value of `remoteConstraints`. Subsequent reads from it will return its default value. + mutating func clearRemoteConstraints() {_uniqueStorage()._remoteConstraints = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _storage = _StorageClass.defaultInstance +} + +struct Lnrpc_ListChannelsRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var activeOnly: Bool = false + + var inactiveOnly: Bool = false + + var publicOnly: Bool = false + + var privateOnly: Bool = false + + /// + ///Filters the response for channels with a target peer's pubkey. If peer is + ///empty, all channels will be returned. + var peer: Data = SwiftProtobuf.Internal.emptyData + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_ListChannelsResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The list of active channels + var channels: [Lnrpc_Channel] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_ChannelCloseSummary { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The outpoint (txid:index) of the funding transaction. + var channelPoint: String = String() + + /// The unique channel ID for the channel. + var chanID: UInt64 = 0 + + /// The hash of the genesis block that this channel resides within. + var chainHash: String = String() + + /// The txid of the transaction which ultimately closed this channel. + var closingTxHash: String = String() + + /// Public key of the remote peer that we formerly had a channel with. + var remotePubkey: String = String() + + /// Total capacity of the channel. + var capacity: Int64 = 0 + + /// Height at which the funding transaction was spent. + var closeHeight: UInt32 = 0 + + /// Settled balance at the time of channel closure + var settledBalance: Int64 = 0 + + /// The sum of all the time-locked outputs at the time of channel closure + var timeLockedBalance: Int64 = 0 + + /// Details on how the channel was closed. + var closeType: Lnrpc_ChannelCloseSummary.ClosureType = .cooperativeClose + + /// + ///Open initiator is the party that initiated opening the channel. Note that + ///this value may be unknown if the channel was closed before we migrated to + ///store open channel information after close. + var openInitiator: Lnrpc_Initiator = .unknown + + /// + ///Close initiator indicates which party initiated the close. This value will + ///be unknown for channels that were cooperatively closed before we started + ///tracking cooperative close initiators. Note that this indicates which party + ///initiated a close, and it is possible for both to initiate cooperative or + ///force closes, although only one party's close will be confirmed on chain. + var closeInitiator: Lnrpc_Initiator = .unknown + + var resolutions: [Lnrpc_Resolution] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum ClosureType: SwiftProtobuf.Enum { + typealias RawValue = Int + case cooperativeClose // = 0 + case localForceClose // = 1 + case remoteForceClose // = 2 + case breachClose // = 3 + case fundingCanceled // = 4 + case abandoned // = 5 + case UNRECOGNIZED(Int) + + init() { + self = .cooperativeClose + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .cooperativeClose + case 1: self = .localForceClose + case 2: self = .remoteForceClose + case 3: self = .breachClose + case 4: self = .fundingCanceled + case 5: self = .abandoned + default: self = .UNRECOGNIZED(rawValue) + } + } + + var rawValue: Int { + switch self { + case .cooperativeClose: return 0 + case .localForceClose: return 1 + case .remoteForceClose: return 2 + case .breachClose: return 3 + case .fundingCanceled: return 4 + case .abandoned: return 5 + case .UNRECOGNIZED(let i): return i + } + } + + } + + init() {} +} + +#if swift(>=4.2) + +extension Lnrpc_ChannelCloseSummary.ClosureType: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static var allCases: [Lnrpc_ChannelCloseSummary.ClosureType] = [ + .cooperativeClose, + .localForceClose, + .remoteForceClose, + .breachClose, + .fundingCanceled, + .abandoned, + ] +} + +#endif // swift(>=4.2) + +struct Lnrpc_Resolution { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The type of output we are resolving. + var resolutionType: Lnrpc_ResolutionType = .typeUnknown + + /// The outcome of our on chain action that resolved the outpoint. + var outcome: Lnrpc_ResolutionOutcome = .outcomeUnknown + + /// The outpoint that was spent by the resolution. + var outpoint: Lnrpc_OutPoint { + get {return _outpoint ?? Lnrpc_OutPoint()} + set {_outpoint = newValue} + } + /// Returns true if `outpoint` has been explicitly set. + var hasOutpoint: Bool {return self._outpoint != nil} + /// Clears the value of `outpoint`. Subsequent reads from it will return its default value. + mutating func clearOutpoint() {self._outpoint = nil} + + /// The amount that was claimed by the resolution. + var amountSat: UInt64 = 0 + + /// The hex-encoded transaction ID of the sweep transaction that spent the + /// output. + var sweepTxid: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _outpoint: Lnrpc_OutPoint? = nil +} + +struct Lnrpc_ClosedChannelsRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var cooperative: Bool = false + + var localForce: Bool = false + + var remoteForce: Bool = false + + var breach: Bool = false + + var fundingCanceled: Bool = false + + var abandoned: Bool = false + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_ClosedChannelsResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var channels: [Lnrpc_ChannelCloseSummary] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_Peer { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The identity pubkey of the peer + var pubKey: String = String() + + /// Network address of the peer; eg `127.0.0.1:10011` + var address: String = String() + + /// Bytes of data transmitted to this peer + var bytesSent: UInt64 = 0 + + /// Bytes of data transmitted from this peer + var bytesRecv: UInt64 = 0 + + /// Satoshis sent to this peer + var satSent: Int64 = 0 + + /// Satoshis received from this peer + var satRecv: Int64 = 0 + + /// A channel is inbound if the counterparty initiated the channel + var inbound: Bool = false + + /// Ping time to this peer + var pingTime: Int64 = 0 + + /// The type of sync we are currently performing with this peer. + var syncType: Lnrpc_Peer.SyncType = .unknownSync + + /// Features advertised by the remote peer in their init message. + var features: Dictionary = [:] + + /// + ///The latest errors received from our peer with timestamps, limited to the 10 + ///most recent errors. These errors are tracked across peer connections, but + ///are not persisted across lnd restarts. Note that these errors are only + ///stored for peers that we have channels open with, to prevent peers from + ///spamming us with errors at no cost. + var errors: [Lnrpc_TimestampedError] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum SyncType: SwiftProtobuf.Enum { + typealias RawValue = Int + + /// + ///Denotes that we cannot determine the peer's current sync type. + case unknownSync // = 0 + + /// + ///Denotes that we are actively receiving new graph updates from the peer. + case activeSync // = 1 + + /// + ///Denotes that we are not receiving new graph updates from the peer. + case passiveSync // = 2 + case UNRECOGNIZED(Int) + + init() { + self = .unknownSync + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknownSync + case 1: self = .activeSync + case 2: self = .passiveSync + default: self = .UNRECOGNIZED(rawValue) + } + } + + var rawValue: Int { + switch self { + case .unknownSync: return 0 + case .activeSync: return 1 + case .passiveSync: return 2 + case .UNRECOGNIZED(let i): return i + } + } + + } + + init() {} +} + +#if swift(>=4.2) + +extension Lnrpc_Peer.SyncType: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static var allCases: [Lnrpc_Peer.SyncType] = [ + .unknownSync, + .activeSync, + .passiveSync, + ] +} + +#endif // swift(>=4.2) + +struct Lnrpc_TimestampedError { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The unix timestamp in seconds when the error occurred. + var timestamp: UInt64 = 0 + + /// The string representation of the error sent by our peer. + var error: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_ListPeersRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///If true, only the last error that our peer sent us will be returned with + ///the peer's information, rather than the full set of historic errors we have + ///stored. + var latestError: Bool = false + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_ListPeersResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The list of currently connected peers + var peers: [Lnrpc_Peer] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_PeerEventSubscription { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_PeerEvent { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The identity pubkey of the peer. + var pubKey: String = String() + + var type: Lnrpc_PeerEvent.EventType = .peerOnline + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum EventType: SwiftProtobuf.Enum { + typealias RawValue = Int + case peerOnline // = 0 + case peerOffline // = 1 + case UNRECOGNIZED(Int) + + init() { + self = .peerOnline + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .peerOnline + case 1: self = .peerOffline + default: self = .UNRECOGNIZED(rawValue) + } + } + + var rawValue: Int { + switch self { + case .peerOnline: return 0 + case .peerOffline: return 1 + case .UNRECOGNIZED(let i): return i + } + } + + } + + init() {} +} + +#if swift(>=4.2) + +extension Lnrpc_PeerEvent.EventType: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static var allCases: [Lnrpc_PeerEvent.EventType] = [ + .peerOnline, + .peerOffline, + ] +} + +#endif // swift(>=4.2) + +struct Lnrpc_GetInfoRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_GetInfoResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The version of the LND software that the node is running. + var version: String { + get {return _storage._version} + set {_uniqueStorage()._version = newValue} + } + + /// The SHA1 commit hash that the daemon is compiled with. + var commitHash: String { + get {return _storage._commitHash} + set {_uniqueStorage()._commitHash = newValue} + } + + /// The identity pubkey of the current node. + var identityPubkey: String { + get {return _storage._identityPubkey} + set {_uniqueStorage()._identityPubkey = newValue} + } + + /// If applicable, the alias of the current node, e.g. "bob" + var alias: String { + get {return _storage._alias} + set {_uniqueStorage()._alias = newValue} + } + + /// The color of the current node in hex code format + var color: String { + get {return _storage._color} + set {_uniqueStorage()._color = newValue} + } + + /// Number of pending channels + var numPendingChannels: UInt32 { + get {return _storage._numPendingChannels} + set {_uniqueStorage()._numPendingChannels = newValue} + } + + /// Number of active channels + var numActiveChannels: UInt32 { + get {return _storage._numActiveChannels} + set {_uniqueStorage()._numActiveChannels = newValue} + } + + /// Number of inactive channels + var numInactiveChannels: UInt32 { + get {return _storage._numInactiveChannels} + set {_uniqueStorage()._numInactiveChannels = newValue} + } + + /// Number of peers + var numPeers: UInt32 { + get {return _storage._numPeers} + set {_uniqueStorage()._numPeers = newValue} + } + + /// The node's current view of the height of the best block + var blockHeight: UInt32 { + get {return _storage._blockHeight} + set {_uniqueStorage()._blockHeight = newValue} + } + + /// The node's current view of the hash of the best block + var blockHash: String { + get {return _storage._blockHash} + set {_uniqueStorage()._blockHash = newValue} + } + + /// Timestamp of the block best known to the wallet + var bestHeaderTimestamp: Int64 { + get {return _storage._bestHeaderTimestamp} + set {_uniqueStorage()._bestHeaderTimestamp = newValue} + } + + /// Whether the wallet's view is synced to the main chain + var syncedToChain: Bool { + get {return _storage._syncedToChain} + set {_uniqueStorage()._syncedToChain = newValue} + } + + /// Whether we consider ourselves synced with the public channel graph. + var syncedToGraph: Bool { + get {return _storage._syncedToGraph} + set {_uniqueStorage()._syncedToGraph = newValue} + } + + /// + ///Whether the current node is connected to testnet. This field is + ///deprecated and the network field should be used instead + var testnet: Bool { + get {return _storage._testnet} + set {_uniqueStorage()._testnet = newValue} + } + + /// A list of active chains the node is connected to + var chains: [Lnrpc_Chain] { + get {return _storage._chains} + set {_uniqueStorage()._chains = newValue} + } + + /// The URIs of the current node. + var uris: [String] { + get {return _storage._uris} + set {_uniqueStorage()._uris = newValue} + } + + /// + ///Features that our node has advertised in our init message, node + ///announcements and invoices. + var features: Dictionary { + get {return _storage._features} + set {_uniqueStorage()._features = newValue} + } + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _storage = _StorageClass.defaultInstance +} + +struct Lnrpc_GetRecoveryInfoRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_GetRecoveryInfoResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Whether the wallet is in recovery mode + var recoveryMode: Bool = false + + /// Whether the wallet recovery progress is finished + var recoveryFinished: Bool = false + + /// The recovery progress, ranging from 0 to 1. + var progress: Double = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_Chain { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The blockchain the node is on (eg bitcoin, litecoin) + var chain: String = String() + + /// The network the node is on (eg regtest, testnet, mainnet) + var network: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_ConfirmationUpdate { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var blockSha: Data = SwiftProtobuf.Internal.emptyData + + var blockHeight: Int32 = 0 + + var numConfsLeft: UInt32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_ChannelOpenUpdate { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var channelPoint: Lnrpc_ChannelPoint { + get {return _channelPoint ?? Lnrpc_ChannelPoint()} + set {_channelPoint = newValue} + } + /// Returns true if `channelPoint` has been explicitly set. + var hasChannelPoint: Bool {return self._channelPoint != nil} + /// Clears the value of `channelPoint`. Subsequent reads from it will return its default value. + mutating func clearChannelPoint() {self._channelPoint = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _channelPoint: Lnrpc_ChannelPoint? = nil +} + +struct Lnrpc_ChannelCloseUpdate { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var closingTxid: Data = SwiftProtobuf.Internal.emptyData + + var success: Bool = false + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_CloseChannelRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The outpoint (txid:index) of the funding transaction. With this value, Bob + ///will be able to generate a signature for Alice's version of the commitment + ///transaction. + var channelPoint: Lnrpc_ChannelPoint { + get {return _channelPoint ?? Lnrpc_ChannelPoint()} + set {_channelPoint = newValue} + } + /// Returns true if `channelPoint` has been explicitly set. + var hasChannelPoint: Bool {return self._channelPoint != nil} + /// Clears the value of `channelPoint`. Subsequent reads from it will return its default value. + mutating func clearChannelPoint() {self._channelPoint = nil} + + /// If true, then the channel will be closed forcibly. This means the + /// current commitment transaction will be signed and broadcast. + var force: Bool = false + + /// The target number of blocks that the closure transaction should be + /// confirmed by. + var targetConf: Int32 = 0 + + /// A manual fee rate set in sat/byte that should be used when crafting the + /// closure transaction. + var satPerByte: Int64 = 0 + + /// + ///An optional address to send funds to in the case of a cooperative close. + ///If the channel was opened with an upfront shutdown script and this field + ///is set, the request to close will fail because the channel must pay out + ///to the upfront shutdown addresss. + var deliveryAddress: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _channelPoint: Lnrpc_ChannelPoint? = nil +} + +struct Lnrpc_CloseStatusUpdate { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var update: Lnrpc_CloseStatusUpdate.OneOf_Update? = nil + + var closePending: Lnrpc_PendingUpdate { + get { + if case .closePending(let v)? = update {return v} + return Lnrpc_PendingUpdate() + } + set {update = .closePending(newValue)} + } + + var chanClose: Lnrpc_ChannelCloseUpdate { + get { + if case .chanClose(let v)? = update {return v} + return Lnrpc_ChannelCloseUpdate() + } + set {update = .chanClose(newValue)} + } + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum OneOf_Update: Equatable { + case closePending(Lnrpc_PendingUpdate) + case chanClose(Lnrpc_ChannelCloseUpdate) + + #if !swift(>=4.1) + static func ==(lhs: Lnrpc_CloseStatusUpdate.OneOf_Update, rhs: Lnrpc_CloseStatusUpdate.OneOf_Update) -> Bool { + switch (lhs, rhs) { + case (.closePending(let l), .closePending(let r)): return l == r + case (.chanClose(let l), .chanClose(let r)): return l == r + default: return false + } + } + #endif + } + + init() {} +} + +struct Lnrpc_PendingUpdate { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var txid: Data = SwiftProtobuf.Internal.emptyData + + var outputIndex: UInt32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_ReadyForPsbtFunding { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The P2WSH address of the channel funding multisig address that the below + ///specified amount in satoshis needs to be sent to. + var fundingAddress: String = String() + + /// + ///The exact amount in satoshis that needs to be sent to the above address to + ///fund the pending channel. + var fundingAmount: Int64 = 0 + + /// + ///A raw PSBT that contains the pending channel output. If a base PSBT was + ///provided in the PsbtShim, this is the base PSBT with one additional output. + ///If no base PSBT was specified, this is an otherwise empty PSBT with exactly + ///one output. + var psbt: Data = SwiftProtobuf.Internal.emptyData + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_OpenChannelRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The pubkey of the node to open a channel with. When using REST, this field + ///must be encoded as base64. + var nodePubkey: Data = SwiftProtobuf.Internal.emptyData + + /// + ///The hex encoded pubkey of the node to open a channel with. Deprecated now + ///that the REST gateway supports base64 encoding of bytes fields. + var nodePubkeyString: String = String() + + /// The number of satoshis the wallet should commit to the channel + var localFundingAmount: Int64 = 0 + + /// The number of satoshis to push to the remote side as part of the initial + /// commitment state + var pushSat: Int64 = 0 + + /// The target number of blocks that the funding transaction should be + /// confirmed by. + var targetConf: Int32 = 0 + + /// A manual fee rate set in sat/byte that should be used when crafting the + /// funding transaction. + var satPerByte: Int64 = 0 + + /// Whether this channel should be private, not announced to the greater + /// network. + var `private`: Bool = false + + /// The minimum value in millisatoshi we will require for incoming HTLCs on + /// the channel. + var minHtlcMsat: Int64 = 0 + + /// The delay we require on the remote's commitment transaction. If this is + /// not set, it will be scaled automatically with the channel size. + var remoteCsvDelay: UInt32 = 0 + + /// The minimum number of confirmations each one of your outputs used for + /// the funding transaction must satisfy. + var minConfs: Int32 = 0 + + /// Whether unconfirmed outputs should be used as inputs for the funding + /// transaction. + var spendUnconfirmed: Bool = false + + /// + ///Close address is an optional address which specifies the address to which + ///funds should be paid out to upon cooperative close. This field may only be + ///set if the peer supports the option upfront feature bit (call listpeers + ///to check). The remote peer will only accept cooperative closes to this + ///address if it is set. + /// + ///Note: If this value is set on channel creation, you will *not* be able to + ///cooperatively close out to a different address. + var closeAddress: String = String() + + /// + ///Funding shims are an optional argument that allow the caller to intercept + ///certain funding functionality. For example, a shim can be provided to use a + ///particular key for the commitment key (ideally cold) rather than use one + ///that is generated by the wallet as normal, or signal that signing will be + ///carried out in an interactive manner (PSBT based). + var fundingShim: Lnrpc_FundingShim { + get {return _fundingShim ?? Lnrpc_FundingShim()} + set {_fundingShim = newValue} + } + /// Returns true if `fundingShim` has been explicitly set. + var hasFundingShim: Bool {return self._fundingShim != nil} + /// Clears the value of `fundingShim`. Subsequent reads from it will return its default value. + mutating func clearFundingShim() {self._fundingShim = nil} + + /// + ///The maximum amount of coins in millisatoshi that can be pending within + ///the channel. It only applies to the remote party. + var remoteMaxValueInFlightMsat: UInt64 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _fundingShim: Lnrpc_FundingShim? = nil +} + +struct Lnrpc_OpenStatusUpdate { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var update: Lnrpc_OpenStatusUpdate.OneOf_Update? = nil + + /// + ///Signals that the channel is now fully negotiated and the funding + ///transaction published. + var chanPending: Lnrpc_PendingUpdate { + get { + if case .chanPending(let v)? = update {return v} + return Lnrpc_PendingUpdate() + } + set {update = .chanPending(newValue)} + } + + /// + ///Signals that the channel's funding transaction has now reached the + ///required number of confirmations on chain and can be used. + var chanOpen: Lnrpc_ChannelOpenUpdate { + get { + if case .chanOpen(let v)? = update {return v} + return Lnrpc_ChannelOpenUpdate() + } + set {update = .chanOpen(newValue)} + } + + /// + ///Signals that the funding process has been suspended and the construction + ///of a PSBT that funds the channel PK script is now required. + var psbtFund: Lnrpc_ReadyForPsbtFunding { + get { + if case .psbtFund(let v)? = update {return v} + return Lnrpc_ReadyForPsbtFunding() + } + set {update = .psbtFund(newValue)} + } + + /// + ///The pending channel ID of the created channel. This value may be used to + ///further the funding flow manually via the FundingStateStep method. + var pendingChanID: Data = SwiftProtobuf.Internal.emptyData + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum OneOf_Update: Equatable { + /// + ///Signals that the channel is now fully negotiated and the funding + ///transaction published. + case chanPending(Lnrpc_PendingUpdate) + /// + ///Signals that the channel's funding transaction has now reached the + ///required number of confirmations on chain and can be used. + case chanOpen(Lnrpc_ChannelOpenUpdate) + /// + ///Signals that the funding process has been suspended and the construction + ///of a PSBT that funds the channel PK script is now required. + case psbtFund(Lnrpc_ReadyForPsbtFunding) + + #if !swift(>=4.1) + static func ==(lhs: Lnrpc_OpenStatusUpdate.OneOf_Update, rhs: Lnrpc_OpenStatusUpdate.OneOf_Update) -> Bool { + switch (lhs, rhs) { + case (.chanPending(let l), .chanPending(let r)): return l == r + case (.chanOpen(let l), .chanOpen(let r)): return l == r + case (.psbtFund(let l), .psbtFund(let r)): return l == r + default: return false + } + } + #endif + } + + init() {} +} + +struct Lnrpc_KeyLocator { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The family of key being identified. + var keyFamily: Int32 = 0 + + /// The precise index of the key being identified. + var keyIndex: Int32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_KeyDescriptor { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The raw bytes of the key being identified. + var rawKeyBytes: Data = SwiftProtobuf.Internal.emptyData + + /// + ///The key locator that identifies which key to use for signing. + var keyLoc: Lnrpc_KeyLocator { + get {return _keyLoc ?? Lnrpc_KeyLocator()} + set {_keyLoc = newValue} + } + /// Returns true if `keyLoc` has been explicitly set. + var hasKeyLoc: Bool {return self._keyLoc != nil} + /// Clears the value of `keyLoc`. Subsequent reads from it will return its default value. + mutating func clearKeyLoc() {self._keyLoc = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _keyLoc: Lnrpc_KeyLocator? = nil +} + +struct Lnrpc_ChanPointShim { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The size of the pre-crafted output to be used as the channel point for this + ///channel funding. + var amt: Int64 = 0 + + /// The target channel point to refrence in created commitment transactions. + var chanPoint: Lnrpc_ChannelPoint { + get {return _chanPoint ?? Lnrpc_ChannelPoint()} + set {_chanPoint = newValue} + } + /// Returns true if `chanPoint` has been explicitly set. + var hasChanPoint: Bool {return self._chanPoint != nil} + /// Clears the value of `chanPoint`. Subsequent reads from it will return its default value. + mutating func clearChanPoint() {self._chanPoint = nil} + + /// Our local key to use when creating the multi-sig output. + var localKey: Lnrpc_KeyDescriptor { + get {return _localKey ?? Lnrpc_KeyDescriptor()} + set {_localKey = newValue} + } + /// Returns true if `localKey` has been explicitly set. + var hasLocalKey: Bool {return self._localKey != nil} + /// Clears the value of `localKey`. Subsequent reads from it will return its default value. + mutating func clearLocalKey() {self._localKey = nil} + + /// The key of the remote party to use when creating the multi-sig output. + var remoteKey: Data = SwiftProtobuf.Internal.emptyData + + /// + ///If non-zero, then this will be used as the pending channel ID on the wire + ///protocol to initate the funding request. This is an optional field, and + ///should only be set if the responder is already expecting a specific pending + ///channel ID. + var pendingChanID: Data = SwiftProtobuf.Internal.emptyData + + /// + ///This uint32 indicates if this channel is to be considered 'frozen'. A frozen + ///channel does not allow a cooperative channel close by the initiator. The + ///thaw_height is the height that this restriction stops applying to the + ///channel. The height can be interpreted in two ways: as a relative height if + ///the value is less than 500,000, or as an absolute height otherwise. + var thawHeight: UInt32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _chanPoint: Lnrpc_ChannelPoint? = nil + fileprivate var _localKey: Lnrpc_KeyDescriptor? = nil +} + +struct Lnrpc_PsbtShim { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///A unique identifier of 32 random bytes that will be used as the pending + ///channel ID to identify the PSBT state machine when interacting with it and + ///on the wire protocol to initiate the funding request. + var pendingChanID: Data = SwiftProtobuf.Internal.emptyData + + /// + ///An optional base PSBT the new channel output will be added to. If this is + ///non-empty, it must be a binary serialized PSBT. + var basePsbt: Data = SwiftProtobuf.Internal.emptyData + + /// + ///If a channel should be part of a batch (multiple channel openings in one + ///transaction), it can be dangerous if the whole batch transaction is + ///published too early before all channel opening negotiations are completed. + ///This flag prevents this particular channel from broadcasting the transaction + ///after the negotiation with the remote peer. In a batch of channel openings + ///this flag should be set to true for every channel but the very last. + var noPublish: Bool = false + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_FundingShim { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var shim: Lnrpc_FundingShim.OneOf_Shim? = nil + + /// + ///A channel shim where the channel point was fully constructed outside + ///of lnd's wallet and the transaction might already be published. + var chanPointShim: Lnrpc_ChanPointShim { + get { + if case .chanPointShim(let v)? = shim {return v} + return Lnrpc_ChanPointShim() + } + set {shim = .chanPointShim(newValue)} + } + + /// + ///A channel shim that uses a PSBT to fund and sign the channel funding + ///transaction. + var psbtShim: Lnrpc_PsbtShim { + get { + if case .psbtShim(let v)? = shim {return v} + return Lnrpc_PsbtShim() + } + set {shim = .psbtShim(newValue)} + } + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum OneOf_Shim: Equatable { + /// + ///A channel shim where the channel point was fully constructed outside + ///of lnd's wallet and the transaction might already be published. + case chanPointShim(Lnrpc_ChanPointShim) + /// + ///A channel shim that uses a PSBT to fund and sign the channel funding + ///transaction. + case psbtShim(Lnrpc_PsbtShim) + + #if !swift(>=4.1) + static func ==(lhs: Lnrpc_FundingShim.OneOf_Shim, rhs: Lnrpc_FundingShim.OneOf_Shim) -> Bool { + switch (lhs, rhs) { + case (.chanPointShim(let l), .chanPointShim(let r)): return l == r + case (.psbtShim(let l), .psbtShim(let r)): return l == r + default: return false + } + } + #endif + } + + init() {} +} + +struct Lnrpc_FundingShimCancel { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The pending channel ID of the channel to cancel the funding shim for. + var pendingChanID: Data = SwiftProtobuf.Internal.emptyData + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_FundingPsbtVerify { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The funded but not yet signed PSBT that sends the exact channel capacity + ///amount to the PK script returned in the open channel message in a previous + ///step. + var fundedPsbt: Data = SwiftProtobuf.Internal.emptyData + + /// The pending channel ID of the channel to get the PSBT for. + var pendingChanID: Data = SwiftProtobuf.Internal.emptyData + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_FundingPsbtFinalize { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The funded PSBT that contains all witness data to send the exact channel + ///capacity amount to the PK script returned in the open channel message in a + ///previous step. + var signedPsbt: Data = SwiftProtobuf.Internal.emptyData + + /// The pending channel ID of the channel to get the PSBT for. + var pendingChanID: Data = SwiftProtobuf.Internal.emptyData + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_FundingTransitionMsg { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var trigger: Lnrpc_FundingTransitionMsg.OneOf_Trigger? = nil + + /// + ///The funding shim to register. This should be used before any + ///channel funding has began by the remote party, as it is intended as a + ///preparatory step for the full channel funding. + var shimRegister: Lnrpc_FundingShim { + get { + if case .shimRegister(let v)? = trigger {return v} + return Lnrpc_FundingShim() + } + set {trigger = .shimRegister(newValue)} + } + + /// Used to cancel an existing registered funding shim. + var shimCancel: Lnrpc_FundingShimCancel { + get { + if case .shimCancel(let v)? = trigger {return v} + return Lnrpc_FundingShimCancel() + } + set {trigger = .shimCancel(newValue)} + } + + /// + ///Used to continue a funding flow that was initiated to be executed + ///through a PSBT. This step verifies that the PSBT contains the correct + ///outputs to fund the channel. + var psbtVerify: Lnrpc_FundingPsbtVerify { + get { + if case .psbtVerify(let v)? = trigger {return v} + return Lnrpc_FundingPsbtVerify() + } + set {trigger = .psbtVerify(newValue)} + } + + /// + ///Used to continue a funding flow that was initiated to be executed + ///through a PSBT. This step finalizes the funded and signed PSBT, finishes + ///negotiation with the peer and finally publishes the resulting funding + ///transaction. + var psbtFinalize: Lnrpc_FundingPsbtFinalize { + get { + if case .psbtFinalize(let v)? = trigger {return v} + return Lnrpc_FundingPsbtFinalize() + } + set {trigger = .psbtFinalize(newValue)} + } + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum OneOf_Trigger: Equatable { + /// + ///The funding shim to register. This should be used before any + ///channel funding has began by the remote party, as it is intended as a + ///preparatory step for the full channel funding. + case shimRegister(Lnrpc_FundingShim) + /// Used to cancel an existing registered funding shim. + case shimCancel(Lnrpc_FundingShimCancel) + /// + ///Used to continue a funding flow that was initiated to be executed + ///through a PSBT. This step verifies that the PSBT contains the correct + ///outputs to fund the channel. + case psbtVerify(Lnrpc_FundingPsbtVerify) + /// + ///Used to continue a funding flow that was initiated to be executed + ///through a PSBT. This step finalizes the funded and signed PSBT, finishes + ///negotiation with the peer and finally publishes the resulting funding + ///transaction. + case psbtFinalize(Lnrpc_FundingPsbtFinalize) + + #if !swift(>=4.1) + static func ==(lhs: Lnrpc_FundingTransitionMsg.OneOf_Trigger, rhs: Lnrpc_FundingTransitionMsg.OneOf_Trigger) -> Bool { + switch (lhs, rhs) { + case (.shimRegister(let l), .shimRegister(let r)): return l == r + case (.shimCancel(let l), .shimCancel(let r)): return l == r + case (.psbtVerify(let l), .psbtVerify(let r)): return l == r + case (.psbtFinalize(let l), .psbtFinalize(let r)): return l == r + default: return false + } + } + #endif + } + + init() {} +} + +struct Lnrpc_FundingStateStepResp { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_PendingHTLC { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The direction within the channel that the htlc was sent + var incoming: Bool = false + + /// The total value of the htlc + var amount: Int64 = 0 + + /// The final output to be swept back to the user's wallet + var outpoint: String = String() + + /// The next block height at which we can spend the current stage + var maturityHeight: UInt32 = 0 + + /// + ///The number of blocks remaining until the current stage can be swept. + ///Negative values indicate how many blocks have passed since becoming + ///mature. + var blocksTilMaturity: Int32 = 0 + + /// Indicates whether the htlc is in its first or second stage of recovery + var stage: UInt32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_PendingChannelsRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_PendingChannelsResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The balance in satoshis encumbered in pending channels + var totalLimboBalance: Int64 = 0 + + /// Channels pending opening + var pendingOpenChannels: [Lnrpc_PendingChannelsResponse.PendingOpenChannel] = [] + + /// + ///Deprecated: Channels pending closing previously contained cooperatively + ///closed channels with a single confirmation. These channels are now + ///considered closed from the time we see them on chain. + var pendingClosingChannels: [Lnrpc_PendingChannelsResponse.ClosedChannel] = [] + + /// Channels pending force closing + var pendingForceClosingChannels: [Lnrpc_PendingChannelsResponse.ForceClosedChannel] = [] + + /// Channels waiting for closing tx to confirm + var waitingCloseChannels: [Lnrpc_PendingChannelsResponse.WaitingCloseChannel] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + struct PendingChannel { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var remoteNodePub: String = String() + + var channelPoint: String = String() + + var capacity: Int64 = 0 + + var localBalance: Int64 = 0 + + var remoteBalance: Int64 = 0 + + /// The minimum satoshis this node is required to reserve in its + /// balance. + var localChanReserveSat: Int64 = 0 + + /// + ///The minimum satoshis the other node is required to reserve in its + ///balance. + var remoteChanReserveSat: Int64 = 0 + + /// The party that initiated opening the channel. + var initiator: Lnrpc_Initiator = .unknown + + /// The commitment type used by this channel. + var commitmentType: Lnrpc_CommitmentType = .legacy + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + } + + struct PendingOpenChannel { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The pending channel + var channel: Lnrpc_PendingChannelsResponse.PendingChannel { + get {return _channel ?? Lnrpc_PendingChannelsResponse.PendingChannel()} + set {_channel = newValue} + } + /// Returns true if `channel` has been explicitly set. + var hasChannel: Bool {return self._channel != nil} + /// Clears the value of `channel`. Subsequent reads from it will return its default value. + mutating func clearChannel() {self._channel = nil} + + /// The height at which this channel will be confirmed + var confirmationHeight: UInt32 = 0 + + /// + ///The amount calculated to be paid in fees for the current set of + ///commitment transactions. The fee amount is persisted with the channel + ///in order to allow the fee amount to be removed and recalculated with + ///each channel state update, including updates that happen after a system + ///restart. + var commitFee: Int64 = 0 + + /// The weight of the commitment transaction + var commitWeight: Int64 = 0 + + /// + ///The required number of satoshis per kilo-weight that the requester will + ///pay at all times, for both the funding transaction and commitment + ///transaction. This value can later be updated once the channel is open. + var feePerKw: Int64 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _channel: Lnrpc_PendingChannelsResponse.PendingChannel? = nil + } + + struct WaitingCloseChannel { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The pending channel waiting for closing tx to confirm + var channel: Lnrpc_PendingChannelsResponse.PendingChannel { + get {return _channel ?? Lnrpc_PendingChannelsResponse.PendingChannel()} + set {_channel = newValue} + } + /// Returns true if `channel` has been explicitly set. + var hasChannel: Bool {return self._channel != nil} + /// Clears the value of `channel`. Subsequent reads from it will return its default value. + mutating func clearChannel() {self._channel = nil} + + /// The balance in satoshis encumbered in this channel + var limboBalance: Int64 = 0 + + /// + ///A list of valid commitment transactions. Any of these can confirm at + ///this point. + var commitments: Lnrpc_PendingChannelsResponse.Commitments { + get {return _commitments ?? Lnrpc_PendingChannelsResponse.Commitments()} + set {_commitments = newValue} + } + /// Returns true if `commitments` has been explicitly set. + var hasCommitments: Bool {return self._commitments != nil} + /// Clears the value of `commitments`. Subsequent reads from it will return its default value. + mutating func clearCommitments() {self._commitments = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _channel: Lnrpc_PendingChannelsResponse.PendingChannel? = nil + fileprivate var _commitments: Lnrpc_PendingChannelsResponse.Commitments? = nil + } + + struct Commitments { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Hash of the local version of the commitment tx. + var localTxid: String = String() + + /// Hash of the remote version of the commitment tx. + var remoteTxid: String = String() + + /// Hash of the remote pending version of the commitment tx. + var remotePendingTxid: String = String() + + /// + ///The amount in satoshis calculated to be paid in fees for the local + ///commitment. + var localCommitFeeSat: UInt64 = 0 + + /// + ///The amount in satoshis calculated to be paid in fees for the remote + ///commitment. + var remoteCommitFeeSat: UInt64 = 0 + + /// + ///The amount in satoshis calculated to be paid in fees for the remote + ///pending commitment. + var remotePendingCommitFeeSat: UInt64 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + } + + struct ClosedChannel { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The pending channel to be closed + var channel: Lnrpc_PendingChannelsResponse.PendingChannel { + get {return _channel ?? Lnrpc_PendingChannelsResponse.PendingChannel()} + set {_channel = newValue} + } + /// Returns true if `channel` has been explicitly set. + var hasChannel: Bool {return self._channel != nil} + /// Clears the value of `channel`. Subsequent reads from it will return its default value. + mutating func clearChannel() {self._channel = nil} + + /// The transaction id of the closing transaction + var closingTxid: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _channel: Lnrpc_PendingChannelsResponse.PendingChannel? = nil + } + + struct ForceClosedChannel { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The pending channel to be force closed + var channel: Lnrpc_PendingChannelsResponse.PendingChannel { + get {return _channel ?? Lnrpc_PendingChannelsResponse.PendingChannel()} + set {_channel = newValue} + } + /// Returns true if `channel` has been explicitly set. + var hasChannel: Bool {return self._channel != nil} + /// Clears the value of `channel`. Subsequent reads from it will return its default value. + mutating func clearChannel() {self._channel = nil} + + /// The transaction id of the closing transaction + var closingTxid: String = String() + + /// The balance in satoshis encumbered in this pending channel + var limboBalance: Int64 = 0 + + /// The height at which funds can be swept into the wallet + var maturityHeight: UInt32 = 0 + + /// + ///Remaining # of blocks until the commitment output can be swept. + ///Negative values indicate how many blocks have passed since becoming + ///mature. + var blocksTilMaturity: Int32 = 0 + + /// The total value of funds successfully recovered from this channel + var recoveredBalance: Int64 = 0 + + var pendingHtlcs: [Lnrpc_PendingHTLC] = [] + + var anchor: Lnrpc_PendingChannelsResponse.ForceClosedChannel.AnchorState = .limbo + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum AnchorState: SwiftProtobuf.Enum { + typealias RawValue = Int + case limbo // = 0 + case recovered // = 1 + case lost // = 2 + case UNRECOGNIZED(Int) + + init() { + self = .limbo + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .limbo + case 1: self = .recovered + case 2: self = .lost + default: self = .UNRECOGNIZED(rawValue) + } + } + + var rawValue: Int { + switch self { + case .limbo: return 0 + case .recovered: return 1 + case .lost: return 2 + case .UNRECOGNIZED(let i): return i + } + } + + } + + init() {} + + fileprivate var _channel: Lnrpc_PendingChannelsResponse.PendingChannel? = nil + } + + init() {} +} + +#if swift(>=4.2) + +extension Lnrpc_PendingChannelsResponse.ForceClosedChannel.AnchorState: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static var allCases: [Lnrpc_PendingChannelsResponse.ForceClosedChannel.AnchorState] = [ + .limbo, + .recovered, + .lost, + ] +} + +#endif // swift(>=4.2) + +struct Lnrpc_ChannelEventSubscription { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_ChannelEventUpdate { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var channel: Lnrpc_ChannelEventUpdate.OneOf_Channel? = nil + + var openChannel: Lnrpc_Channel { + get { + if case .openChannel(let v)? = channel {return v} + return Lnrpc_Channel() + } + set {channel = .openChannel(newValue)} + } + + var closedChannel: Lnrpc_ChannelCloseSummary { + get { + if case .closedChannel(let v)? = channel {return v} + return Lnrpc_ChannelCloseSummary() + } + set {channel = .closedChannel(newValue)} + } + + var activeChannel: Lnrpc_ChannelPoint { + get { + if case .activeChannel(let v)? = channel {return v} + return Lnrpc_ChannelPoint() + } + set {channel = .activeChannel(newValue)} + } + + var inactiveChannel: Lnrpc_ChannelPoint { + get { + if case .inactiveChannel(let v)? = channel {return v} + return Lnrpc_ChannelPoint() + } + set {channel = .inactiveChannel(newValue)} + } + + var pendingOpenChannel: Lnrpc_PendingUpdate { + get { + if case .pendingOpenChannel(let v)? = channel {return v} + return Lnrpc_PendingUpdate() + } + set {channel = .pendingOpenChannel(newValue)} + } + + var type: Lnrpc_ChannelEventUpdate.UpdateType = .openChannel + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum OneOf_Channel: Equatable { + case openChannel(Lnrpc_Channel) + case closedChannel(Lnrpc_ChannelCloseSummary) + case activeChannel(Lnrpc_ChannelPoint) + case inactiveChannel(Lnrpc_ChannelPoint) + case pendingOpenChannel(Lnrpc_PendingUpdate) + + #if !swift(>=4.1) + static func ==(lhs: Lnrpc_ChannelEventUpdate.OneOf_Channel, rhs: Lnrpc_ChannelEventUpdate.OneOf_Channel) -> Bool { + switch (lhs, rhs) { + case (.openChannel(let l), .openChannel(let r)): return l == r + case (.closedChannel(let l), .closedChannel(let r)): return l == r + case (.activeChannel(let l), .activeChannel(let r)): return l == r + case (.inactiveChannel(let l), .inactiveChannel(let r)): return l == r + case (.pendingOpenChannel(let l), .pendingOpenChannel(let r)): return l == r + default: return false + } + } + #endif + } + + enum UpdateType: SwiftProtobuf.Enum { + typealias RawValue = Int + case openChannel // = 0 + case closedChannel // = 1 + case activeChannel // = 2 + case inactiveChannel // = 3 + case pendingOpenChannel // = 4 + case UNRECOGNIZED(Int) + + init() { + self = .openChannel + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .openChannel + case 1: self = .closedChannel + case 2: self = .activeChannel + case 3: self = .inactiveChannel + case 4: self = .pendingOpenChannel + default: self = .UNRECOGNIZED(rawValue) + } + } + + var rawValue: Int { + switch self { + case .openChannel: return 0 + case .closedChannel: return 1 + case .activeChannel: return 2 + case .inactiveChannel: return 3 + case .pendingOpenChannel: return 4 + case .UNRECOGNIZED(let i): return i + } + } + + } + + init() {} +} + +#if swift(>=4.2) + +extension Lnrpc_ChannelEventUpdate.UpdateType: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static var allCases: [Lnrpc_ChannelEventUpdate.UpdateType] = [ + .openChannel, + .closedChannel, + .activeChannel, + .inactiveChannel, + .pendingOpenChannel, + ] +} + +#endif // swift(>=4.2) + +struct Lnrpc_WalletBalanceRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_WalletBalanceResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The balance of the wallet + var totalBalance: Int64 = 0 + + /// The confirmed balance of a wallet(with >= 1 confirmations) + var confirmedBalance: Int64 = 0 + + /// The unconfirmed balance of a wallet(with 0 confirmations) + var unconfirmedBalance: Int64 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_ChannelBalanceRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_ChannelBalanceResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Sum of channels balances denominated in satoshis + var balance: Int64 = 0 + + /// Sum of channels pending balances denominated in satoshis + var pendingOpenBalance: Int64 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_QueryRoutesRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The 33-byte hex-encoded public key for the payment destination + var pubKey: String = String() + + /// + ///The amount to send expressed in satoshis. + /// + ///The fields amt and amt_msat are mutually exclusive. + var amt: Int64 = 0 + + /// + ///The amount to send expressed in millisatoshis. + /// + ///The fields amt and amt_msat are mutually exclusive. + var amtMsat: Int64 = 0 + + /// + ///An optional CLTV delta from the current height that should be used for the + ///timelock of the final hop. Note that unlike SendPayment, QueryRoutes does + ///not add any additional block padding on top of final_ctlv_delta. This + ///padding of a few blocks needs to be added manually or otherwise failures may + ///happen when a block comes in while the payment is in flight. + var finalCltvDelta: Int32 = 0 + + /// + ///The maximum number of satoshis that will be paid as a fee of the payment. + ///This value can be represented either as a percentage of the amount being + ///sent, or as a fixed amount of the maximum fee the user is willing the pay to + ///send the payment. + var feeLimit: Lnrpc_FeeLimit { + get {return _feeLimit ?? Lnrpc_FeeLimit()} + set {_feeLimit = newValue} + } + /// Returns true if `feeLimit` has been explicitly set. + var hasFeeLimit: Bool {return self._feeLimit != nil} + /// Clears the value of `feeLimit`. Subsequent reads from it will return its default value. + mutating func clearFeeLimit() {self._feeLimit = nil} + + /// + ///A list of nodes to ignore during path finding. When using REST, these fields + ///must be encoded as base64. + var ignoredNodes: [Data] = [] + + /// + ///Deprecated. A list of edges to ignore during path finding. + var ignoredEdges: [Lnrpc_EdgeLocator] = [] + + /// + ///The source node where the request route should originated from. If empty, + ///self is assumed. + var sourcePubKey: String = String() + + /// + ///If set to true, edge probabilities from mission control will be used to get + ///the optimal route. + var useMissionControl: Bool = false + + /// + ///A list of directed node pairs that will be ignored during path finding. + var ignoredPairs: [Lnrpc_NodePair] = [] + + /// + ///An optional maximum total time lock for the route. If the source is empty or + ///ourselves, this should not exceed lnd's `--max-cltv-expiry` setting. If + ///zero, then the value of `--max-cltv-expiry` is used as the limit. + var cltvLimit: UInt32 = 0 + + /// + ///An optional field that can be used to pass an arbitrary set of TLV records + ///to a peer which understands the new records. This can be used to pass + ///application specific data during the payment attempt. If the destination + ///does not support the specified recrods, and error will be returned. + ///Record types are required to be in the custom range >= 65536. When using + ///REST, the values must be encoded as base64. + var destCustomRecords: Dictionary = [:] + + /// + ///The channel id of the channel that must be taken to the first hop. If zero, + ///any channel may be used. + var outgoingChanID: UInt64 = 0 + + /// + ///The pubkey of the last hop of the route. If empty, any hop may be used. + var lastHopPubkey: Data = SwiftProtobuf.Internal.emptyData + + /// + ///Optional route hints to reach the destination through private channels. + var routeHints: [Lnrpc_RouteHint] = [] + + /// + ///Features assumed to be supported by the final node. All transitive feature + ///dependencies must also be set properly. For a given feature bit pair, either + ///optional or remote may be set, but not both. If this field is nil or empty, + ///the router will try to load destination features from the graph as a + ///fallback. + var destFeatures: [Lnrpc_FeatureBit] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _feeLimit: Lnrpc_FeeLimit? = nil +} + +struct Lnrpc_NodePair { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The sending node of the pair. When using REST, this field must be encoded as + ///base64. + var from: Data = SwiftProtobuf.Internal.emptyData + + /// + ///The receiving node of the pair. When using REST, this field must be encoded + ///as base64. + var to: Data = SwiftProtobuf.Internal.emptyData + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_EdgeLocator { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The short channel id of this edge. + var channelID: UInt64 = 0 + + /// + ///The direction of this edge. If direction_reverse is false, the direction + ///of this edge is from the channel endpoint with the lexicographically smaller + ///pub key to the endpoint with the larger pub key. If direction_reverse is + ///is true, the edge goes the other way. + var directionReverse: Bool = false + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_QueryRoutesResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The route that results from the path finding operation. This is still a + ///repeated field to retain backwards compatibility. + var routes: [Lnrpc_Route] = [] + + /// + ///The success probability of the returned route based on the current mission + ///control state. [EXPERIMENTAL] + var successProb: Double = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_Hop { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The unique channel ID for the channel. The first 3 bytes are the block + ///height, the next 3 the index within the block, and the last 2 bytes are the + ///output index for the channel. + var chanID: UInt64 = 0 + + var chanCapacity: Int64 = 0 + + var amtToForward: Int64 = 0 + + var fee: Int64 = 0 + + var expiry: UInt32 = 0 + + var amtToForwardMsat: Int64 = 0 + + var feeMsat: Int64 = 0 + + /// + ///An optional public key of the hop. If the public key is given, the payment + ///can be executed without relying on a copy of the channel graph. + var pubKey: String = String() + + /// + ///If set to true, then this hop will be encoded using the new variable length + ///TLV format. Note that if any custom tlv_records below are specified, then + ///this field MUST be set to true for them to be encoded properly. + var tlvPayload: Bool = false + + /// + ///An optional TLV record that signals the use of an MPP payment. If present, + ///the receiver will enforce that that the same mpp_record is included in the + ///final hop payload of all non-zero payments in the HTLC set. If empty, a + ///regular single-shot payment is or was attempted. + var mppRecord: Lnrpc_MPPRecord { + get {return _mppRecord ?? Lnrpc_MPPRecord()} + set {_mppRecord = newValue} + } + /// Returns true if `mppRecord` has been explicitly set. + var hasMppRecord: Bool {return self._mppRecord != nil} + /// Clears the value of `mppRecord`. Subsequent reads from it will return its default value. + mutating func clearMppRecord() {self._mppRecord = nil} + + /// + ///An optional set of key-value TLV records. This is useful within the context + ///of the SendToRoute call as it allows callers to specify arbitrary K-V pairs + ///to drop off at each hop within the onion. + var customRecords: Dictionary = [:] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _mppRecord: Lnrpc_MPPRecord? = nil +} + +struct Lnrpc_MPPRecord { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///A unique, random identifier used to authenticate the sender as the intended + ///payer of a multi-path payment. The payment_addr must be the same for all + ///subpayments, and match the payment_addr provided in the receiver's invoice. + ///The same payment_addr must be used on all subpayments. + var paymentAddr: Data = SwiftProtobuf.Internal.emptyData + + /// + ///The total amount in milli-satoshis being sent as part of a larger multi-path + ///payment. The caller is responsible for ensuring subpayments to the same node + ///and payment_hash sum exactly to total_amt_msat. The same + ///total_amt_msat must be used on all subpayments. + var totalAmtMsat: Int64 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +/// +///A path through the channel graph which runs over one or more channels in +///succession. This struct carries all the information required to craft the +///Sphinx onion packet, and send the payment along the first hop in the path. A +///route is only selected as valid if all the channels have sufficient capacity to +///carry the initial payment amount after fees are accounted for. +struct Lnrpc_Route { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The cumulative (final) time lock across the entire route. This is the CLTV + ///value that should be extended to the first hop in the route. All other hops + ///will decrement the time-lock as advertised, leaving enough time for all + ///hops to wait for or present the payment preimage to complete the payment. + var totalTimeLock: UInt32 = 0 + + /// + ///The sum of the fees paid at each hop within the final route. In the case + ///of a one-hop payment, this value will be zero as we don't need to pay a fee + ///to ourselves. + var totalFees: Int64 = 0 + + /// + ///The total amount of funds required to complete a payment over this route. + ///This value includes the cumulative fees at each hop. As a result, the HTLC + ///extended to the first-hop in the route will need to have at least this many + ///satoshis, otherwise the route will fail at an intermediate node due to an + ///insufficient amount of fees. + var totalAmt: Int64 = 0 + + /// + ///Contains details concerning the specific forwarding details at each hop. + var hops: [Lnrpc_Hop] = [] + + /// + ///The total fees in millisatoshis. + var totalFeesMsat: Int64 = 0 + + /// + ///The total amount in millisatoshis. + var totalAmtMsat: Int64 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_NodeInfoRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The 33-byte hex-encoded compressed public of the target node + var pubKey: String = String() + + /// If true, will include all known channels associated with the node. + var includeChannels: Bool = false + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_NodeInfo { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///An individual vertex/node within the channel graph. A node is + ///connected to other nodes by one or more channel edges emanating from it. As + ///the graph is directed, a node will also have an incoming edge attached to + ///it for each outgoing edge. + var node: Lnrpc_LightningNode { + get {return _node ?? Lnrpc_LightningNode()} + set {_node = newValue} + } + /// Returns true if `node` has been explicitly set. + var hasNode: Bool {return self._node != nil} + /// Clears the value of `node`. Subsequent reads from it will return its default value. + mutating func clearNode() {self._node = nil} + + /// The total number of channels for the node. + var numChannels: UInt32 = 0 + + /// The sum of all channels capacity for the node, denominated in satoshis. + var totalCapacity: Int64 = 0 + + /// A list of all public channels for the node. + var channels: [Lnrpc_ChannelEdge] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _node: Lnrpc_LightningNode? = nil +} + +/// +///An individual vertex/node within the channel graph. A node is +///connected to other nodes by one or more channel edges emanating from it. As the +///graph is directed, a node will also have an incoming edge attached to it for +///each outgoing edge. +struct Lnrpc_LightningNode { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var lastUpdate: UInt32 = 0 + + var pubKey: String = String() + + var alias: String = String() + + var addresses: [Lnrpc_NodeAddress] = [] + + var color: String = String() + + var features: Dictionary = [:] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_NodeAddress { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var network: String = String() + + var addr: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_RoutingPolicy { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var timeLockDelta: UInt32 = 0 + + var minHtlc: Int64 = 0 + + var feeBaseMsat: Int64 = 0 + + var feeRateMilliMsat: Int64 = 0 + + var disabled: Bool = false + + var maxHtlcMsat: UInt64 = 0 + + var lastUpdate: UInt32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +/// +///A fully authenticated channel along with all its unique attributes. +///Once an authenticated channel announcement has been processed on the network, +///then an instance of ChannelEdgeInfo encapsulating the channels attributes is +///stored. The other portions relevant to routing policy of a channel are stored +///within a ChannelEdgePolicy for each direction of the channel. +struct Lnrpc_ChannelEdge { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The unique channel ID for the channel. The first 3 bytes are the block + ///height, the next 3 the index within the block, and the last 2 bytes are the + ///output index for the channel. + var channelID: UInt64 = 0 + + var chanPoint: String = String() + + var lastUpdate: UInt32 = 0 + + var node1Pub: String = String() + + var node2Pub: String = String() + + var capacity: Int64 = 0 + + var node1Policy: Lnrpc_RoutingPolicy { + get {return _node1Policy ?? Lnrpc_RoutingPolicy()} + set {_node1Policy = newValue} + } + /// Returns true if `node1Policy` has been explicitly set. + var hasNode1Policy: Bool {return self._node1Policy != nil} + /// Clears the value of `node1Policy`. Subsequent reads from it will return its default value. + mutating func clearNode1Policy() {self._node1Policy = nil} + + var node2Policy: Lnrpc_RoutingPolicy { + get {return _node2Policy ?? Lnrpc_RoutingPolicy()} + set {_node2Policy = newValue} + } + /// Returns true if `node2Policy` has been explicitly set. + var hasNode2Policy: Bool {return self._node2Policy != nil} + /// Clears the value of `node2Policy`. Subsequent reads from it will return its default value. + mutating func clearNode2Policy() {self._node2Policy = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _node1Policy: Lnrpc_RoutingPolicy? = nil + fileprivate var _node2Policy: Lnrpc_RoutingPolicy? = nil +} + +struct Lnrpc_ChannelGraphRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///Whether unannounced channels are included in the response or not. If set, + ///unannounced channels are included. Unannounced channels are both private + ///channels, and public channels that are not yet announced to the network. + var includeUnannounced: Bool = false + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +/// Returns a new instance of the directed channel graph. +struct Lnrpc_ChannelGraph { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The list of `LightningNode`s in this channel graph + var nodes: [Lnrpc_LightningNode] = [] + + /// The list of `ChannelEdge`s in this channel graph + var edges: [Lnrpc_ChannelEdge] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_NodeMetricsRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The requested node metrics. + var types: [Lnrpc_NodeMetricType] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_NodeMetricsResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///Betweenness centrality is the sum of the ratio of shortest paths that pass + ///through the node for each pair of nodes in the graph (not counting paths + ///starting or ending at this node). + ///Map of node pubkey to betweenness centrality of the node. Normalized + ///values are in the [0,1] closed interval. + var betweennessCentrality: Dictionary = [:] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_FloatMetric { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Arbitrary float value. + var value: Double = 0 + + /// The value normalized to [0,1] or [-1,1]. + var normalizedValue: Double = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_ChanInfoRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The unique channel ID for the channel. The first 3 bytes are the block + ///height, the next 3 the index within the block, and the last 2 bytes are the + ///output index for the channel. + var chanID: UInt64 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_NetworkInfoRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_NetworkInfo { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var graphDiameter: UInt32 = 0 + + var avgOutDegree: Double = 0 + + var maxOutDegree: UInt32 = 0 + + var numNodes: UInt32 = 0 + + var numChannels: UInt32 = 0 + + var totalNetworkCapacity: Int64 = 0 + + var avgChannelSize: Double = 0 + + var minChannelSize: Int64 = 0 + + var maxChannelSize: Int64 = 0 + + var medianChannelSizeSat: Int64 = 0 + + /// The number of edges marked as zombies. + var numZombieChans: UInt64 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_StopRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_StopResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_GraphTopologySubscription { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_GraphTopologyUpdate { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var nodeUpdates: [Lnrpc_NodeUpdate] = [] + + var channelUpdates: [Lnrpc_ChannelEdgeUpdate] = [] + + var closedChans: [Lnrpc_ClosedChannelUpdate] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_NodeUpdate { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var addresses: [String] = [] + + var identityKey: String = String() + + var globalFeatures: Data = SwiftProtobuf.Internal.emptyData + + var alias: String = String() + + var color: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_ChannelEdgeUpdate { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The unique channel ID for the channel. The first 3 bytes are the block + ///height, the next 3 the index within the block, and the last 2 bytes are the + ///output index for the channel. + var chanID: UInt64 = 0 + + var chanPoint: Lnrpc_ChannelPoint { + get {return _chanPoint ?? Lnrpc_ChannelPoint()} + set {_chanPoint = newValue} + } + /// Returns true if `chanPoint` has been explicitly set. + var hasChanPoint: Bool {return self._chanPoint != nil} + /// Clears the value of `chanPoint`. Subsequent reads from it will return its default value. + mutating func clearChanPoint() {self._chanPoint = nil} + + var capacity: Int64 = 0 + + var routingPolicy: Lnrpc_RoutingPolicy { + get {return _routingPolicy ?? Lnrpc_RoutingPolicy()} + set {_routingPolicy = newValue} + } + /// Returns true if `routingPolicy` has been explicitly set. + var hasRoutingPolicy: Bool {return self._routingPolicy != nil} + /// Clears the value of `routingPolicy`. Subsequent reads from it will return its default value. + mutating func clearRoutingPolicy() {self._routingPolicy = nil} + + var advertisingNode: String = String() + + var connectingNode: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _chanPoint: Lnrpc_ChannelPoint? = nil + fileprivate var _routingPolicy: Lnrpc_RoutingPolicy? = nil +} + +struct Lnrpc_ClosedChannelUpdate { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The unique channel ID for the channel. The first 3 bytes are the block + ///height, the next 3 the index within the block, and the last 2 bytes are the + ///output index for the channel. + var chanID: UInt64 = 0 + + var capacity: Int64 = 0 + + var closedHeight: UInt32 = 0 + + var chanPoint: Lnrpc_ChannelPoint { + get {return _chanPoint ?? Lnrpc_ChannelPoint()} + set {_chanPoint = newValue} + } + /// Returns true if `chanPoint` has been explicitly set. + var hasChanPoint: Bool {return self._chanPoint != nil} + /// Clears the value of `chanPoint`. Subsequent reads from it will return its default value. + mutating func clearChanPoint() {self._chanPoint = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _chanPoint: Lnrpc_ChannelPoint? = nil +} + +struct Lnrpc_HopHint { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The public key of the node at the start of the channel. + var nodeID: String = String() + + /// The unique identifier of the channel. + var chanID: UInt64 = 0 + + /// The base fee of the channel denominated in millisatoshis. + var feeBaseMsat: UInt32 = 0 + + /// + ///The fee rate of the channel for sending one satoshi across it denominated in + ///millionths of a satoshi. + var feeProportionalMillionths: UInt32 = 0 + + /// The time-lock delta of the channel. + var cltvExpiryDelta: UInt32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_RouteHint { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///A list of hop hints that when chained together can assist in reaching a + ///specific destination. + var hopHints: [Lnrpc_HopHint] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_Invoice { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///An optional memo to attach along with the invoice. Used for record keeping + ///purposes for the invoice's creator, and will also be set in the description + ///field of the encoded payment request if the description_hash field is not + ///being used. + var memo: String { + get {return _storage._memo} + set {_uniqueStorage()._memo = newValue} + } + + /// + ///The hex-encoded preimage (32 byte) which will allow settling an incoming + ///HTLC payable to this preimage. When using REST, this field must be encoded + ///as base64. + var rPreimage: Data { + get {return _storage._rPreimage} + set {_uniqueStorage()._rPreimage = newValue} + } + + /// + ///The hash of the preimage. When using REST, this field must be encoded as + ///base64. + var rHash: Data { + get {return _storage._rHash} + set {_uniqueStorage()._rHash = newValue} + } + + /// + ///The value of this invoice in satoshis + /// + ///The fields value and value_msat are mutually exclusive. + var value: Int64 { + get {return _storage._value} + set {_uniqueStorage()._value = newValue} + } + + /// + ///The value of this invoice in millisatoshis + /// + ///The fields value and value_msat are mutually exclusive. + var valueMsat: Int64 { + get {return _storage._valueMsat} + set {_uniqueStorage()._valueMsat = newValue} + } + + /// Whether this invoice has been fulfilled + var settled: Bool { + get {return _storage._settled} + set {_uniqueStorage()._settled = newValue} + } + + /// When this invoice was created + var creationDate: Int64 { + get {return _storage._creationDate} + set {_uniqueStorage()._creationDate = newValue} + } + + /// When this invoice was settled + var settleDate: Int64 { + get {return _storage._settleDate} + set {_uniqueStorage()._settleDate = newValue} + } + + /// + ///A bare-bones invoice for a payment within the Lightning Network. With the + ///details of the invoice, the sender has all the data necessary to send a + ///payment to the recipient. + var paymentRequest: String { + get {return _storage._paymentRequest} + set {_uniqueStorage()._paymentRequest = newValue} + } + + /// + ///Hash (SHA-256) of a description of the payment. Used if the description of + ///payment (memo) is too long to naturally fit within the description field + ///of an encoded payment request. When using REST, this field must be encoded + ///as base64. + var descriptionHash: Data { + get {return _storage._descriptionHash} + set {_uniqueStorage()._descriptionHash = newValue} + } + + /// Payment request expiry time in seconds. Default is 3600 (1 hour). + var expiry: Int64 { + get {return _storage._expiry} + set {_uniqueStorage()._expiry = newValue} + } + + /// Fallback on-chain address. + var fallbackAddr: String { + get {return _storage._fallbackAddr} + set {_uniqueStorage()._fallbackAddr = newValue} + } + + /// Delta to use for the time-lock of the CLTV extended to the final hop. + var cltvExpiry: UInt64 { + get {return _storage._cltvExpiry} + set {_uniqueStorage()._cltvExpiry = newValue} + } + + /// + ///Route hints that can each be individually used to assist in reaching the + ///invoice's destination. + var routeHints: [Lnrpc_RouteHint] { + get {return _storage._routeHints} + set {_uniqueStorage()._routeHints = newValue} + } + + /// Whether this invoice should include routing hints for private channels. + var `private`: Bool { + get {return _storage._private} + set {_uniqueStorage()._private = newValue} + } + + /// + ///The "add" index of this invoice. Each newly created invoice will increment + ///this index making it monotonically increasing. Callers to the + ///SubscribeInvoices call can use this to instantly get notified of all added + ///invoices with an add_index greater than this one. + var addIndex: UInt64 { + get {return _storage._addIndex} + set {_uniqueStorage()._addIndex = newValue} + } + + /// + ///The "settle" index of this invoice. Each newly settled invoice will + ///increment this index making it monotonically increasing. Callers to the + ///SubscribeInvoices call can use this to instantly get notified of all + ///settled invoices with an settle_index greater than this one. + var settleIndex: UInt64 { + get {return _storage._settleIndex} + set {_uniqueStorage()._settleIndex = newValue} + } + + /// Deprecated, use amt_paid_sat or amt_paid_msat. + var amtPaid: Int64 { + get {return _storage._amtPaid} + set {_uniqueStorage()._amtPaid = newValue} + } + + /// + ///The amount that was accepted for this invoice, in satoshis. This will ONLY + ///be set if this invoice has been settled. We provide this field as if the + ///invoice was created with a zero value, then we need to record what amount + ///was ultimately accepted. Additionally, it's possible that the sender paid + ///MORE that was specified in the original invoice. So we'll record that here + ///as well. + var amtPaidSat: Int64 { + get {return _storage._amtPaidSat} + set {_uniqueStorage()._amtPaidSat = newValue} + } + + /// + ///The amount that was accepted for this invoice, in millisatoshis. This will + ///ONLY be set if this invoice has been settled. We provide this field as if + ///the invoice was created with a zero value, then we need to record what + ///amount was ultimately accepted. Additionally, it's possible that the sender + ///paid MORE that was specified in the original invoice. So we'll record that + ///here as well. + var amtPaidMsat: Int64 { + get {return _storage._amtPaidMsat} + set {_uniqueStorage()._amtPaidMsat = newValue} + } + + /// + ///The state the invoice is in. + var state: Lnrpc_Invoice.InvoiceState { + get {return _storage._state} + set {_uniqueStorage()._state = newValue} + } + + /// List of HTLCs paying to this invoice [EXPERIMENTAL]. + var htlcs: [Lnrpc_InvoiceHTLC] { + get {return _storage._htlcs} + set {_uniqueStorage()._htlcs = newValue} + } + + /// List of features advertised on the invoice. + var features: Dictionary { + get {return _storage._features} + set {_uniqueStorage()._features = newValue} + } + + /// + ///Indicates if this invoice was a spontaneous payment that arrived via keysend + ///[EXPERIMENTAL]. + var isKeysend: Bool { + get {return _storage._isKeysend} + set {_uniqueStorage()._isKeysend = newValue} + } + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum InvoiceState: SwiftProtobuf.Enum { + typealias RawValue = Int + case `open` // = 0 + case settled // = 1 + case canceled // = 2 + case accepted // = 3 + case UNRECOGNIZED(Int) + + init() { + self = .open + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .open + case 1: self = .settled + case 2: self = .canceled + case 3: self = .accepted + default: self = .UNRECOGNIZED(rawValue) + } + } + + var rawValue: Int { + switch self { + case .open: return 0 + case .settled: return 1 + case .canceled: return 2 + case .accepted: return 3 + case .UNRECOGNIZED(let i): return i + } + } + + } + + init() {} + + fileprivate var _storage = _StorageClass.defaultInstance +} + +#if swift(>=4.2) + +extension Lnrpc_Invoice.InvoiceState: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static var allCases: [Lnrpc_Invoice.InvoiceState] = [ + .open, + .settled, + .canceled, + .accepted, + ] +} + +#endif // swift(>=4.2) + +/// Details of an HTLC that paid to an invoice +struct Lnrpc_InvoiceHTLC { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Short channel id over which the htlc was received. + var chanID: UInt64 = 0 + + /// Index identifying the htlc on the channel. + var htlcIndex: UInt64 = 0 + + /// The amount of the htlc in msat. + var amtMsat: UInt64 = 0 + + /// Block height at which this htlc was accepted. + var acceptHeight: Int32 = 0 + + /// Time at which this htlc was accepted. + var acceptTime: Int64 = 0 + + /// Time at which this htlc was settled or canceled. + var resolveTime: Int64 = 0 + + /// Block height at which this htlc expires. + var expiryHeight: Int32 = 0 + + /// Current state the htlc is in. + var state: Lnrpc_InvoiceHTLCState = .accepted + + /// Custom tlv records. + var customRecords: Dictionary = [:] + + /// The total amount of the mpp payment in msat. + var mppTotalAmtMsat: UInt64 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_AddInvoiceResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var rHash: Data = SwiftProtobuf.Internal.emptyData + + /// + ///A bare-bones invoice for a payment within the Lightning Network. With the + ///details of the invoice, the sender has all the data necessary to send a + ///payment to the recipient. + var paymentRequest: String = String() + + /// + ///The "add" index of this invoice. Each newly created invoice will increment + ///this index making it monotonically increasing. Callers to the + ///SubscribeInvoices call can use this to instantly get notified of all added + ///invoices with an add_index greater than this one. + var addIndex: UInt64 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_PaymentHash { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The hex-encoded payment hash of the invoice to be looked up. The passed + ///payment hash must be exactly 32 bytes, otherwise an error is returned. + ///Deprecated now that the REST gateway supports base64 encoding of bytes + ///fields. + var rHashStr: String = String() + + /// + ///The payment hash of the invoice to be looked up. When using REST, this field + ///must be encoded as base64. + var rHash: Data = SwiftProtobuf.Internal.emptyData + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_ListInvoiceRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///If set, only invoices that are not settled and not canceled will be returned + ///in the response. + var pendingOnly: Bool = false + + /// + ///The index of an invoice that will be used as either the start or end of a + ///query to determine which invoices should be returned in the response. + var indexOffset: UInt64 = 0 + + /// The max number of invoices to return in the response to this query. + var numMaxInvoices: UInt64 = 0 + + /// + ///If set, the invoices returned will result from seeking backwards from the + ///specified index offset. This can be used to paginate backwards. + var reversed: Bool = false + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_ListInvoiceResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///A list of invoices from the time slice of the time series specified in the + ///request. + var invoices: [Lnrpc_Invoice] = [] + + /// + ///The index of the last item in the set of returned invoices. This can be used + ///to seek further, pagination style. + var lastIndexOffset: UInt64 = 0 + + /// + ///The index of the last item in the set of returned invoices. This can be used + ///to seek backwards, pagination style. + var firstIndexOffset: UInt64 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_InvoiceSubscription { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///If specified (non-zero), then we'll first start by sending out + ///notifications for all added indexes with an add_index greater than this + ///value. This allows callers to catch up on any events they missed while they + ///weren't connected to the streaming RPC. + var addIndex: UInt64 = 0 + + /// + ///If specified (non-zero), then we'll first start by sending out + ///notifications for all settled indexes with an settle_index greater than + ///this value. This allows callers to catch up on any events they missed while + ///they weren't connected to the streaming RPC. + var settleIndex: UInt64 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_Payment { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The payment hash + var paymentHash: String = String() + + /// Deprecated, use value_sat or value_msat. + var value: Int64 = 0 + + /// Deprecated, use creation_time_ns + var creationDate: Int64 = 0 + + /// Deprecated, use fee_sat or fee_msat. + var fee: Int64 = 0 + + /// The payment preimage + var paymentPreimage: String = String() + + /// The value of the payment in satoshis + var valueSat: Int64 = 0 + + /// The value of the payment in milli-satoshis + var valueMsat: Int64 = 0 + + /// The optional payment request being fulfilled. + var paymentRequest: String = String() + + /// The status of the payment. + var status: Lnrpc_Payment.PaymentStatus = .unknown + + /// The fee paid for this payment in satoshis + var feeSat: Int64 = 0 + + /// The fee paid for this payment in milli-satoshis + var feeMsat: Int64 = 0 + + /// The time in UNIX nanoseconds at which the payment was created. + var creationTimeNs: Int64 = 0 + + /// The HTLCs made in attempt to settle the payment. + var htlcs: [Lnrpc_HTLCAttempt] = [] + + /// + ///The creation index of this payment. Each payment can be uniquely identified + ///by this index, which may not strictly increment by 1 for payments made in + ///older versions of lnd. + var paymentIndex: UInt64 = 0 + + var failureReason: Lnrpc_PaymentFailureReason = .failureReasonNone + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum PaymentStatus: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknown // = 0 + case inFlight // = 1 + case succeeded // = 2 + case failed // = 3 + case UNRECOGNIZED(Int) + + init() { + self = .unknown + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknown + case 1: self = .inFlight + case 2: self = .succeeded + case 3: self = .failed + default: self = .UNRECOGNIZED(rawValue) + } + } + + var rawValue: Int { + switch self { + case .unknown: return 0 + case .inFlight: return 1 + case .succeeded: return 2 + case .failed: return 3 + case .UNRECOGNIZED(let i): return i + } + } + + } + + init() {} +} + +#if swift(>=4.2) + +extension Lnrpc_Payment.PaymentStatus: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static var allCases: [Lnrpc_Payment.PaymentStatus] = [ + .unknown, + .inFlight, + .succeeded, + .failed, + ] +} + +#endif // swift(>=4.2) + +struct Lnrpc_HTLCAttempt { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The status of the HTLC. + var status: Lnrpc_HTLCAttempt.HTLCStatus = .inFlight + + /// The route taken by this HTLC. + var route: Lnrpc_Route { + get {return _route ?? Lnrpc_Route()} + set {_route = newValue} + } + /// Returns true if `route` has been explicitly set. + var hasRoute: Bool {return self._route != nil} + /// Clears the value of `route`. Subsequent reads from it will return its default value. + mutating func clearRoute() {self._route = nil} + + /// The time in UNIX nanoseconds at which this HTLC was sent. + var attemptTimeNs: Int64 = 0 + + /// + ///The time in UNIX nanoseconds at which this HTLC was settled or failed. + ///This value will not be set if the HTLC is still IN_FLIGHT. + var resolveTimeNs: Int64 = 0 + + /// Detailed htlc failure info. + var failure: Lnrpc_Failure { + get {return _failure ?? Lnrpc_Failure()} + set {_failure = newValue} + } + /// Returns true if `failure` has been explicitly set. + var hasFailure: Bool {return self._failure != nil} + /// Clears the value of `failure`. Subsequent reads from it will return its default value. + mutating func clearFailure() {self._failure = nil} + + /// The preimage that was used to settle the HTLC. + var preimage: Data = SwiftProtobuf.Internal.emptyData + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum HTLCStatus: SwiftProtobuf.Enum { + typealias RawValue = Int + case inFlight // = 0 + case succeeded // = 1 + case failed // = 2 + case UNRECOGNIZED(Int) + + init() { + self = .inFlight + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .inFlight + case 1: self = .succeeded + case 2: self = .failed + default: self = .UNRECOGNIZED(rawValue) + } + } + + var rawValue: Int { + switch self { + case .inFlight: return 0 + case .succeeded: return 1 + case .failed: return 2 + case .UNRECOGNIZED(let i): return i + } + } + + } + + init() {} + + fileprivate var _route: Lnrpc_Route? = nil + fileprivate var _failure: Lnrpc_Failure? = nil +} + +#if swift(>=4.2) + +extension Lnrpc_HTLCAttempt.HTLCStatus: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static var allCases: [Lnrpc_HTLCAttempt.HTLCStatus] = [ + .inFlight, + .succeeded, + .failed, + ] +} + +#endif // swift(>=4.2) + +struct Lnrpc_ListPaymentsRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///If true, then return payments that have not yet fully completed. This means + ///that pending payments, as well as failed payments will show up if this + ///field is set to true. This flag doesn't change the meaning of the indices, + ///which are tied to individual payments. + var includeIncomplete: Bool = false + + /// + ///The index of a payment that will be used as either the start or end of a + ///query to determine which payments should be returned in the response. The + ///index_offset is exclusive. In the case of a zero index_offset, the query + ///will start with the oldest payment when paginating forwards, or will end + ///with the most recent payment when paginating backwards. + var indexOffset: UInt64 = 0 + + /// The maximal number of payments returned in the response to this query. + var maxPayments: UInt64 = 0 + + /// + ///If set, the payments returned will result from seeking backwards from the + ///specified index offset. This can be used to paginate backwards. The order + ///of the returned payments is always oldest first (ascending index order). + var reversed: Bool = false + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_ListPaymentsResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The list of payments + var payments: [Lnrpc_Payment] = [] + + /// + ///The index of the first item in the set of returned payments. This can be + ///used as the index_offset to continue seeking backwards in the next request. + var firstIndexOffset: UInt64 = 0 + + /// + ///The index of the last item in the set of returned payments. This can be used + ///as the index_offset to continue seeking forwards in the next request. + var lastIndexOffset: UInt64 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_DeleteAllPaymentsRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_DeleteAllPaymentsResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_AbandonChannelRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var channelPoint: Lnrpc_ChannelPoint { + get {return _channelPoint ?? Lnrpc_ChannelPoint()} + set {_channelPoint = newValue} + } + /// Returns true if `channelPoint` has been explicitly set. + var hasChannelPoint: Bool {return self._channelPoint != nil} + /// Clears the value of `channelPoint`. Subsequent reads from it will return its default value. + mutating func clearChannelPoint() {self._channelPoint = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _channelPoint: Lnrpc_ChannelPoint? = nil +} + +struct Lnrpc_AbandonChannelResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_DebugLevelRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var show: Bool = false + + var levelSpec: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_DebugLevelResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var subSystems: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_PayReqString { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The payment request string to be decoded + var payReq: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_PayReq { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var destination: String = String() + + var paymentHash: String = String() + + var numSatoshis: Int64 = 0 + + var timestamp: Int64 = 0 + + var expiry: Int64 = 0 + + var description_p: String = String() + + var descriptionHash: String = String() + + var fallbackAddr: String = String() + + var cltvExpiry: Int64 = 0 + + var routeHints: [Lnrpc_RouteHint] = [] + + var paymentAddr: Data = SwiftProtobuf.Internal.emptyData + + var numMsat: Int64 = 0 + + var features: Dictionary = [:] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_Feature { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var name: String = String() + + var isRequired: Bool = false + + var isKnown: Bool = false + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_FeeReportRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_ChannelFeeReport { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The short channel id that this fee report belongs to. + var chanID: UInt64 = 0 + + /// The channel that this fee report belongs to. + var channelPoint: String = String() + + /// The base fee charged regardless of the number of milli-satoshis sent. + var baseFeeMsat: Int64 = 0 + + /// The amount charged per milli-satoshis transferred expressed in + /// millionths of a satoshi. + var feePerMil: Int64 = 0 + + /// The effective fee rate in milli-satoshis. Computed by dividing the + /// fee_per_mil value by 1 million. + var feeRate: Double = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_FeeReportResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// An array of channel fee reports which describes the current fee schedule + /// for each channel. + var channelFees: [Lnrpc_ChannelFeeReport] = [] + + /// The total amount of fee revenue (in satoshis) the switch has collected + /// over the past 24 hrs. + var dayFeeSum: UInt64 = 0 + + /// The total amount of fee revenue (in satoshis) the switch has collected + /// over the past 1 week. + var weekFeeSum: UInt64 = 0 + + /// The total amount of fee revenue (in satoshis) the switch has collected + /// over the past 1 month. + var monthFeeSum: UInt64 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_PolicyUpdateRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var scope: Lnrpc_PolicyUpdateRequest.OneOf_Scope? = nil + + /// If set, then this update applies to all currently active channels. + var global: Bool { + get { + if case .global(let v)? = scope {return v} + return false + } + set {scope = .global(newValue)} + } + + /// If set, this update will target a specific channel. + var chanPoint: Lnrpc_ChannelPoint { + get { + if case .chanPoint(let v)? = scope {return v} + return Lnrpc_ChannelPoint() + } + set {scope = .chanPoint(newValue)} + } + + /// The base fee charged regardless of the number of milli-satoshis sent. + var baseFeeMsat: Int64 = 0 + + /// The effective fee rate in milli-satoshis. The precision of this value + /// goes up to 6 decimal places, so 1e-6. + var feeRate: Double = 0 + + /// The required timelock delta for HTLCs forwarded over the channel. + var timeLockDelta: UInt32 = 0 + + /// If set, the maximum HTLC size in milli-satoshis. If unset, the maximum + /// HTLC will be unchanged. + var maxHtlcMsat: UInt64 = 0 + + /// The minimum HTLC size in milli-satoshis. Only applied if + /// min_htlc_msat_specified is true. + var minHtlcMsat: UInt64 = 0 + + /// If true, min_htlc_msat is applied. + var minHtlcMsatSpecified: Bool = false + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum OneOf_Scope: Equatable { + /// If set, then this update applies to all currently active channels. + case global(Bool) + /// If set, this update will target a specific channel. + case chanPoint(Lnrpc_ChannelPoint) + + #if !swift(>=4.1) + static func ==(lhs: Lnrpc_PolicyUpdateRequest.OneOf_Scope, rhs: Lnrpc_PolicyUpdateRequest.OneOf_Scope) -> Bool { + switch (lhs, rhs) { + case (.global(let l), .global(let r)): return l == r + case (.chanPoint(let l), .chanPoint(let r)): return l == r + default: return false + } + } + #endif + } + + init() {} +} + +struct Lnrpc_PolicyUpdateResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_ForwardingHistoryRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Start time is the starting point of the forwarding history request. All + /// records beyond this point will be included, respecting the end time, and + /// the index offset. + var startTime: UInt64 = 0 + + /// End time is the end point of the forwarding history request. The + /// response will carry at most 50k records between the start time and the + /// end time. The index offset can be used to implement pagination. + var endTime: UInt64 = 0 + + /// Index offset is the offset in the time series to start at. As each + /// response can only contain 50k records, callers can use this to skip + /// around within a packed time series. + var indexOffset: UInt32 = 0 + + /// The max number of events to return in the response to this query. + var numMaxEvents: UInt32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_ForwardingEvent { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Timestamp is the time (unix epoch offset) that this circuit was + /// completed. + var timestamp: UInt64 = 0 + + /// The incoming channel ID that carried the HTLC that created the circuit. + var chanIDIn: UInt64 = 0 + + /// The outgoing channel ID that carried the preimage that completed the + /// circuit. + var chanIDOut: UInt64 = 0 + + /// The total amount (in satoshis) of the incoming HTLC that created half + /// the circuit. + var amtIn: UInt64 = 0 + + /// The total amount (in satoshis) of the outgoing HTLC that created the + /// second half of the circuit. + var amtOut: UInt64 = 0 + + /// The total fee (in satoshis) that this payment circuit carried. + var fee: UInt64 = 0 + + /// The total fee (in milli-satoshis) that this payment circuit carried. + var feeMsat: UInt64 = 0 + + /// The total amount (in milli-satoshis) of the incoming HTLC that created + /// half the circuit. + var amtInMsat: UInt64 = 0 + + /// The total amount (in milli-satoshis) of the outgoing HTLC that created + /// the second half of the circuit. + var amtOutMsat: UInt64 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_ForwardingHistoryResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// A list of forwarding events from the time slice of the time series + /// specified in the request. + var forwardingEvents: [Lnrpc_ForwardingEvent] = [] + + /// The index of the last time in the set of returned forwarding events. Can + /// be used to seek further, pagination style. + var lastOffsetIndex: UInt32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_ExportChannelBackupRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The target channel point to obtain a back up for. + var chanPoint: Lnrpc_ChannelPoint { + get {return _chanPoint ?? Lnrpc_ChannelPoint()} + set {_chanPoint = newValue} + } + /// Returns true if `chanPoint` has been explicitly set. + var hasChanPoint: Bool {return self._chanPoint != nil} + /// Clears the value of `chanPoint`. Subsequent reads from it will return its default value. + mutating func clearChanPoint() {self._chanPoint = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _chanPoint: Lnrpc_ChannelPoint? = nil +} + +struct Lnrpc_ChannelBackup { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///Identifies the channel that this backup belongs to. + var chanPoint: Lnrpc_ChannelPoint { + get {return _chanPoint ?? Lnrpc_ChannelPoint()} + set {_chanPoint = newValue} + } + /// Returns true if `chanPoint` has been explicitly set. + var hasChanPoint: Bool {return self._chanPoint != nil} + /// Clears the value of `chanPoint`. Subsequent reads from it will return its default value. + mutating func clearChanPoint() {self._chanPoint = nil} + + /// + ///Is an encrypted single-chan backup. this can be passed to + ///RestoreChannelBackups, or the WalletUnlocker Init and Unlock methods in + ///order to trigger the recovery protocol. When using REST, this field must be + ///encoded as base64. + var chanBackup: Data = SwiftProtobuf.Internal.emptyData + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _chanPoint: Lnrpc_ChannelPoint? = nil +} + +struct Lnrpc_MultiChanBackup { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///Is the set of all channels that are included in this multi-channel backup. + var chanPoints: [Lnrpc_ChannelPoint] = [] + + /// + ///A single encrypted blob containing all the static channel backups of the + ///channel listed above. This can be stored as a single file or blob, and + ///safely be replaced with any prior/future versions. When using REST, this + ///field must be encoded as base64. + var multiChanBackup: Data = SwiftProtobuf.Internal.emptyData + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_ChanBackupExportRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_ChanBackupSnapshot { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The set of new channels that have been added since the last channel backup + ///snapshot was requested. + var singleChanBackups: Lnrpc_ChannelBackups { + get {return _singleChanBackups ?? Lnrpc_ChannelBackups()} + set {_singleChanBackups = newValue} + } + /// Returns true if `singleChanBackups` has been explicitly set. + var hasSingleChanBackups: Bool {return self._singleChanBackups != nil} + /// Clears the value of `singleChanBackups`. Subsequent reads from it will return its default value. + mutating func clearSingleChanBackups() {self._singleChanBackups = nil} + + /// + ///A multi-channel backup that covers all open channels currently known to + ///lnd. + var multiChanBackup: Lnrpc_MultiChanBackup { + get {return _multiChanBackup ?? Lnrpc_MultiChanBackup()} + set {_multiChanBackup = newValue} + } + /// Returns true if `multiChanBackup` has been explicitly set. + var hasMultiChanBackup: Bool {return self._multiChanBackup != nil} + /// Clears the value of `multiChanBackup`. Subsequent reads from it will return its default value. + mutating func clearMultiChanBackup() {self._multiChanBackup = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _singleChanBackups: Lnrpc_ChannelBackups? = nil + fileprivate var _multiChanBackup: Lnrpc_MultiChanBackup? = nil +} + +struct Lnrpc_ChannelBackups { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///A set of single-chan static channel backups. + var chanBackups: [Lnrpc_ChannelBackup] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_RestoreChanBackupRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var backup: Lnrpc_RestoreChanBackupRequest.OneOf_Backup? = nil + + /// + ///The channels to restore as a list of channel/backup pairs. + var chanBackups: Lnrpc_ChannelBackups { + get { + if case .chanBackups(let v)? = backup {return v} + return Lnrpc_ChannelBackups() + } + set {backup = .chanBackups(newValue)} + } + + /// + ///The channels to restore in the packed multi backup format. When using + ///REST, this field must be encoded as base64. + var multiChanBackup: Data { + get { + if case .multiChanBackup(let v)? = backup {return v} + return SwiftProtobuf.Internal.emptyData + } + set {backup = .multiChanBackup(newValue)} + } + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum OneOf_Backup: Equatable { + /// + ///The channels to restore as a list of channel/backup pairs. + case chanBackups(Lnrpc_ChannelBackups) + /// + ///The channels to restore in the packed multi backup format. When using + ///REST, this field must be encoded as base64. + case multiChanBackup(Data) + + #if !swift(>=4.1) + static func ==(lhs: Lnrpc_RestoreChanBackupRequest.OneOf_Backup, rhs: Lnrpc_RestoreChanBackupRequest.OneOf_Backup) -> Bool { + switch (lhs, rhs) { + case (.chanBackups(let l), .chanBackups(let r)): return l == r + case (.multiChanBackup(let l), .multiChanBackup(let r)): return l == r + default: return false + } + } + #endif + } + + init() {} +} + +struct Lnrpc_RestoreBackupResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_ChannelBackupSubscription { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_VerifyChanBackupResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_MacaroonPermission { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The entity a permission grants access to. + var entity: String = String() + + /// The action that is granted. + var action: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_BakeMacaroonRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The list of permissions the new macaroon should grant. + var permissions: [Lnrpc_MacaroonPermission] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_BakeMacaroonResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The hex encoded macaroon, serialized in binary format. + var macaroon: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_Failure { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Failure code as defined in the Lightning spec + var code: Lnrpc_Failure.FailureCode = .reserved + + /// An optional channel update message. + var channelUpdate: Lnrpc_ChannelUpdate { + get {return _channelUpdate ?? Lnrpc_ChannelUpdate()} + set {_channelUpdate = newValue} + } + /// Returns true if `channelUpdate` has been explicitly set. + var hasChannelUpdate: Bool {return self._channelUpdate != nil} + /// Clears the value of `channelUpdate`. Subsequent reads from it will return its default value. + mutating func clearChannelUpdate() {self._channelUpdate = nil} + + /// A failure type-dependent htlc value. + var htlcMsat: UInt64 = 0 + + /// The sha256 sum of the onion payload. + var onionSha256: Data = SwiftProtobuf.Internal.emptyData + + /// A failure type-dependent cltv expiry value. + var cltvExpiry: UInt32 = 0 + + /// A failure type-dependent flags value. + var flags: UInt32 = 0 + + /// + ///The position in the path of the intermediate or final node that generated + ///the failure message. Position zero is the sender node. + var failureSourceIndex: UInt32 = 0 + + /// A failure type-dependent block height. + var height: UInt32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum FailureCode: SwiftProtobuf.Enum { + typealias RawValue = Int + + /// + ///The numbers assigned in this enumeration match the failure codes as + ///defined in BOLT #4. Because protobuf 3 requires enums to start with 0, + ///a RESERVED value is added. + case reserved // = 0 + case incorrectOrUnknownPaymentDetails // = 1 + case incorrectPaymentAmount // = 2 + case finalIncorrectCltvExpiry // = 3 + case finalIncorrectHtlcAmount // = 4 + case finalExpiryTooSoon // = 5 + case invalidRealm // = 6 + case expiryTooSoon // = 7 + case invalidOnionVersion // = 8 + case invalidOnionHmac // = 9 + case invalidOnionKey // = 10 + case amountBelowMinimum // = 11 + case feeInsufficient // = 12 + case incorrectCltvExpiry // = 13 + case channelDisabled // = 14 + case temporaryChannelFailure // = 15 + case requiredNodeFeatureMissing // = 16 + case requiredChannelFeatureMissing // = 17 + case unknownNextPeer // = 18 + case temporaryNodeFailure // = 19 + case permanentNodeFailure // = 20 + case permanentChannelFailure // = 21 + case expiryTooFar // = 22 + case mppTimeout // = 23 + + /// + ///An internal error occurred. + case internalFailure // = 997 + + /// + ///The error source is known, but the failure itself couldn't be decoded. + case unknownFailure // = 998 + + /// + ///An unreadable failure result is returned if the received failure message + ///cannot be decrypted. In that case the error source is unknown. + case unreadableFailure // = 999 + case UNRECOGNIZED(Int) + + init() { + self = .reserved + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .reserved + case 1: self = .incorrectOrUnknownPaymentDetails + case 2: self = .incorrectPaymentAmount + case 3: self = .finalIncorrectCltvExpiry + case 4: self = .finalIncorrectHtlcAmount + case 5: self = .finalExpiryTooSoon + case 6: self = .invalidRealm + case 7: self = .expiryTooSoon + case 8: self = .invalidOnionVersion + case 9: self = .invalidOnionHmac + case 10: self = .invalidOnionKey + case 11: self = .amountBelowMinimum + case 12: self = .feeInsufficient + case 13: self = .incorrectCltvExpiry + case 14: self = .channelDisabled + case 15: self = .temporaryChannelFailure + case 16: self = .requiredNodeFeatureMissing + case 17: self = .requiredChannelFeatureMissing + case 18: self = .unknownNextPeer + case 19: self = .temporaryNodeFailure + case 20: self = .permanentNodeFailure + case 21: self = .permanentChannelFailure + case 22: self = .expiryTooFar + case 23: self = .mppTimeout + case 997: self = .internalFailure + case 998: self = .unknownFailure + case 999: self = .unreadableFailure + default: self = .UNRECOGNIZED(rawValue) + } + } + + var rawValue: Int { + switch self { + case .reserved: return 0 + case .incorrectOrUnknownPaymentDetails: return 1 + case .incorrectPaymentAmount: return 2 + case .finalIncorrectCltvExpiry: return 3 + case .finalIncorrectHtlcAmount: return 4 + case .finalExpiryTooSoon: return 5 + case .invalidRealm: return 6 + case .expiryTooSoon: return 7 + case .invalidOnionVersion: return 8 + case .invalidOnionHmac: return 9 + case .invalidOnionKey: return 10 + case .amountBelowMinimum: return 11 + case .feeInsufficient: return 12 + case .incorrectCltvExpiry: return 13 + case .channelDisabled: return 14 + case .temporaryChannelFailure: return 15 + case .requiredNodeFeatureMissing: return 16 + case .requiredChannelFeatureMissing: return 17 + case .unknownNextPeer: return 18 + case .temporaryNodeFailure: return 19 + case .permanentNodeFailure: return 20 + case .permanentChannelFailure: return 21 + case .expiryTooFar: return 22 + case .mppTimeout: return 23 + case .internalFailure: return 997 + case .unknownFailure: return 998 + case .unreadableFailure: return 999 + case .UNRECOGNIZED(let i): return i + } + } + + } + + init() {} + + fileprivate var _channelUpdate: Lnrpc_ChannelUpdate? = nil +} + +#if swift(>=4.2) + +extension Lnrpc_Failure.FailureCode: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static var allCases: [Lnrpc_Failure.FailureCode] = [ + .reserved, + .incorrectOrUnknownPaymentDetails, + .incorrectPaymentAmount, + .finalIncorrectCltvExpiry, + .finalIncorrectHtlcAmount, + .finalExpiryTooSoon, + .invalidRealm, + .expiryTooSoon, + .invalidOnionVersion, + .invalidOnionHmac, + .invalidOnionKey, + .amountBelowMinimum, + .feeInsufficient, + .incorrectCltvExpiry, + .channelDisabled, + .temporaryChannelFailure, + .requiredNodeFeatureMissing, + .requiredChannelFeatureMissing, + .unknownNextPeer, + .temporaryNodeFailure, + .permanentNodeFailure, + .permanentChannelFailure, + .expiryTooFar, + .mppTimeout, + .internalFailure, + .unknownFailure, + .unreadableFailure, + ] +} + +#endif // swift(>=4.2) + +struct Lnrpc_ChannelUpdate { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The signature that validates the announced data and proves the ownership + ///of node id. + var signature: Data = SwiftProtobuf.Internal.emptyData + + /// + ///The target chain that this channel was opened within. This value + ///should be the genesis hash of the target chain. Along with the short + ///channel ID, this uniquely identifies the channel globally in a + ///blockchain. + var chainHash: Data = SwiftProtobuf.Internal.emptyData + + /// + ///The unique description of the funding transaction. + var chanID: UInt64 = 0 + + /// + ///A timestamp that allows ordering in the case of multiple announcements. + ///We should ignore the message if timestamp is not greater than the + ///last-received. + var timestamp: UInt32 = 0 + + /// + ///The bitfield that describes whether optional fields are present in this + ///update. Currently, the least-significant bit must be set to 1 if the + ///optional field MaxHtlc is present. + var messageFlags: UInt32 = 0 + + /// + ///The bitfield that describes additional meta-data concerning how the + ///update is to be interpreted. Currently, the least-significant bit must be + ///set to 0 if the creating node corresponds to the first node in the + ///previously sent channel announcement and 1 otherwise. If the second bit + ///is set, then the channel is set to be disabled. + var channelFlags: UInt32 = 0 + + /// + ///The minimum number of blocks this node requires to be added to the expiry + ///of HTLCs. This is a security parameter determined by the node operator. + ///This value represents the required gap between the time locks of the + ///incoming and outgoing HTLC's set to this node. + var timeLockDelta: UInt32 = 0 + + /// + ///The minimum HTLC value which will be accepted. + var htlcMinimumMsat: UInt64 = 0 + + /// + ///The base fee that must be used for incoming HTLC's to this particular + ///channel. This value will be tacked onto the required for a payment + ///independent of the size of the payment. + var baseFee: UInt32 = 0 + + /// + ///The fee rate that will be charged per millionth of a satoshi. + var feeRate: UInt32 = 0 + + /// + ///The maximum HTLC value which will be accepted. + var htlcMaximumMsat: UInt64 = 0 + + /// + ///The set of data that was appended to this message, some of which we may + ///not actually know how to iterate or parse. By holding onto this data, we + ///ensure that we're able to properly validate the set of signatures that + ///cover these new fields, and ensure we're able to make upgrades to the + ///network in a forwards compatible manner. + var extraOpaqueData: Data = SwiftProtobuf.Internal.emptyData + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "lnrpc" + +extension Lnrpc_AddressType: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "WITNESS_PUBKEY_HASH"), + 1: .same(proto: "NESTED_PUBKEY_HASH"), + 2: .same(proto: "UNUSED_WITNESS_PUBKEY_HASH"), + 3: .same(proto: "UNUSED_NESTED_PUBKEY_HASH"), + ] +} + +extension Lnrpc_CommitmentType: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "LEGACY"), + 1: .same(proto: "STATIC_REMOTE_KEY"), + 2: .same(proto: "ANCHORS"), + 999: .same(proto: "UNKNOWN_COMMITMENT_TYPE"), + ] +} + +extension Lnrpc_Initiator: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "INITIATOR_UNKNOWN"), + 1: .same(proto: "INITIATOR_LOCAL"), + 2: .same(proto: "INITIATOR_REMOTE"), + 3: .same(proto: "INITIATOR_BOTH"), + ] +} + +extension Lnrpc_ResolutionType: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "TYPE_UNKNOWN"), + 1: .same(proto: "ANCHOR"), + 2: .same(proto: "INCOMING_HTLC"), + 3: .same(proto: "OUTGOING_HTLC"), + 4: .same(proto: "COMMIT"), + ] +} + +extension Lnrpc_ResolutionOutcome: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "OUTCOME_UNKNOWN"), + 1: .same(proto: "CLAIMED"), + 2: .same(proto: "UNCLAIMED"), + 3: .same(proto: "ABANDONED"), + 4: .same(proto: "FIRST_STAGE"), + 5: .same(proto: "TIMEOUT"), + ] +} + +extension Lnrpc_NodeMetricType: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN"), + 1: .same(proto: "BETWEENNESS_CENTRALITY"), + ] +} + +extension Lnrpc_InvoiceHTLCState: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "ACCEPTED"), + 1: .same(proto: "SETTLED"), + 2: .same(proto: "CANCELED"), + ] +} + +extension Lnrpc_PaymentFailureReason: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "FAILURE_REASON_NONE"), + 1: .same(proto: "FAILURE_REASON_TIMEOUT"), + 2: .same(proto: "FAILURE_REASON_NO_ROUTE"), + 3: .same(proto: "FAILURE_REASON_ERROR"), + 4: .same(proto: "FAILURE_REASON_INCORRECT_PAYMENT_DETAILS"), + 5: .same(proto: "FAILURE_REASON_INSUFFICIENT_BALANCE"), + ] +} + +extension Lnrpc_FeatureBit: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "DATALOSS_PROTECT_REQ"), + 1: .same(proto: "DATALOSS_PROTECT_OPT"), + 3: .same(proto: "INITIAL_ROUING_SYNC"), + 4: .same(proto: "UPFRONT_SHUTDOWN_SCRIPT_REQ"), + 5: .same(proto: "UPFRONT_SHUTDOWN_SCRIPT_OPT"), + 6: .same(proto: "GOSSIP_QUERIES_REQ"), + 7: .same(proto: "GOSSIP_QUERIES_OPT"), + 8: .same(proto: "TLV_ONION_REQ"), + 9: .same(proto: "TLV_ONION_OPT"), + 10: .same(proto: "EXT_GOSSIP_QUERIES_REQ"), + 11: .same(proto: "EXT_GOSSIP_QUERIES_OPT"), + 12: .same(proto: "STATIC_REMOTE_KEY_REQ"), + 13: .same(proto: "STATIC_REMOTE_KEY_OPT"), + 14: .same(proto: "PAYMENT_ADDR_REQ"), + 15: .same(proto: "PAYMENT_ADDR_OPT"), + 16: .same(proto: "MPP_REQ"), + 17: .same(proto: "MPP_OPT"), + ] +} + +extension Lnrpc_Utxo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Utxo" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "address_type"), + 2: .same(proto: "address"), + 3: .standard(proto: "amount_sat"), + 4: .standard(proto: "pk_script"), + 5: .same(proto: "outpoint"), + 6: .same(proto: "confirmations"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularEnumField(value: &self.addressType) + case 2: try decoder.decodeSingularStringField(value: &self.address) + case 3: try decoder.decodeSingularInt64Field(value: &self.amountSat) + case 4: try decoder.decodeSingularStringField(value: &self.pkScript) + case 5: try decoder.decodeSingularMessageField(value: &self._outpoint) + case 6: try decoder.decodeSingularInt64Field(value: &self.confirmations) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.addressType != .witnessPubkeyHash { + try visitor.visitSingularEnumField(value: self.addressType, fieldNumber: 1) + } + if !self.address.isEmpty { + try visitor.visitSingularStringField(value: self.address, fieldNumber: 2) + } + if self.amountSat != 0 { + try visitor.visitSingularInt64Field(value: self.amountSat, fieldNumber: 3) + } + if !self.pkScript.isEmpty { + try visitor.visitSingularStringField(value: self.pkScript, fieldNumber: 4) + } + if let v = self._outpoint { + try visitor.visitSingularMessageField(value: v, fieldNumber: 5) + } + if self.confirmations != 0 { + try visitor.visitSingularInt64Field(value: self.confirmations, fieldNumber: 6) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_Utxo, rhs: Lnrpc_Utxo) -> Bool { + if lhs.addressType != rhs.addressType {return false} + if lhs.address != rhs.address {return false} + if lhs.amountSat != rhs.amountSat {return false} + if lhs.pkScript != rhs.pkScript {return false} + if lhs._outpoint != rhs._outpoint {return false} + if lhs.confirmations != rhs.confirmations {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_Transaction: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Transaction" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "tx_hash"), + 2: .same(proto: "amount"), + 3: .standard(proto: "num_confirmations"), + 4: .standard(proto: "block_hash"), + 5: .standard(proto: "block_height"), + 6: .standard(proto: "time_stamp"), + 7: .standard(proto: "total_fees"), + 8: .standard(proto: "dest_addresses"), + 9: .standard(proto: "raw_tx_hex"), + 10: .same(proto: "label"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.txHash) + case 2: try decoder.decodeSingularInt64Field(value: &self.amount) + case 3: try decoder.decodeSingularInt32Field(value: &self.numConfirmations) + case 4: try decoder.decodeSingularStringField(value: &self.blockHash) + case 5: try decoder.decodeSingularInt32Field(value: &self.blockHeight) + case 6: try decoder.decodeSingularInt64Field(value: &self.timeStamp) + case 7: try decoder.decodeSingularInt64Field(value: &self.totalFees) + case 8: try decoder.decodeRepeatedStringField(value: &self.destAddresses) + case 9: try decoder.decodeSingularStringField(value: &self.rawTxHex) + case 10: try decoder.decodeSingularStringField(value: &self.label) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.txHash.isEmpty { + try visitor.visitSingularStringField(value: self.txHash, fieldNumber: 1) + } + if self.amount != 0 { + try visitor.visitSingularInt64Field(value: self.amount, fieldNumber: 2) + } + if self.numConfirmations != 0 { + try visitor.visitSingularInt32Field(value: self.numConfirmations, fieldNumber: 3) + } + if !self.blockHash.isEmpty { + try visitor.visitSingularStringField(value: self.blockHash, fieldNumber: 4) + } + if self.blockHeight != 0 { + try visitor.visitSingularInt32Field(value: self.blockHeight, fieldNumber: 5) + } + if self.timeStamp != 0 { + try visitor.visitSingularInt64Field(value: self.timeStamp, fieldNumber: 6) + } + if self.totalFees != 0 { + try visitor.visitSingularInt64Field(value: self.totalFees, fieldNumber: 7) + } + if !self.destAddresses.isEmpty { + try visitor.visitRepeatedStringField(value: self.destAddresses, fieldNumber: 8) + } + if !self.rawTxHex.isEmpty { + try visitor.visitSingularStringField(value: self.rawTxHex, fieldNumber: 9) + } + if !self.label.isEmpty { + try visitor.visitSingularStringField(value: self.label, fieldNumber: 10) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_Transaction, rhs: Lnrpc_Transaction) -> Bool { + if lhs.txHash != rhs.txHash {return false} + if lhs.amount != rhs.amount {return false} + if lhs.numConfirmations != rhs.numConfirmations {return false} + if lhs.blockHash != rhs.blockHash {return false} + if lhs.blockHeight != rhs.blockHeight {return false} + if lhs.timeStamp != rhs.timeStamp {return false} + if lhs.totalFees != rhs.totalFees {return false} + if lhs.destAddresses != rhs.destAddresses {return false} + if lhs.rawTxHex != rhs.rawTxHex {return false} + if lhs.label != rhs.label {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_GetTransactionsRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".GetTransactionsRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "start_height"), + 2: .standard(proto: "end_height"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularInt32Field(value: &self.startHeight) + case 2: try decoder.decodeSingularInt32Field(value: &self.endHeight) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.startHeight != 0 { + try visitor.visitSingularInt32Field(value: self.startHeight, fieldNumber: 1) + } + if self.endHeight != 0 { + try visitor.visitSingularInt32Field(value: self.endHeight, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_GetTransactionsRequest, rhs: Lnrpc_GetTransactionsRequest) -> Bool { + if lhs.startHeight != rhs.startHeight {return false} + if lhs.endHeight != rhs.endHeight {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_TransactionDetails: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".TransactionDetails" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "transactions"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedMessageField(value: &self.transactions) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.transactions.isEmpty { + try visitor.visitRepeatedMessageField(value: self.transactions, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_TransactionDetails, rhs: Lnrpc_TransactionDetails) -> Bool { + if lhs.transactions != rhs.transactions {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_FeeLimit: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".FeeLimit" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "fixed"), + 3: .standard(proto: "fixed_msat"), + 2: .same(proto: "percent"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: + if self.limit != nil {try decoder.handleConflictingOneOf()} + var v: Int64? + try decoder.decodeSingularInt64Field(value: &v) + if let v = v {self.limit = .fixed(v)} + case 2: + if self.limit != nil {try decoder.handleConflictingOneOf()} + var v: Int64? + try decoder.decodeSingularInt64Field(value: &v) + if let v = v {self.limit = .percent(v)} + case 3: + if self.limit != nil {try decoder.handleConflictingOneOf()} + var v: Int64? + try decoder.decodeSingularInt64Field(value: &v) + if let v = v {self.limit = .fixedMsat(v)} + default: break + } + } + } + + func traverse(visitor: inout V) throws { + switch self.limit { + case .fixed(let v)?: + try visitor.visitSingularInt64Field(value: v, fieldNumber: 1) + case .percent(let v)?: + try visitor.visitSingularInt64Field(value: v, fieldNumber: 2) + case .fixedMsat(let v)?: + try visitor.visitSingularInt64Field(value: v, fieldNumber: 3) + case nil: break + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_FeeLimit, rhs: Lnrpc_FeeLimit) -> Bool { + if lhs.limit != rhs.limit {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_SendRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SendRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "dest"), + 2: .standard(proto: "dest_string"), + 3: .same(proto: "amt"), + 12: .standard(proto: "amt_msat"), + 4: .standard(proto: "payment_hash"), + 5: .standard(proto: "payment_hash_string"), + 6: .standard(proto: "payment_request"), + 7: .standard(proto: "final_cltv_delta"), + 8: .standard(proto: "fee_limit"), + 9: .standard(proto: "outgoing_chan_id"), + 13: .standard(proto: "last_hop_pubkey"), + 10: .standard(proto: "cltv_limit"), + 11: .standard(proto: "dest_custom_records"), + 14: .standard(proto: "allow_self_payment"), + 15: .standard(proto: "dest_features"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.dest) + case 2: try decoder.decodeSingularStringField(value: &self.destString) + case 3: try decoder.decodeSingularInt64Field(value: &self.amt) + case 4: try decoder.decodeSingularBytesField(value: &self.paymentHash) + case 5: try decoder.decodeSingularStringField(value: &self.paymentHashString) + case 6: try decoder.decodeSingularStringField(value: &self.paymentRequest) + case 7: try decoder.decodeSingularInt32Field(value: &self.finalCltvDelta) + case 8: try decoder.decodeSingularMessageField(value: &self._feeLimit) + case 9: try decoder.decodeSingularUInt64Field(value: &self.outgoingChanID) + case 10: try decoder.decodeSingularUInt32Field(value: &self.cltvLimit) + case 11: try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: &self.destCustomRecords) + case 12: try decoder.decodeSingularInt64Field(value: &self.amtMsat) + case 13: try decoder.decodeSingularBytesField(value: &self.lastHopPubkey) + case 14: try decoder.decodeSingularBoolField(value: &self.allowSelfPayment) + case 15: try decoder.decodeRepeatedEnumField(value: &self.destFeatures) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.dest.isEmpty { + try visitor.visitSingularBytesField(value: self.dest, fieldNumber: 1) + } + if !self.destString.isEmpty { + try visitor.visitSingularStringField(value: self.destString, fieldNumber: 2) + } + if self.amt != 0 { + try visitor.visitSingularInt64Field(value: self.amt, fieldNumber: 3) + } + if !self.paymentHash.isEmpty { + try visitor.visitSingularBytesField(value: self.paymentHash, fieldNumber: 4) + } + if !self.paymentHashString.isEmpty { + try visitor.visitSingularStringField(value: self.paymentHashString, fieldNumber: 5) + } + if !self.paymentRequest.isEmpty { + try visitor.visitSingularStringField(value: self.paymentRequest, fieldNumber: 6) + } + if self.finalCltvDelta != 0 { + try visitor.visitSingularInt32Field(value: self.finalCltvDelta, fieldNumber: 7) + } + if let v = self._feeLimit { + try visitor.visitSingularMessageField(value: v, fieldNumber: 8) + } + if self.outgoingChanID != 0 { + try visitor.visitSingularUInt64Field(value: self.outgoingChanID, fieldNumber: 9) + } + if self.cltvLimit != 0 { + try visitor.visitSingularUInt32Field(value: self.cltvLimit, fieldNumber: 10) + } + if !self.destCustomRecords.isEmpty { + try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: self.destCustomRecords, fieldNumber: 11) + } + if self.amtMsat != 0 { + try visitor.visitSingularInt64Field(value: self.amtMsat, fieldNumber: 12) + } + if !self.lastHopPubkey.isEmpty { + try visitor.visitSingularBytesField(value: self.lastHopPubkey, fieldNumber: 13) + } + if self.allowSelfPayment != false { + try visitor.visitSingularBoolField(value: self.allowSelfPayment, fieldNumber: 14) + } + if !self.destFeatures.isEmpty { + try visitor.visitPackedEnumField(value: self.destFeatures, fieldNumber: 15) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_SendRequest, rhs: Lnrpc_SendRequest) -> Bool { + if lhs.dest != rhs.dest {return false} + if lhs.destString != rhs.destString {return false} + if lhs.amt != rhs.amt {return false} + if lhs.amtMsat != rhs.amtMsat {return false} + if lhs.paymentHash != rhs.paymentHash {return false} + if lhs.paymentHashString != rhs.paymentHashString {return false} + if lhs.paymentRequest != rhs.paymentRequest {return false} + if lhs.finalCltvDelta != rhs.finalCltvDelta {return false} + if lhs._feeLimit != rhs._feeLimit {return false} + if lhs.outgoingChanID != rhs.outgoingChanID {return false} + if lhs.lastHopPubkey != rhs.lastHopPubkey {return false} + if lhs.cltvLimit != rhs.cltvLimit {return false} + if lhs.destCustomRecords != rhs.destCustomRecords {return false} + if lhs.allowSelfPayment != rhs.allowSelfPayment {return false} + if lhs.destFeatures != rhs.destFeatures {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_SendResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SendResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "payment_error"), + 2: .standard(proto: "payment_preimage"), + 3: .standard(proto: "payment_route"), + 4: .standard(proto: "payment_hash"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.paymentError) + case 2: try decoder.decodeSingularBytesField(value: &self.paymentPreimage) + case 3: try decoder.decodeSingularMessageField(value: &self._paymentRoute) + case 4: try decoder.decodeSingularBytesField(value: &self.paymentHash) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.paymentError.isEmpty { + try visitor.visitSingularStringField(value: self.paymentError, fieldNumber: 1) + } + if !self.paymentPreimage.isEmpty { + try visitor.visitSingularBytesField(value: self.paymentPreimage, fieldNumber: 2) + } + if let v = self._paymentRoute { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } + if !self.paymentHash.isEmpty { + try visitor.visitSingularBytesField(value: self.paymentHash, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_SendResponse, rhs: Lnrpc_SendResponse) -> Bool { + if lhs.paymentError != rhs.paymentError {return false} + if lhs.paymentPreimage != rhs.paymentPreimage {return false} + if lhs._paymentRoute != rhs._paymentRoute {return false} + if lhs.paymentHash != rhs.paymentHash {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_SendToRouteRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SendToRouteRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "payment_hash"), + 2: .standard(proto: "payment_hash_string"), + 4: .same(proto: "route"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.paymentHash) + case 2: try decoder.decodeSingularStringField(value: &self.paymentHashString) + case 4: try decoder.decodeSingularMessageField(value: &self._route) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.paymentHash.isEmpty { + try visitor.visitSingularBytesField(value: self.paymentHash, fieldNumber: 1) + } + if !self.paymentHashString.isEmpty { + try visitor.visitSingularStringField(value: self.paymentHashString, fieldNumber: 2) + } + if let v = self._route { + try visitor.visitSingularMessageField(value: v, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_SendToRouteRequest, rhs: Lnrpc_SendToRouteRequest) -> Bool { + if lhs.paymentHash != rhs.paymentHash {return false} + if lhs.paymentHashString != rhs.paymentHashString {return false} + if lhs._route != rhs._route {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ChannelAcceptRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ChannelAcceptRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "node_pubkey"), + 2: .standard(proto: "chain_hash"), + 3: .standard(proto: "pending_chan_id"), + 4: .standard(proto: "funding_amt"), + 5: .standard(proto: "push_amt"), + 6: .standard(proto: "dust_limit"), + 7: .standard(proto: "max_value_in_flight"), + 8: .standard(proto: "channel_reserve"), + 9: .standard(proto: "min_htlc"), + 10: .standard(proto: "fee_per_kw"), + 11: .standard(proto: "csv_delay"), + 12: .standard(proto: "max_accepted_htlcs"), + 13: .standard(proto: "channel_flags"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.nodePubkey) + case 2: try decoder.decodeSingularBytesField(value: &self.chainHash) + case 3: try decoder.decodeSingularBytesField(value: &self.pendingChanID) + case 4: try decoder.decodeSingularUInt64Field(value: &self.fundingAmt) + case 5: try decoder.decodeSingularUInt64Field(value: &self.pushAmt) + case 6: try decoder.decodeSingularUInt64Field(value: &self.dustLimit) + case 7: try decoder.decodeSingularUInt64Field(value: &self.maxValueInFlight) + case 8: try decoder.decodeSingularUInt64Field(value: &self.channelReserve) + case 9: try decoder.decodeSingularUInt64Field(value: &self.minHtlc) + case 10: try decoder.decodeSingularUInt64Field(value: &self.feePerKw) + case 11: try decoder.decodeSingularUInt32Field(value: &self.csvDelay) + case 12: try decoder.decodeSingularUInt32Field(value: &self.maxAcceptedHtlcs) + case 13: try decoder.decodeSingularUInt32Field(value: &self.channelFlags) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.nodePubkey.isEmpty { + try visitor.visitSingularBytesField(value: self.nodePubkey, fieldNumber: 1) + } + if !self.chainHash.isEmpty { + try visitor.visitSingularBytesField(value: self.chainHash, fieldNumber: 2) + } + if !self.pendingChanID.isEmpty { + try visitor.visitSingularBytesField(value: self.pendingChanID, fieldNumber: 3) + } + if self.fundingAmt != 0 { + try visitor.visitSingularUInt64Field(value: self.fundingAmt, fieldNumber: 4) + } + if self.pushAmt != 0 { + try visitor.visitSingularUInt64Field(value: self.pushAmt, fieldNumber: 5) + } + if self.dustLimit != 0 { + try visitor.visitSingularUInt64Field(value: self.dustLimit, fieldNumber: 6) + } + if self.maxValueInFlight != 0 { + try visitor.visitSingularUInt64Field(value: self.maxValueInFlight, fieldNumber: 7) + } + if self.channelReserve != 0 { + try visitor.visitSingularUInt64Field(value: self.channelReserve, fieldNumber: 8) + } + if self.minHtlc != 0 { + try visitor.visitSingularUInt64Field(value: self.minHtlc, fieldNumber: 9) + } + if self.feePerKw != 0 { + try visitor.visitSingularUInt64Field(value: self.feePerKw, fieldNumber: 10) + } + if self.csvDelay != 0 { + try visitor.visitSingularUInt32Field(value: self.csvDelay, fieldNumber: 11) + } + if self.maxAcceptedHtlcs != 0 { + try visitor.visitSingularUInt32Field(value: self.maxAcceptedHtlcs, fieldNumber: 12) + } + if self.channelFlags != 0 { + try visitor.visitSingularUInt32Field(value: self.channelFlags, fieldNumber: 13) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ChannelAcceptRequest, rhs: Lnrpc_ChannelAcceptRequest) -> Bool { + if lhs.nodePubkey != rhs.nodePubkey {return false} + if lhs.chainHash != rhs.chainHash {return false} + if lhs.pendingChanID != rhs.pendingChanID {return false} + if lhs.fundingAmt != rhs.fundingAmt {return false} + if lhs.pushAmt != rhs.pushAmt {return false} + if lhs.dustLimit != rhs.dustLimit {return false} + if lhs.maxValueInFlight != rhs.maxValueInFlight {return false} + if lhs.channelReserve != rhs.channelReserve {return false} + if lhs.minHtlc != rhs.minHtlc {return false} + if lhs.feePerKw != rhs.feePerKw {return false} + if lhs.csvDelay != rhs.csvDelay {return false} + if lhs.maxAcceptedHtlcs != rhs.maxAcceptedHtlcs {return false} + if lhs.channelFlags != rhs.channelFlags {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ChannelAcceptResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ChannelAcceptResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "accept"), + 2: .standard(proto: "pending_chan_id"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBoolField(value: &self.accept) + case 2: try decoder.decodeSingularBytesField(value: &self.pendingChanID) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.accept != false { + try visitor.visitSingularBoolField(value: self.accept, fieldNumber: 1) + } + if !self.pendingChanID.isEmpty { + try visitor.visitSingularBytesField(value: self.pendingChanID, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ChannelAcceptResponse, rhs: Lnrpc_ChannelAcceptResponse) -> Bool { + if lhs.accept != rhs.accept {return false} + if lhs.pendingChanID != rhs.pendingChanID {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ChannelPoint: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ChannelPoint" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "funding_txid_bytes"), + 2: .standard(proto: "funding_txid_str"), + 3: .standard(proto: "output_index"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: + if self.fundingTxid != nil {try decoder.handleConflictingOneOf()} + var v: Data? + try decoder.decodeSingularBytesField(value: &v) + if let v = v {self.fundingTxid = .fundingTxidBytes(v)} + case 2: + if self.fundingTxid != nil {try decoder.handleConflictingOneOf()} + var v: String? + try decoder.decodeSingularStringField(value: &v) + if let v = v {self.fundingTxid = .fundingTxidStr(v)} + case 3: try decoder.decodeSingularUInt32Field(value: &self.outputIndex) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + switch self.fundingTxid { + case .fundingTxidBytes(let v)?: + try visitor.visitSingularBytesField(value: v, fieldNumber: 1) + case .fundingTxidStr(let v)?: + try visitor.visitSingularStringField(value: v, fieldNumber: 2) + case nil: break + } + if self.outputIndex != 0 { + try visitor.visitSingularUInt32Field(value: self.outputIndex, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ChannelPoint, rhs: Lnrpc_ChannelPoint) -> Bool { + if lhs.fundingTxid != rhs.fundingTxid {return false} + if lhs.outputIndex != rhs.outputIndex {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_OutPoint: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".OutPoint" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "txid_bytes"), + 2: .standard(proto: "txid_str"), + 3: .standard(proto: "output_index"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.txidBytes) + case 2: try decoder.decodeSingularStringField(value: &self.txidStr) + case 3: try decoder.decodeSingularUInt32Field(value: &self.outputIndex) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.txidBytes.isEmpty { + try visitor.visitSingularBytesField(value: self.txidBytes, fieldNumber: 1) + } + if !self.txidStr.isEmpty { + try visitor.visitSingularStringField(value: self.txidStr, fieldNumber: 2) + } + if self.outputIndex != 0 { + try visitor.visitSingularUInt32Field(value: self.outputIndex, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_OutPoint, rhs: Lnrpc_OutPoint) -> Bool { + if lhs.txidBytes != rhs.txidBytes {return false} + if lhs.txidStr != rhs.txidStr {return false} + if lhs.outputIndex != rhs.outputIndex {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_LightningAddress: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".LightningAddress" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "pubkey"), + 2: .same(proto: "host"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.pubkey) + case 2: try decoder.decodeSingularStringField(value: &self.host) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.pubkey.isEmpty { + try visitor.visitSingularStringField(value: self.pubkey, fieldNumber: 1) + } + if !self.host.isEmpty { + try visitor.visitSingularStringField(value: self.host, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_LightningAddress, rhs: Lnrpc_LightningAddress) -> Bool { + if lhs.pubkey != rhs.pubkey {return false} + if lhs.host != rhs.host {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_EstimateFeeRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".EstimateFeeRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "AddrToAmount"), + 2: .standard(proto: "target_conf"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: &self.addrToAmount) + case 2: try decoder.decodeSingularInt32Field(value: &self.targetConf) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.addrToAmount.isEmpty { + try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: self.addrToAmount, fieldNumber: 1) + } + if self.targetConf != 0 { + try visitor.visitSingularInt32Field(value: self.targetConf, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_EstimateFeeRequest, rhs: Lnrpc_EstimateFeeRequest) -> Bool { + if lhs.addrToAmount != rhs.addrToAmount {return false} + if lhs.targetConf != rhs.targetConf {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_EstimateFeeResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".EstimateFeeResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "fee_sat"), + 2: .standard(proto: "feerate_sat_per_byte"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularInt64Field(value: &self.feeSat) + case 2: try decoder.decodeSingularInt64Field(value: &self.feerateSatPerByte) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.feeSat != 0 { + try visitor.visitSingularInt64Field(value: self.feeSat, fieldNumber: 1) + } + if self.feerateSatPerByte != 0 { + try visitor.visitSingularInt64Field(value: self.feerateSatPerByte, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_EstimateFeeResponse, rhs: Lnrpc_EstimateFeeResponse) -> Bool { + if lhs.feeSat != rhs.feeSat {return false} + if lhs.feerateSatPerByte != rhs.feerateSatPerByte {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_SendManyRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SendManyRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "AddrToAmount"), + 3: .standard(proto: "target_conf"), + 5: .standard(proto: "sat_per_byte"), + 6: .same(proto: "label"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: &self.addrToAmount) + case 3: try decoder.decodeSingularInt32Field(value: &self.targetConf) + case 5: try decoder.decodeSingularInt64Field(value: &self.satPerByte) + case 6: try decoder.decodeSingularStringField(value: &self.label) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.addrToAmount.isEmpty { + try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: self.addrToAmount, fieldNumber: 1) + } + if self.targetConf != 0 { + try visitor.visitSingularInt32Field(value: self.targetConf, fieldNumber: 3) + } + if self.satPerByte != 0 { + try visitor.visitSingularInt64Field(value: self.satPerByte, fieldNumber: 5) + } + if !self.label.isEmpty { + try visitor.visitSingularStringField(value: self.label, fieldNumber: 6) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_SendManyRequest, rhs: Lnrpc_SendManyRequest) -> Bool { + if lhs.addrToAmount != rhs.addrToAmount {return false} + if lhs.targetConf != rhs.targetConf {return false} + if lhs.satPerByte != rhs.satPerByte {return false} + if lhs.label != rhs.label {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_SendManyResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SendManyResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "txid"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.txid) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.txid.isEmpty { + try visitor.visitSingularStringField(value: self.txid, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_SendManyResponse, rhs: Lnrpc_SendManyResponse) -> Bool { + if lhs.txid != rhs.txid {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_SendCoinsRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SendCoinsRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "addr"), + 2: .same(proto: "amount"), + 3: .standard(proto: "target_conf"), + 5: .standard(proto: "sat_per_byte"), + 6: .standard(proto: "send_all"), + 7: .same(proto: "label"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.addr) + case 2: try decoder.decodeSingularInt64Field(value: &self.amount) + case 3: try decoder.decodeSingularInt32Field(value: &self.targetConf) + case 5: try decoder.decodeSingularInt64Field(value: &self.satPerByte) + case 6: try decoder.decodeSingularBoolField(value: &self.sendAll) + case 7: try decoder.decodeSingularStringField(value: &self.label) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.addr.isEmpty { + try visitor.visitSingularStringField(value: self.addr, fieldNumber: 1) + } + if self.amount != 0 { + try visitor.visitSingularInt64Field(value: self.amount, fieldNumber: 2) + } + if self.targetConf != 0 { + try visitor.visitSingularInt32Field(value: self.targetConf, fieldNumber: 3) + } + if self.satPerByte != 0 { + try visitor.visitSingularInt64Field(value: self.satPerByte, fieldNumber: 5) + } + if self.sendAll != false { + try visitor.visitSingularBoolField(value: self.sendAll, fieldNumber: 6) + } + if !self.label.isEmpty { + try visitor.visitSingularStringField(value: self.label, fieldNumber: 7) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_SendCoinsRequest, rhs: Lnrpc_SendCoinsRequest) -> Bool { + if lhs.addr != rhs.addr {return false} + if lhs.amount != rhs.amount {return false} + if lhs.targetConf != rhs.targetConf {return false} + if lhs.satPerByte != rhs.satPerByte {return false} + if lhs.sendAll != rhs.sendAll {return false} + if lhs.label != rhs.label {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_SendCoinsResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SendCoinsResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "txid"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.txid) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.txid.isEmpty { + try visitor.visitSingularStringField(value: self.txid, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_SendCoinsResponse, rhs: Lnrpc_SendCoinsResponse) -> Bool { + if lhs.txid != rhs.txid {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ListUnspentRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ListUnspentRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "min_confs"), + 2: .standard(proto: "max_confs"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularInt32Field(value: &self.minConfs) + case 2: try decoder.decodeSingularInt32Field(value: &self.maxConfs) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.minConfs != 0 { + try visitor.visitSingularInt32Field(value: self.minConfs, fieldNumber: 1) + } + if self.maxConfs != 0 { + try visitor.visitSingularInt32Field(value: self.maxConfs, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ListUnspentRequest, rhs: Lnrpc_ListUnspentRequest) -> Bool { + if lhs.minConfs != rhs.minConfs {return false} + if lhs.maxConfs != rhs.maxConfs {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ListUnspentResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ListUnspentResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "utxos"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedMessageField(value: &self.utxos) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.utxos.isEmpty { + try visitor.visitRepeatedMessageField(value: self.utxos, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ListUnspentResponse, rhs: Lnrpc_ListUnspentResponse) -> Bool { + if lhs.utxos != rhs.utxos {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_NewAddressRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".NewAddressRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "type"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularEnumField(value: &self.type) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.type != .witnessPubkeyHash { + try visitor.visitSingularEnumField(value: self.type, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_NewAddressRequest, rhs: Lnrpc_NewAddressRequest) -> Bool { + if lhs.type != rhs.type {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_NewAddressResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".NewAddressResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "address"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.address) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.address.isEmpty { + try visitor.visitSingularStringField(value: self.address, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_NewAddressResponse, rhs: Lnrpc_NewAddressResponse) -> Bool { + if lhs.address != rhs.address {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_SignMessageRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SignMessageRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "msg"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.msg) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.msg.isEmpty { + try visitor.visitSingularBytesField(value: self.msg, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_SignMessageRequest, rhs: Lnrpc_SignMessageRequest) -> Bool { + if lhs.msg != rhs.msg {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_SignMessageResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SignMessageResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "signature"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.signature) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.signature.isEmpty { + try visitor.visitSingularStringField(value: self.signature, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_SignMessageResponse, rhs: Lnrpc_SignMessageResponse) -> Bool { + if lhs.signature != rhs.signature {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_VerifyMessageRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".VerifyMessageRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "msg"), + 2: .same(proto: "signature"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.msg) + case 2: try decoder.decodeSingularStringField(value: &self.signature) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.msg.isEmpty { + try visitor.visitSingularBytesField(value: self.msg, fieldNumber: 1) + } + if !self.signature.isEmpty { + try visitor.visitSingularStringField(value: self.signature, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_VerifyMessageRequest, rhs: Lnrpc_VerifyMessageRequest) -> Bool { + if lhs.msg != rhs.msg {return false} + if lhs.signature != rhs.signature {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_VerifyMessageResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".VerifyMessageResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "valid"), + 2: .same(proto: "pubkey"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBoolField(value: &self.valid) + case 2: try decoder.decodeSingularStringField(value: &self.pubkey) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.valid != false { + try visitor.visitSingularBoolField(value: self.valid, fieldNumber: 1) + } + if !self.pubkey.isEmpty { + try visitor.visitSingularStringField(value: self.pubkey, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_VerifyMessageResponse, rhs: Lnrpc_VerifyMessageResponse) -> Bool { + if lhs.valid != rhs.valid {return false} + if lhs.pubkey != rhs.pubkey {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ConnectPeerRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ConnectPeerRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "addr"), + 2: .same(proto: "perm"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &self._addr) + case 2: try decoder.decodeSingularBoolField(value: &self.perm) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._addr { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + if self.perm != false { + try visitor.visitSingularBoolField(value: self.perm, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ConnectPeerRequest, rhs: Lnrpc_ConnectPeerRequest) -> Bool { + if lhs._addr != rhs._addr {return false} + if lhs.perm != rhs.perm {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ConnectPeerResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ConnectPeerResponse" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ConnectPeerResponse, rhs: Lnrpc_ConnectPeerResponse) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_DisconnectPeerRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".DisconnectPeerRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "pub_key"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.pubKey) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.pubKey.isEmpty { + try visitor.visitSingularStringField(value: self.pubKey, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_DisconnectPeerRequest, rhs: Lnrpc_DisconnectPeerRequest) -> Bool { + if lhs.pubKey != rhs.pubKey {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_DisconnectPeerResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".DisconnectPeerResponse" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_DisconnectPeerResponse, rhs: Lnrpc_DisconnectPeerResponse) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_HTLC: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".HTLC" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "incoming"), + 2: .same(proto: "amount"), + 3: .standard(proto: "hash_lock"), + 4: .standard(proto: "expiration_height"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBoolField(value: &self.incoming) + case 2: try decoder.decodeSingularInt64Field(value: &self.amount) + case 3: try decoder.decodeSingularBytesField(value: &self.hashLock) + case 4: try decoder.decodeSingularUInt32Field(value: &self.expirationHeight) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.incoming != false { + try visitor.visitSingularBoolField(value: self.incoming, fieldNumber: 1) + } + if self.amount != 0 { + try visitor.visitSingularInt64Field(value: self.amount, fieldNumber: 2) + } + if !self.hashLock.isEmpty { + try visitor.visitSingularBytesField(value: self.hashLock, fieldNumber: 3) + } + if self.expirationHeight != 0 { + try visitor.visitSingularUInt32Field(value: self.expirationHeight, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_HTLC, rhs: Lnrpc_HTLC) -> Bool { + if lhs.incoming != rhs.incoming {return false} + if lhs.amount != rhs.amount {return false} + if lhs.hashLock != rhs.hashLock {return false} + if lhs.expirationHeight != rhs.expirationHeight {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ChannelConstraints: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ChannelConstraints" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "csv_delay"), + 2: .standard(proto: "chan_reserve_sat"), + 3: .standard(proto: "dust_limit_sat"), + 4: .standard(proto: "max_pending_amt_msat"), + 5: .standard(proto: "min_htlc_msat"), + 6: .standard(proto: "max_accepted_htlcs"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt32Field(value: &self.csvDelay) + case 2: try decoder.decodeSingularUInt64Field(value: &self.chanReserveSat) + case 3: try decoder.decodeSingularUInt64Field(value: &self.dustLimitSat) + case 4: try decoder.decodeSingularUInt64Field(value: &self.maxPendingAmtMsat) + case 5: try decoder.decodeSingularUInt64Field(value: &self.minHtlcMsat) + case 6: try decoder.decodeSingularUInt32Field(value: &self.maxAcceptedHtlcs) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.csvDelay != 0 { + try visitor.visitSingularUInt32Field(value: self.csvDelay, fieldNumber: 1) + } + if self.chanReserveSat != 0 { + try visitor.visitSingularUInt64Field(value: self.chanReserveSat, fieldNumber: 2) + } + if self.dustLimitSat != 0 { + try visitor.visitSingularUInt64Field(value: self.dustLimitSat, fieldNumber: 3) + } + if self.maxPendingAmtMsat != 0 { + try visitor.visitSingularUInt64Field(value: self.maxPendingAmtMsat, fieldNumber: 4) + } + if self.minHtlcMsat != 0 { + try visitor.visitSingularUInt64Field(value: self.minHtlcMsat, fieldNumber: 5) + } + if self.maxAcceptedHtlcs != 0 { + try visitor.visitSingularUInt32Field(value: self.maxAcceptedHtlcs, fieldNumber: 6) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ChannelConstraints, rhs: Lnrpc_ChannelConstraints) -> Bool { + if lhs.csvDelay != rhs.csvDelay {return false} + if lhs.chanReserveSat != rhs.chanReserveSat {return false} + if lhs.dustLimitSat != rhs.dustLimitSat {return false} + if lhs.maxPendingAmtMsat != rhs.maxPendingAmtMsat {return false} + if lhs.minHtlcMsat != rhs.minHtlcMsat {return false} + if lhs.maxAcceptedHtlcs != rhs.maxAcceptedHtlcs {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_Channel: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Channel" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "active"), + 2: .standard(proto: "remote_pubkey"), + 3: .standard(proto: "channel_point"), + 4: .standard(proto: "chan_id"), + 5: .same(proto: "capacity"), + 6: .standard(proto: "local_balance"), + 7: .standard(proto: "remote_balance"), + 8: .standard(proto: "commit_fee"), + 9: .standard(proto: "commit_weight"), + 10: .standard(proto: "fee_per_kw"), + 11: .standard(proto: "unsettled_balance"), + 12: .standard(proto: "total_satoshis_sent"), + 13: .standard(proto: "total_satoshis_received"), + 14: .standard(proto: "num_updates"), + 15: .standard(proto: "pending_htlcs"), + 16: .standard(proto: "csv_delay"), + 17: .same(proto: "private"), + 18: .same(proto: "initiator"), + 19: .standard(proto: "chan_status_flags"), + 20: .standard(proto: "local_chan_reserve_sat"), + 21: .standard(proto: "remote_chan_reserve_sat"), + 22: .standard(proto: "static_remote_key"), + 26: .standard(proto: "commitment_type"), + 23: .same(proto: "lifetime"), + 24: .same(proto: "uptime"), + 25: .standard(proto: "close_address"), + 27: .standard(proto: "push_amount_sat"), + 28: .standard(proto: "thaw_height"), + 29: .standard(proto: "local_constraints"), + 30: .standard(proto: "remote_constraints"), + ] + + fileprivate class _StorageClass { + var _active: Bool = false + var _remotePubkey: String = String() + var _channelPoint: String = String() + var _chanID: UInt64 = 0 + var _capacity: Int64 = 0 + var _localBalance: Int64 = 0 + var _remoteBalance: Int64 = 0 + var _commitFee: Int64 = 0 + var _commitWeight: Int64 = 0 + var _feePerKw: Int64 = 0 + var _unsettledBalance: Int64 = 0 + var _totalSatoshisSent: Int64 = 0 + var _totalSatoshisReceived: Int64 = 0 + var _numUpdates: UInt64 = 0 + var _pendingHtlcs: [Lnrpc_HTLC] = [] + var _csvDelay: UInt32 = 0 + var _private: Bool = false + var _initiator: Bool = false + var _chanStatusFlags: String = String() + var _localChanReserveSat: Int64 = 0 + var _remoteChanReserveSat: Int64 = 0 + var _staticRemoteKey: Bool = false + var _commitmentType: Lnrpc_CommitmentType = .legacy + var _lifetime: Int64 = 0 + var _uptime: Int64 = 0 + var _closeAddress: String = String() + var _pushAmountSat: UInt64 = 0 + var _thawHeight: UInt32 = 0 + var _localConstraints: Lnrpc_ChannelConstraints? = nil + var _remoteConstraints: Lnrpc_ChannelConstraints? = nil + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _active = source._active + _remotePubkey = source._remotePubkey + _channelPoint = source._channelPoint + _chanID = source._chanID + _capacity = source._capacity + _localBalance = source._localBalance + _remoteBalance = source._remoteBalance + _commitFee = source._commitFee + _commitWeight = source._commitWeight + _feePerKw = source._feePerKw + _unsettledBalance = source._unsettledBalance + _totalSatoshisSent = source._totalSatoshisSent + _totalSatoshisReceived = source._totalSatoshisReceived + _numUpdates = source._numUpdates + _pendingHtlcs = source._pendingHtlcs + _csvDelay = source._csvDelay + _private = source._private + _initiator = source._initiator + _chanStatusFlags = source._chanStatusFlags + _localChanReserveSat = source._localChanReserveSat + _remoteChanReserveSat = source._remoteChanReserveSat + _staticRemoteKey = source._staticRemoteKey + _commitmentType = source._commitmentType + _lifetime = source._lifetime + _uptime = source._uptime + _closeAddress = source._closeAddress + _pushAmountSat = source._pushAmountSat + _thawHeight = source._thawHeight + _localConstraints = source._localConstraints + _remoteConstraints = source._remoteConstraints + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBoolField(value: &_storage._active) + case 2: try decoder.decodeSingularStringField(value: &_storage._remotePubkey) + case 3: try decoder.decodeSingularStringField(value: &_storage._channelPoint) + case 4: try decoder.decodeSingularUInt64Field(value: &_storage._chanID) + case 5: try decoder.decodeSingularInt64Field(value: &_storage._capacity) + case 6: try decoder.decodeSingularInt64Field(value: &_storage._localBalance) + case 7: try decoder.decodeSingularInt64Field(value: &_storage._remoteBalance) + case 8: try decoder.decodeSingularInt64Field(value: &_storage._commitFee) + case 9: try decoder.decodeSingularInt64Field(value: &_storage._commitWeight) + case 10: try decoder.decodeSingularInt64Field(value: &_storage._feePerKw) + case 11: try decoder.decodeSingularInt64Field(value: &_storage._unsettledBalance) + case 12: try decoder.decodeSingularInt64Field(value: &_storage._totalSatoshisSent) + case 13: try decoder.decodeSingularInt64Field(value: &_storage._totalSatoshisReceived) + case 14: try decoder.decodeSingularUInt64Field(value: &_storage._numUpdates) + case 15: try decoder.decodeRepeatedMessageField(value: &_storage._pendingHtlcs) + case 16: try decoder.decodeSingularUInt32Field(value: &_storage._csvDelay) + case 17: try decoder.decodeSingularBoolField(value: &_storage._private) + case 18: try decoder.decodeSingularBoolField(value: &_storage._initiator) + case 19: try decoder.decodeSingularStringField(value: &_storage._chanStatusFlags) + case 20: try decoder.decodeSingularInt64Field(value: &_storage._localChanReserveSat) + case 21: try decoder.decodeSingularInt64Field(value: &_storage._remoteChanReserveSat) + case 22: try decoder.decodeSingularBoolField(value: &_storage._staticRemoteKey) + case 23: try decoder.decodeSingularInt64Field(value: &_storage._lifetime) + case 24: try decoder.decodeSingularInt64Field(value: &_storage._uptime) + case 25: try decoder.decodeSingularStringField(value: &_storage._closeAddress) + case 26: try decoder.decodeSingularEnumField(value: &_storage._commitmentType) + case 27: try decoder.decodeSingularUInt64Field(value: &_storage._pushAmountSat) + case 28: try decoder.decodeSingularUInt32Field(value: &_storage._thawHeight) + case 29: try decoder.decodeSingularMessageField(value: &_storage._localConstraints) + case 30: try decoder.decodeSingularMessageField(value: &_storage._remoteConstraints) + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if _storage._active != false { + try visitor.visitSingularBoolField(value: _storage._active, fieldNumber: 1) + } + if !_storage._remotePubkey.isEmpty { + try visitor.visitSingularStringField(value: _storage._remotePubkey, fieldNumber: 2) + } + if !_storage._channelPoint.isEmpty { + try visitor.visitSingularStringField(value: _storage._channelPoint, fieldNumber: 3) + } + if _storage._chanID != 0 { + try visitor.visitSingularUInt64Field(value: _storage._chanID, fieldNumber: 4) + } + if _storage._capacity != 0 { + try visitor.visitSingularInt64Field(value: _storage._capacity, fieldNumber: 5) + } + if _storage._localBalance != 0 { + try visitor.visitSingularInt64Field(value: _storage._localBalance, fieldNumber: 6) + } + if _storage._remoteBalance != 0 { + try visitor.visitSingularInt64Field(value: _storage._remoteBalance, fieldNumber: 7) + } + if _storage._commitFee != 0 { + try visitor.visitSingularInt64Field(value: _storage._commitFee, fieldNumber: 8) + } + if _storage._commitWeight != 0 { + try visitor.visitSingularInt64Field(value: _storage._commitWeight, fieldNumber: 9) + } + if _storage._feePerKw != 0 { + try visitor.visitSingularInt64Field(value: _storage._feePerKw, fieldNumber: 10) + } + if _storage._unsettledBalance != 0 { + try visitor.visitSingularInt64Field(value: _storage._unsettledBalance, fieldNumber: 11) + } + if _storage._totalSatoshisSent != 0 { + try visitor.visitSingularInt64Field(value: _storage._totalSatoshisSent, fieldNumber: 12) + } + if _storage._totalSatoshisReceived != 0 { + try visitor.visitSingularInt64Field(value: _storage._totalSatoshisReceived, fieldNumber: 13) + } + if _storage._numUpdates != 0 { + try visitor.visitSingularUInt64Field(value: _storage._numUpdates, fieldNumber: 14) + } + if !_storage._pendingHtlcs.isEmpty { + try visitor.visitRepeatedMessageField(value: _storage._pendingHtlcs, fieldNumber: 15) + } + if _storage._csvDelay != 0 { + try visitor.visitSingularUInt32Field(value: _storage._csvDelay, fieldNumber: 16) + } + if _storage._private != false { + try visitor.visitSingularBoolField(value: _storage._private, fieldNumber: 17) + } + if _storage._initiator != false { + try visitor.visitSingularBoolField(value: _storage._initiator, fieldNumber: 18) + } + if !_storage._chanStatusFlags.isEmpty { + try visitor.visitSingularStringField(value: _storage._chanStatusFlags, fieldNumber: 19) + } + if _storage._localChanReserveSat != 0 { + try visitor.visitSingularInt64Field(value: _storage._localChanReserveSat, fieldNumber: 20) + } + if _storage._remoteChanReserveSat != 0 { + try visitor.visitSingularInt64Field(value: _storage._remoteChanReserveSat, fieldNumber: 21) + } + if _storage._staticRemoteKey != false { + try visitor.visitSingularBoolField(value: _storage._staticRemoteKey, fieldNumber: 22) + } + if _storage._lifetime != 0 { + try visitor.visitSingularInt64Field(value: _storage._lifetime, fieldNumber: 23) + } + if _storage._uptime != 0 { + try visitor.visitSingularInt64Field(value: _storage._uptime, fieldNumber: 24) + } + if !_storage._closeAddress.isEmpty { + try visitor.visitSingularStringField(value: _storage._closeAddress, fieldNumber: 25) + } + if _storage._commitmentType != .legacy { + try visitor.visitSingularEnumField(value: _storage._commitmentType, fieldNumber: 26) + } + if _storage._pushAmountSat != 0 { + try visitor.visitSingularUInt64Field(value: _storage._pushAmountSat, fieldNumber: 27) + } + if _storage._thawHeight != 0 { + try visitor.visitSingularUInt32Field(value: _storage._thawHeight, fieldNumber: 28) + } + if let v = _storage._localConstraints { + try visitor.visitSingularMessageField(value: v, fieldNumber: 29) + } + if let v = _storage._remoteConstraints { + try visitor.visitSingularMessageField(value: v, fieldNumber: 30) + } + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_Channel, rhs: Lnrpc_Channel) -> Bool { + if lhs._storage !== rhs._storage { + let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let rhs_storage = _args.1 + if _storage._active != rhs_storage._active {return false} + if _storage._remotePubkey != rhs_storage._remotePubkey {return false} + if _storage._channelPoint != rhs_storage._channelPoint {return false} + if _storage._chanID != rhs_storage._chanID {return false} + if _storage._capacity != rhs_storage._capacity {return false} + if _storage._localBalance != rhs_storage._localBalance {return false} + if _storage._remoteBalance != rhs_storage._remoteBalance {return false} + if _storage._commitFee != rhs_storage._commitFee {return false} + if _storage._commitWeight != rhs_storage._commitWeight {return false} + if _storage._feePerKw != rhs_storage._feePerKw {return false} + if _storage._unsettledBalance != rhs_storage._unsettledBalance {return false} + if _storage._totalSatoshisSent != rhs_storage._totalSatoshisSent {return false} + if _storage._totalSatoshisReceived != rhs_storage._totalSatoshisReceived {return false} + if _storage._numUpdates != rhs_storage._numUpdates {return false} + if _storage._pendingHtlcs != rhs_storage._pendingHtlcs {return false} + if _storage._csvDelay != rhs_storage._csvDelay {return false} + if _storage._private != rhs_storage._private {return false} + if _storage._initiator != rhs_storage._initiator {return false} + if _storage._chanStatusFlags != rhs_storage._chanStatusFlags {return false} + if _storage._localChanReserveSat != rhs_storage._localChanReserveSat {return false} + if _storage._remoteChanReserveSat != rhs_storage._remoteChanReserveSat {return false} + if _storage._staticRemoteKey != rhs_storage._staticRemoteKey {return false} + if _storage._commitmentType != rhs_storage._commitmentType {return false} + if _storage._lifetime != rhs_storage._lifetime {return false} + if _storage._uptime != rhs_storage._uptime {return false} + if _storage._closeAddress != rhs_storage._closeAddress {return false} + if _storage._pushAmountSat != rhs_storage._pushAmountSat {return false} + if _storage._thawHeight != rhs_storage._thawHeight {return false} + if _storage._localConstraints != rhs_storage._localConstraints {return false} + if _storage._remoteConstraints != rhs_storage._remoteConstraints {return false} + return true + } + if !storagesAreEqual {return false} + } + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ListChannelsRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ListChannelsRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "active_only"), + 2: .standard(proto: "inactive_only"), + 3: .standard(proto: "public_only"), + 4: .standard(proto: "private_only"), + 5: .same(proto: "peer"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBoolField(value: &self.activeOnly) + case 2: try decoder.decodeSingularBoolField(value: &self.inactiveOnly) + case 3: try decoder.decodeSingularBoolField(value: &self.publicOnly) + case 4: try decoder.decodeSingularBoolField(value: &self.privateOnly) + case 5: try decoder.decodeSingularBytesField(value: &self.peer) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.activeOnly != false { + try visitor.visitSingularBoolField(value: self.activeOnly, fieldNumber: 1) + } + if self.inactiveOnly != false { + try visitor.visitSingularBoolField(value: self.inactiveOnly, fieldNumber: 2) + } + if self.publicOnly != false { + try visitor.visitSingularBoolField(value: self.publicOnly, fieldNumber: 3) + } + if self.privateOnly != false { + try visitor.visitSingularBoolField(value: self.privateOnly, fieldNumber: 4) + } + if !self.peer.isEmpty { + try visitor.visitSingularBytesField(value: self.peer, fieldNumber: 5) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ListChannelsRequest, rhs: Lnrpc_ListChannelsRequest) -> Bool { + if lhs.activeOnly != rhs.activeOnly {return false} + if lhs.inactiveOnly != rhs.inactiveOnly {return false} + if lhs.publicOnly != rhs.publicOnly {return false} + if lhs.privateOnly != rhs.privateOnly {return false} + if lhs.peer != rhs.peer {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ListChannelsResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ListChannelsResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 11: .same(proto: "channels"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 11: try decoder.decodeRepeatedMessageField(value: &self.channels) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.channels.isEmpty { + try visitor.visitRepeatedMessageField(value: self.channels, fieldNumber: 11) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ListChannelsResponse, rhs: Lnrpc_ListChannelsResponse) -> Bool { + if lhs.channels != rhs.channels {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ChannelCloseSummary: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ChannelCloseSummary" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "channel_point"), + 2: .standard(proto: "chan_id"), + 3: .standard(proto: "chain_hash"), + 4: .standard(proto: "closing_tx_hash"), + 5: .standard(proto: "remote_pubkey"), + 6: .same(proto: "capacity"), + 7: .standard(proto: "close_height"), + 8: .standard(proto: "settled_balance"), + 9: .standard(proto: "time_locked_balance"), + 10: .standard(proto: "close_type"), + 11: .standard(proto: "open_initiator"), + 12: .standard(proto: "close_initiator"), + 13: .same(proto: "resolutions"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.channelPoint) + case 2: try decoder.decodeSingularUInt64Field(value: &self.chanID) + case 3: try decoder.decodeSingularStringField(value: &self.chainHash) + case 4: try decoder.decodeSingularStringField(value: &self.closingTxHash) + case 5: try decoder.decodeSingularStringField(value: &self.remotePubkey) + case 6: try decoder.decodeSingularInt64Field(value: &self.capacity) + case 7: try decoder.decodeSingularUInt32Field(value: &self.closeHeight) + case 8: try decoder.decodeSingularInt64Field(value: &self.settledBalance) + case 9: try decoder.decodeSingularInt64Field(value: &self.timeLockedBalance) + case 10: try decoder.decodeSingularEnumField(value: &self.closeType) + case 11: try decoder.decodeSingularEnumField(value: &self.openInitiator) + case 12: try decoder.decodeSingularEnumField(value: &self.closeInitiator) + case 13: try decoder.decodeRepeatedMessageField(value: &self.resolutions) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.channelPoint.isEmpty { + try visitor.visitSingularStringField(value: self.channelPoint, fieldNumber: 1) + } + if self.chanID != 0 { + try visitor.visitSingularUInt64Field(value: self.chanID, fieldNumber: 2) + } + if !self.chainHash.isEmpty { + try visitor.visitSingularStringField(value: self.chainHash, fieldNumber: 3) + } + if !self.closingTxHash.isEmpty { + try visitor.visitSingularStringField(value: self.closingTxHash, fieldNumber: 4) + } + if !self.remotePubkey.isEmpty { + try visitor.visitSingularStringField(value: self.remotePubkey, fieldNumber: 5) + } + if self.capacity != 0 { + try visitor.visitSingularInt64Field(value: self.capacity, fieldNumber: 6) + } + if self.closeHeight != 0 { + try visitor.visitSingularUInt32Field(value: self.closeHeight, fieldNumber: 7) + } + if self.settledBalance != 0 { + try visitor.visitSingularInt64Field(value: self.settledBalance, fieldNumber: 8) + } + if self.timeLockedBalance != 0 { + try visitor.visitSingularInt64Field(value: self.timeLockedBalance, fieldNumber: 9) + } + if self.closeType != .cooperativeClose { + try visitor.visitSingularEnumField(value: self.closeType, fieldNumber: 10) + } + if self.openInitiator != .unknown { + try visitor.visitSingularEnumField(value: self.openInitiator, fieldNumber: 11) + } + if self.closeInitiator != .unknown { + try visitor.visitSingularEnumField(value: self.closeInitiator, fieldNumber: 12) + } + if !self.resolutions.isEmpty { + try visitor.visitRepeatedMessageField(value: self.resolutions, fieldNumber: 13) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ChannelCloseSummary, rhs: Lnrpc_ChannelCloseSummary) -> Bool { + if lhs.channelPoint != rhs.channelPoint {return false} + if lhs.chanID != rhs.chanID {return false} + if lhs.chainHash != rhs.chainHash {return false} + if lhs.closingTxHash != rhs.closingTxHash {return false} + if lhs.remotePubkey != rhs.remotePubkey {return false} + if lhs.capacity != rhs.capacity {return false} + if lhs.closeHeight != rhs.closeHeight {return false} + if lhs.settledBalance != rhs.settledBalance {return false} + if lhs.timeLockedBalance != rhs.timeLockedBalance {return false} + if lhs.closeType != rhs.closeType {return false} + if lhs.openInitiator != rhs.openInitiator {return false} + if lhs.closeInitiator != rhs.closeInitiator {return false} + if lhs.resolutions != rhs.resolutions {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ChannelCloseSummary.ClosureType: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "COOPERATIVE_CLOSE"), + 1: .same(proto: "LOCAL_FORCE_CLOSE"), + 2: .same(proto: "REMOTE_FORCE_CLOSE"), + 3: .same(proto: "BREACH_CLOSE"), + 4: .same(proto: "FUNDING_CANCELED"), + 5: .same(proto: "ABANDONED"), + ] +} + +extension Lnrpc_Resolution: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Resolution" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "resolution_type"), + 2: .same(proto: "outcome"), + 3: .same(proto: "outpoint"), + 4: .standard(proto: "amount_sat"), + 5: .standard(proto: "sweep_txid"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularEnumField(value: &self.resolutionType) + case 2: try decoder.decodeSingularEnumField(value: &self.outcome) + case 3: try decoder.decodeSingularMessageField(value: &self._outpoint) + case 4: try decoder.decodeSingularUInt64Field(value: &self.amountSat) + case 5: try decoder.decodeSingularStringField(value: &self.sweepTxid) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.resolutionType != .typeUnknown { + try visitor.visitSingularEnumField(value: self.resolutionType, fieldNumber: 1) + } + if self.outcome != .outcomeUnknown { + try visitor.visitSingularEnumField(value: self.outcome, fieldNumber: 2) + } + if let v = self._outpoint { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } + if self.amountSat != 0 { + try visitor.visitSingularUInt64Field(value: self.amountSat, fieldNumber: 4) + } + if !self.sweepTxid.isEmpty { + try visitor.visitSingularStringField(value: self.sweepTxid, fieldNumber: 5) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_Resolution, rhs: Lnrpc_Resolution) -> Bool { + if lhs.resolutionType != rhs.resolutionType {return false} + if lhs.outcome != rhs.outcome {return false} + if lhs._outpoint != rhs._outpoint {return false} + if lhs.amountSat != rhs.amountSat {return false} + if lhs.sweepTxid != rhs.sweepTxid {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ClosedChannelsRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ClosedChannelsRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "cooperative"), + 2: .standard(proto: "local_force"), + 3: .standard(proto: "remote_force"), + 4: .same(proto: "breach"), + 5: .standard(proto: "funding_canceled"), + 6: .same(proto: "abandoned"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBoolField(value: &self.cooperative) + case 2: try decoder.decodeSingularBoolField(value: &self.localForce) + case 3: try decoder.decodeSingularBoolField(value: &self.remoteForce) + case 4: try decoder.decodeSingularBoolField(value: &self.breach) + case 5: try decoder.decodeSingularBoolField(value: &self.fundingCanceled) + case 6: try decoder.decodeSingularBoolField(value: &self.abandoned) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.cooperative != false { + try visitor.visitSingularBoolField(value: self.cooperative, fieldNumber: 1) + } + if self.localForce != false { + try visitor.visitSingularBoolField(value: self.localForce, fieldNumber: 2) + } + if self.remoteForce != false { + try visitor.visitSingularBoolField(value: self.remoteForce, fieldNumber: 3) + } + if self.breach != false { + try visitor.visitSingularBoolField(value: self.breach, fieldNumber: 4) + } + if self.fundingCanceled != false { + try visitor.visitSingularBoolField(value: self.fundingCanceled, fieldNumber: 5) + } + if self.abandoned != false { + try visitor.visitSingularBoolField(value: self.abandoned, fieldNumber: 6) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ClosedChannelsRequest, rhs: Lnrpc_ClosedChannelsRequest) -> Bool { + if lhs.cooperative != rhs.cooperative {return false} + if lhs.localForce != rhs.localForce {return false} + if lhs.remoteForce != rhs.remoteForce {return false} + if lhs.breach != rhs.breach {return false} + if lhs.fundingCanceled != rhs.fundingCanceled {return false} + if lhs.abandoned != rhs.abandoned {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ClosedChannelsResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ClosedChannelsResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "channels"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedMessageField(value: &self.channels) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.channels.isEmpty { + try visitor.visitRepeatedMessageField(value: self.channels, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ClosedChannelsResponse, rhs: Lnrpc_ClosedChannelsResponse) -> Bool { + if lhs.channels != rhs.channels {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_Peer: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Peer" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "pub_key"), + 3: .same(proto: "address"), + 4: .standard(proto: "bytes_sent"), + 5: .standard(proto: "bytes_recv"), + 6: .standard(proto: "sat_sent"), + 7: .standard(proto: "sat_recv"), + 8: .same(proto: "inbound"), + 9: .standard(proto: "ping_time"), + 10: .standard(proto: "sync_type"), + 11: .same(proto: "features"), + 12: .same(proto: "errors"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.pubKey) + case 3: try decoder.decodeSingularStringField(value: &self.address) + case 4: try decoder.decodeSingularUInt64Field(value: &self.bytesSent) + case 5: try decoder.decodeSingularUInt64Field(value: &self.bytesRecv) + case 6: try decoder.decodeSingularInt64Field(value: &self.satSent) + case 7: try decoder.decodeSingularInt64Field(value: &self.satRecv) + case 8: try decoder.decodeSingularBoolField(value: &self.inbound) + case 9: try decoder.decodeSingularInt64Field(value: &self.pingTime) + case 10: try decoder.decodeSingularEnumField(value: &self.syncType) + case 11: try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap.self, value: &self.features) + case 12: try decoder.decodeRepeatedMessageField(value: &self.errors) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.pubKey.isEmpty { + try visitor.visitSingularStringField(value: self.pubKey, fieldNumber: 1) + } + if !self.address.isEmpty { + try visitor.visitSingularStringField(value: self.address, fieldNumber: 3) + } + if self.bytesSent != 0 { + try visitor.visitSingularUInt64Field(value: self.bytesSent, fieldNumber: 4) + } + if self.bytesRecv != 0 { + try visitor.visitSingularUInt64Field(value: self.bytesRecv, fieldNumber: 5) + } + if self.satSent != 0 { + try visitor.visitSingularInt64Field(value: self.satSent, fieldNumber: 6) + } + if self.satRecv != 0 { + try visitor.visitSingularInt64Field(value: self.satRecv, fieldNumber: 7) + } + if self.inbound != false { + try visitor.visitSingularBoolField(value: self.inbound, fieldNumber: 8) + } + if self.pingTime != 0 { + try visitor.visitSingularInt64Field(value: self.pingTime, fieldNumber: 9) + } + if self.syncType != .unknownSync { + try visitor.visitSingularEnumField(value: self.syncType, fieldNumber: 10) + } + if !self.features.isEmpty { + try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap.self, value: self.features, fieldNumber: 11) + } + if !self.errors.isEmpty { + try visitor.visitRepeatedMessageField(value: self.errors, fieldNumber: 12) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_Peer, rhs: Lnrpc_Peer) -> Bool { + if lhs.pubKey != rhs.pubKey {return false} + if lhs.address != rhs.address {return false} + if lhs.bytesSent != rhs.bytesSent {return false} + if lhs.bytesRecv != rhs.bytesRecv {return false} + if lhs.satSent != rhs.satSent {return false} + if lhs.satRecv != rhs.satRecv {return false} + if lhs.inbound != rhs.inbound {return false} + if lhs.pingTime != rhs.pingTime {return false} + if lhs.syncType != rhs.syncType {return false} + if lhs.features != rhs.features {return false} + if lhs.errors != rhs.errors {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_Peer.SyncType: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN_SYNC"), + 1: .same(proto: "ACTIVE_SYNC"), + 2: .same(proto: "PASSIVE_SYNC"), + ] +} + +extension Lnrpc_TimestampedError: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".TimestampedError" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "timestamp"), + 2: .same(proto: "error"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt64Field(value: &self.timestamp) + case 2: try decoder.decodeSingularStringField(value: &self.error) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.timestamp != 0 { + try visitor.visitSingularUInt64Field(value: self.timestamp, fieldNumber: 1) + } + if !self.error.isEmpty { + try visitor.visitSingularStringField(value: self.error, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_TimestampedError, rhs: Lnrpc_TimestampedError) -> Bool { + if lhs.timestamp != rhs.timestamp {return false} + if lhs.error != rhs.error {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ListPeersRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ListPeersRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "latest_error"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBoolField(value: &self.latestError) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.latestError != false { + try visitor.visitSingularBoolField(value: self.latestError, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ListPeersRequest, rhs: Lnrpc_ListPeersRequest) -> Bool { + if lhs.latestError != rhs.latestError {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ListPeersResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ListPeersResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "peers"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedMessageField(value: &self.peers) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.peers.isEmpty { + try visitor.visitRepeatedMessageField(value: self.peers, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ListPeersResponse, rhs: Lnrpc_ListPeersResponse) -> Bool { + if lhs.peers != rhs.peers {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_PeerEventSubscription: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".PeerEventSubscription" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_PeerEventSubscription, rhs: Lnrpc_PeerEventSubscription) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_PeerEvent: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".PeerEvent" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "pub_key"), + 2: .same(proto: "type"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.pubKey) + case 2: try decoder.decodeSingularEnumField(value: &self.type) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.pubKey.isEmpty { + try visitor.visitSingularStringField(value: self.pubKey, fieldNumber: 1) + } + if self.type != .peerOnline { + try visitor.visitSingularEnumField(value: self.type, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_PeerEvent, rhs: Lnrpc_PeerEvent) -> Bool { + if lhs.pubKey != rhs.pubKey {return false} + if lhs.type != rhs.type {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_PeerEvent.EventType: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "PEER_ONLINE"), + 1: .same(proto: "PEER_OFFLINE"), + ] +} + +extension Lnrpc_GetInfoRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".GetInfoRequest" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_GetInfoRequest, rhs: Lnrpc_GetInfoRequest) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_GetInfoResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".GetInfoResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 14: .same(proto: "version"), + 20: .standard(proto: "commit_hash"), + 1: .standard(proto: "identity_pubkey"), + 2: .same(proto: "alias"), + 17: .same(proto: "color"), + 3: .standard(proto: "num_pending_channels"), + 4: .standard(proto: "num_active_channels"), + 15: .standard(proto: "num_inactive_channels"), + 5: .standard(proto: "num_peers"), + 6: .standard(proto: "block_height"), + 8: .standard(proto: "block_hash"), + 13: .standard(proto: "best_header_timestamp"), + 9: .standard(proto: "synced_to_chain"), + 18: .standard(proto: "synced_to_graph"), + 10: .same(proto: "testnet"), + 16: .same(proto: "chains"), + 12: .same(proto: "uris"), + 19: .same(proto: "features"), + ] + + fileprivate class _StorageClass { + var _version: String = String() + var _commitHash: String = String() + var _identityPubkey: String = String() + var _alias: String = String() + var _color: String = String() + var _numPendingChannels: UInt32 = 0 + var _numActiveChannels: UInt32 = 0 + var _numInactiveChannels: UInt32 = 0 + var _numPeers: UInt32 = 0 + var _blockHeight: UInt32 = 0 + var _blockHash: String = String() + var _bestHeaderTimestamp: Int64 = 0 + var _syncedToChain: Bool = false + var _syncedToGraph: Bool = false + var _testnet: Bool = false + var _chains: [Lnrpc_Chain] = [] + var _uris: [String] = [] + var _features: Dictionary = [:] + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _version = source._version + _commitHash = source._commitHash + _identityPubkey = source._identityPubkey + _alias = source._alias + _color = source._color + _numPendingChannels = source._numPendingChannels + _numActiveChannels = source._numActiveChannels + _numInactiveChannels = source._numInactiveChannels + _numPeers = source._numPeers + _blockHeight = source._blockHeight + _blockHash = source._blockHash + _bestHeaderTimestamp = source._bestHeaderTimestamp + _syncedToChain = source._syncedToChain + _syncedToGraph = source._syncedToGraph + _testnet = source._testnet + _chains = source._chains + _uris = source._uris + _features = source._features + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &_storage._identityPubkey) + case 2: try decoder.decodeSingularStringField(value: &_storage._alias) + case 3: try decoder.decodeSingularUInt32Field(value: &_storage._numPendingChannels) + case 4: try decoder.decodeSingularUInt32Field(value: &_storage._numActiveChannels) + case 5: try decoder.decodeSingularUInt32Field(value: &_storage._numPeers) + case 6: try decoder.decodeSingularUInt32Field(value: &_storage._blockHeight) + case 8: try decoder.decodeSingularStringField(value: &_storage._blockHash) + case 9: try decoder.decodeSingularBoolField(value: &_storage._syncedToChain) + case 10: try decoder.decodeSingularBoolField(value: &_storage._testnet) + case 12: try decoder.decodeRepeatedStringField(value: &_storage._uris) + case 13: try decoder.decodeSingularInt64Field(value: &_storage._bestHeaderTimestamp) + case 14: try decoder.decodeSingularStringField(value: &_storage._version) + case 15: try decoder.decodeSingularUInt32Field(value: &_storage._numInactiveChannels) + case 16: try decoder.decodeRepeatedMessageField(value: &_storage._chains) + case 17: try decoder.decodeSingularStringField(value: &_storage._color) + case 18: try decoder.decodeSingularBoolField(value: &_storage._syncedToGraph) + case 19: try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap.self, value: &_storage._features) + case 20: try decoder.decodeSingularStringField(value: &_storage._commitHash) + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if !_storage._identityPubkey.isEmpty { + try visitor.visitSingularStringField(value: _storage._identityPubkey, fieldNumber: 1) + } + if !_storage._alias.isEmpty { + try visitor.visitSingularStringField(value: _storage._alias, fieldNumber: 2) + } + if _storage._numPendingChannels != 0 { + try visitor.visitSingularUInt32Field(value: _storage._numPendingChannels, fieldNumber: 3) + } + if _storage._numActiveChannels != 0 { + try visitor.visitSingularUInt32Field(value: _storage._numActiveChannels, fieldNumber: 4) + } + if _storage._numPeers != 0 { + try visitor.visitSingularUInt32Field(value: _storage._numPeers, fieldNumber: 5) + } + if _storage._blockHeight != 0 { + try visitor.visitSingularUInt32Field(value: _storage._blockHeight, fieldNumber: 6) + } + if !_storage._blockHash.isEmpty { + try visitor.visitSingularStringField(value: _storage._blockHash, fieldNumber: 8) + } + if _storage._syncedToChain != false { + try visitor.visitSingularBoolField(value: _storage._syncedToChain, fieldNumber: 9) + } + if _storage._testnet != false { + try visitor.visitSingularBoolField(value: _storage._testnet, fieldNumber: 10) + } + if !_storage._uris.isEmpty { + try visitor.visitRepeatedStringField(value: _storage._uris, fieldNumber: 12) + } + if _storage._bestHeaderTimestamp != 0 { + try visitor.visitSingularInt64Field(value: _storage._bestHeaderTimestamp, fieldNumber: 13) + } + if !_storage._version.isEmpty { + try visitor.visitSingularStringField(value: _storage._version, fieldNumber: 14) + } + if _storage._numInactiveChannels != 0 { + try visitor.visitSingularUInt32Field(value: _storage._numInactiveChannels, fieldNumber: 15) + } + if !_storage._chains.isEmpty { + try visitor.visitRepeatedMessageField(value: _storage._chains, fieldNumber: 16) + } + if !_storage._color.isEmpty { + try visitor.visitSingularStringField(value: _storage._color, fieldNumber: 17) + } + if _storage._syncedToGraph != false { + try visitor.visitSingularBoolField(value: _storage._syncedToGraph, fieldNumber: 18) + } + if !_storage._features.isEmpty { + try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap.self, value: _storage._features, fieldNumber: 19) + } + if !_storage._commitHash.isEmpty { + try visitor.visitSingularStringField(value: _storage._commitHash, fieldNumber: 20) + } + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_GetInfoResponse, rhs: Lnrpc_GetInfoResponse) -> Bool { + if lhs._storage !== rhs._storage { + let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let rhs_storage = _args.1 + if _storage._version != rhs_storage._version {return false} + if _storage._commitHash != rhs_storage._commitHash {return false} + if _storage._identityPubkey != rhs_storage._identityPubkey {return false} + if _storage._alias != rhs_storage._alias {return false} + if _storage._color != rhs_storage._color {return false} + if _storage._numPendingChannels != rhs_storage._numPendingChannels {return false} + if _storage._numActiveChannels != rhs_storage._numActiveChannels {return false} + if _storage._numInactiveChannels != rhs_storage._numInactiveChannels {return false} + if _storage._numPeers != rhs_storage._numPeers {return false} + if _storage._blockHeight != rhs_storage._blockHeight {return false} + if _storage._blockHash != rhs_storage._blockHash {return false} + if _storage._bestHeaderTimestamp != rhs_storage._bestHeaderTimestamp {return false} + if _storage._syncedToChain != rhs_storage._syncedToChain {return false} + if _storage._syncedToGraph != rhs_storage._syncedToGraph {return false} + if _storage._testnet != rhs_storage._testnet {return false} + if _storage._chains != rhs_storage._chains {return false} + if _storage._uris != rhs_storage._uris {return false} + if _storage._features != rhs_storage._features {return false} + return true + } + if !storagesAreEqual {return false} + } + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_GetRecoveryInfoRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".GetRecoveryInfoRequest" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_GetRecoveryInfoRequest, rhs: Lnrpc_GetRecoveryInfoRequest) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_GetRecoveryInfoResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".GetRecoveryInfoResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "recovery_mode"), + 2: .standard(proto: "recovery_finished"), + 3: .same(proto: "progress"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBoolField(value: &self.recoveryMode) + case 2: try decoder.decodeSingularBoolField(value: &self.recoveryFinished) + case 3: try decoder.decodeSingularDoubleField(value: &self.progress) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.recoveryMode != false { + try visitor.visitSingularBoolField(value: self.recoveryMode, fieldNumber: 1) + } + if self.recoveryFinished != false { + try visitor.visitSingularBoolField(value: self.recoveryFinished, fieldNumber: 2) + } + if self.progress != 0 { + try visitor.visitSingularDoubleField(value: self.progress, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_GetRecoveryInfoResponse, rhs: Lnrpc_GetRecoveryInfoResponse) -> Bool { + if lhs.recoveryMode != rhs.recoveryMode {return false} + if lhs.recoveryFinished != rhs.recoveryFinished {return false} + if lhs.progress != rhs.progress {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_Chain: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Chain" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "chain"), + 2: .same(proto: "network"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.chain) + case 2: try decoder.decodeSingularStringField(value: &self.network) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.chain.isEmpty { + try visitor.visitSingularStringField(value: self.chain, fieldNumber: 1) + } + if !self.network.isEmpty { + try visitor.visitSingularStringField(value: self.network, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_Chain, rhs: Lnrpc_Chain) -> Bool { + if lhs.chain != rhs.chain {return false} + if lhs.network != rhs.network {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ConfirmationUpdate: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ConfirmationUpdate" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "block_sha"), + 2: .standard(proto: "block_height"), + 3: .standard(proto: "num_confs_left"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.blockSha) + case 2: try decoder.decodeSingularInt32Field(value: &self.blockHeight) + case 3: try decoder.decodeSingularUInt32Field(value: &self.numConfsLeft) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.blockSha.isEmpty { + try visitor.visitSingularBytesField(value: self.blockSha, fieldNumber: 1) + } + if self.blockHeight != 0 { + try visitor.visitSingularInt32Field(value: self.blockHeight, fieldNumber: 2) + } + if self.numConfsLeft != 0 { + try visitor.visitSingularUInt32Field(value: self.numConfsLeft, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ConfirmationUpdate, rhs: Lnrpc_ConfirmationUpdate) -> Bool { + if lhs.blockSha != rhs.blockSha {return false} + if lhs.blockHeight != rhs.blockHeight {return false} + if lhs.numConfsLeft != rhs.numConfsLeft {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ChannelOpenUpdate: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ChannelOpenUpdate" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "channel_point"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &self._channelPoint) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._channelPoint { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ChannelOpenUpdate, rhs: Lnrpc_ChannelOpenUpdate) -> Bool { + if lhs._channelPoint != rhs._channelPoint {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ChannelCloseUpdate: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ChannelCloseUpdate" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "closing_txid"), + 2: .same(proto: "success"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.closingTxid) + case 2: try decoder.decodeSingularBoolField(value: &self.success) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.closingTxid.isEmpty { + try visitor.visitSingularBytesField(value: self.closingTxid, fieldNumber: 1) + } + if self.success != false { + try visitor.visitSingularBoolField(value: self.success, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ChannelCloseUpdate, rhs: Lnrpc_ChannelCloseUpdate) -> Bool { + if lhs.closingTxid != rhs.closingTxid {return false} + if lhs.success != rhs.success {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_CloseChannelRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".CloseChannelRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "channel_point"), + 2: .same(proto: "force"), + 3: .standard(proto: "target_conf"), + 4: .standard(proto: "sat_per_byte"), + 5: .standard(proto: "delivery_address"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &self._channelPoint) + case 2: try decoder.decodeSingularBoolField(value: &self.force) + case 3: try decoder.decodeSingularInt32Field(value: &self.targetConf) + case 4: try decoder.decodeSingularInt64Field(value: &self.satPerByte) + case 5: try decoder.decodeSingularStringField(value: &self.deliveryAddress) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._channelPoint { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + if self.force != false { + try visitor.visitSingularBoolField(value: self.force, fieldNumber: 2) + } + if self.targetConf != 0 { + try visitor.visitSingularInt32Field(value: self.targetConf, fieldNumber: 3) + } + if self.satPerByte != 0 { + try visitor.visitSingularInt64Field(value: self.satPerByte, fieldNumber: 4) + } + if !self.deliveryAddress.isEmpty { + try visitor.visitSingularStringField(value: self.deliveryAddress, fieldNumber: 5) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_CloseChannelRequest, rhs: Lnrpc_CloseChannelRequest) -> Bool { + if lhs._channelPoint != rhs._channelPoint {return false} + if lhs.force != rhs.force {return false} + if lhs.targetConf != rhs.targetConf {return false} + if lhs.satPerByte != rhs.satPerByte {return false} + if lhs.deliveryAddress != rhs.deliveryAddress {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_CloseStatusUpdate: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".CloseStatusUpdate" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "close_pending"), + 3: .standard(proto: "chan_close"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: + var v: Lnrpc_PendingUpdate? + if let current = self.update { + try decoder.handleConflictingOneOf() + if case .closePending(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {self.update = .closePending(v)} + case 3: + var v: Lnrpc_ChannelCloseUpdate? + if let current = self.update { + try decoder.handleConflictingOneOf() + if case .chanClose(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {self.update = .chanClose(v)} + default: break + } + } + } + + func traverse(visitor: inout V) throws { + switch self.update { + case .closePending(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + case .chanClose(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + case nil: break + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_CloseStatusUpdate, rhs: Lnrpc_CloseStatusUpdate) -> Bool { + if lhs.update != rhs.update {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_PendingUpdate: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".PendingUpdate" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "txid"), + 2: .standard(proto: "output_index"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.txid) + case 2: try decoder.decodeSingularUInt32Field(value: &self.outputIndex) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.txid.isEmpty { + try visitor.visitSingularBytesField(value: self.txid, fieldNumber: 1) + } + if self.outputIndex != 0 { + try visitor.visitSingularUInt32Field(value: self.outputIndex, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_PendingUpdate, rhs: Lnrpc_PendingUpdate) -> Bool { + if lhs.txid != rhs.txid {return false} + if lhs.outputIndex != rhs.outputIndex {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ReadyForPsbtFunding: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ReadyForPsbtFunding" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "funding_address"), + 2: .standard(proto: "funding_amount"), + 3: .same(proto: "psbt"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.fundingAddress) + case 2: try decoder.decodeSingularInt64Field(value: &self.fundingAmount) + case 3: try decoder.decodeSingularBytesField(value: &self.psbt) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.fundingAddress.isEmpty { + try visitor.visitSingularStringField(value: self.fundingAddress, fieldNumber: 1) + } + if self.fundingAmount != 0 { + try visitor.visitSingularInt64Field(value: self.fundingAmount, fieldNumber: 2) + } + if !self.psbt.isEmpty { + try visitor.visitSingularBytesField(value: self.psbt, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ReadyForPsbtFunding, rhs: Lnrpc_ReadyForPsbtFunding) -> Bool { + if lhs.fundingAddress != rhs.fundingAddress {return false} + if lhs.fundingAmount != rhs.fundingAmount {return false} + if lhs.psbt != rhs.psbt {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_OpenChannelRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".OpenChannelRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 2: .standard(proto: "node_pubkey"), + 3: .standard(proto: "node_pubkey_string"), + 4: .standard(proto: "local_funding_amount"), + 5: .standard(proto: "push_sat"), + 6: .standard(proto: "target_conf"), + 7: .standard(proto: "sat_per_byte"), + 8: .same(proto: "private"), + 9: .standard(proto: "min_htlc_msat"), + 10: .standard(proto: "remote_csv_delay"), + 11: .standard(proto: "min_confs"), + 12: .standard(proto: "spend_unconfirmed"), + 13: .standard(proto: "close_address"), + 14: .standard(proto: "funding_shim"), + 15: .standard(proto: "remote_max_value_in_flight_msat"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 2: try decoder.decodeSingularBytesField(value: &self.nodePubkey) + case 3: try decoder.decodeSingularStringField(value: &self.nodePubkeyString) + case 4: try decoder.decodeSingularInt64Field(value: &self.localFundingAmount) + case 5: try decoder.decodeSingularInt64Field(value: &self.pushSat) + case 6: try decoder.decodeSingularInt32Field(value: &self.targetConf) + case 7: try decoder.decodeSingularInt64Field(value: &self.satPerByte) + case 8: try decoder.decodeSingularBoolField(value: &self.`private`) + case 9: try decoder.decodeSingularInt64Field(value: &self.minHtlcMsat) + case 10: try decoder.decodeSingularUInt32Field(value: &self.remoteCsvDelay) + case 11: try decoder.decodeSingularInt32Field(value: &self.minConfs) + case 12: try decoder.decodeSingularBoolField(value: &self.spendUnconfirmed) + case 13: try decoder.decodeSingularStringField(value: &self.closeAddress) + case 14: try decoder.decodeSingularMessageField(value: &self._fundingShim) + case 15: try decoder.decodeSingularUInt64Field(value: &self.remoteMaxValueInFlightMsat) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.nodePubkey.isEmpty { + try visitor.visitSingularBytesField(value: self.nodePubkey, fieldNumber: 2) + } + if !self.nodePubkeyString.isEmpty { + try visitor.visitSingularStringField(value: self.nodePubkeyString, fieldNumber: 3) + } + if self.localFundingAmount != 0 { + try visitor.visitSingularInt64Field(value: self.localFundingAmount, fieldNumber: 4) + } + if self.pushSat != 0 { + try visitor.visitSingularInt64Field(value: self.pushSat, fieldNumber: 5) + } + if self.targetConf != 0 { + try visitor.visitSingularInt32Field(value: self.targetConf, fieldNumber: 6) + } + if self.satPerByte != 0 { + try visitor.visitSingularInt64Field(value: self.satPerByte, fieldNumber: 7) + } + if self.`private` != false { + try visitor.visitSingularBoolField(value: self.`private`, fieldNumber: 8) + } + if self.minHtlcMsat != 0 { + try visitor.visitSingularInt64Field(value: self.minHtlcMsat, fieldNumber: 9) + } + if self.remoteCsvDelay != 0 { + try visitor.visitSingularUInt32Field(value: self.remoteCsvDelay, fieldNumber: 10) + } + if self.minConfs != 0 { + try visitor.visitSingularInt32Field(value: self.minConfs, fieldNumber: 11) + } + if self.spendUnconfirmed != false { + try visitor.visitSingularBoolField(value: self.spendUnconfirmed, fieldNumber: 12) + } + if !self.closeAddress.isEmpty { + try visitor.visitSingularStringField(value: self.closeAddress, fieldNumber: 13) + } + if let v = self._fundingShim { + try visitor.visitSingularMessageField(value: v, fieldNumber: 14) + } + if self.remoteMaxValueInFlightMsat != 0 { + try visitor.visitSingularUInt64Field(value: self.remoteMaxValueInFlightMsat, fieldNumber: 15) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_OpenChannelRequest, rhs: Lnrpc_OpenChannelRequest) -> Bool { + if lhs.nodePubkey != rhs.nodePubkey {return false} + if lhs.nodePubkeyString != rhs.nodePubkeyString {return false} + if lhs.localFundingAmount != rhs.localFundingAmount {return false} + if lhs.pushSat != rhs.pushSat {return false} + if lhs.targetConf != rhs.targetConf {return false} + if lhs.satPerByte != rhs.satPerByte {return false} + if lhs.`private` != rhs.`private` {return false} + if lhs.minHtlcMsat != rhs.minHtlcMsat {return false} + if lhs.remoteCsvDelay != rhs.remoteCsvDelay {return false} + if lhs.minConfs != rhs.minConfs {return false} + if lhs.spendUnconfirmed != rhs.spendUnconfirmed {return false} + if lhs.closeAddress != rhs.closeAddress {return false} + if lhs._fundingShim != rhs._fundingShim {return false} + if lhs.remoteMaxValueInFlightMsat != rhs.remoteMaxValueInFlightMsat {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_OpenStatusUpdate: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".OpenStatusUpdate" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "chan_pending"), + 3: .standard(proto: "chan_open"), + 5: .standard(proto: "psbt_fund"), + 4: .standard(proto: "pending_chan_id"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: + var v: Lnrpc_PendingUpdate? + if let current = self.update { + try decoder.handleConflictingOneOf() + if case .chanPending(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {self.update = .chanPending(v)} + case 3: + var v: Lnrpc_ChannelOpenUpdate? + if let current = self.update { + try decoder.handleConflictingOneOf() + if case .chanOpen(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {self.update = .chanOpen(v)} + case 4: try decoder.decodeSingularBytesField(value: &self.pendingChanID) + case 5: + var v: Lnrpc_ReadyForPsbtFunding? + if let current = self.update { + try decoder.handleConflictingOneOf() + if case .psbtFund(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {self.update = .psbtFund(v)} + default: break + } + } + } + + func traverse(visitor: inout V) throws { + switch self.update { + case .chanPending(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + case .chanOpen(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + case nil: break + default: break + } + if !self.pendingChanID.isEmpty { + try visitor.visitSingularBytesField(value: self.pendingChanID, fieldNumber: 4) + } + if case .psbtFund(let v)? = self.update { + try visitor.visitSingularMessageField(value: v, fieldNumber: 5) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_OpenStatusUpdate, rhs: Lnrpc_OpenStatusUpdate) -> Bool { + if lhs.update != rhs.update {return false} + if lhs.pendingChanID != rhs.pendingChanID {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_KeyLocator: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".KeyLocator" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "key_family"), + 2: .standard(proto: "key_index"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularInt32Field(value: &self.keyFamily) + case 2: try decoder.decodeSingularInt32Field(value: &self.keyIndex) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.keyFamily != 0 { + try visitor.visitSingularInt32Field(value: self.keyFamily, fieldNumber: 1) + } + if self.keyIndex != 0 { + try visitor.visitSingularInt32Field(value: self.keyIndex, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_KeyLocator, rhs: Lnrpc_KeyLocator) -> Bool { + if lhs.keyFamily != rhs.keyFamily {return false} + if lhs.keyIndex != rhs.keyIndex {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_KeyDescriptor: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".KeyDescriptor" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "raw_key_bytes"), + 2: .standard(proto: "key_loc"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.rawKeyBytes) + case 2: try decoder.decodeSingularMessageField(value: &self._keyLoc) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.rawKeyBytes.isEmpty { + try visitor.visitSingularBytesField(value: self.rawKeyBytes, fieldNumber: 1) + } + if let v = self._keyLoc { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_KeyDescriptor, rhs: Lnrpc_KeyDescriptor) -> Bool { + if lhs.rawKeyBytes != rhs.rawKeyBytes {return false} + if lhs._keyLoc != rhs._keyLoc {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ChanPointShim: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ChanPointShim" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "amt"), + 2: .standard(proto: "chan_point"), + 3: .standard(proto: "local_key"), + 4: .standard(proto: "remote_key"), + 5: .standard(proto: "pending_chan_id"), + 6: .standard(proto: "thaw_height"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularInt64Field(value: &self.amt) + case 2: try decoder.decodeSingularMessageField(value: &self._chanPoint) + case 3: try decoder.decodeSingularMessageField(value: &self._localKey) + case 4: try decoder.decodeSingularBytesField(value: &self.remoteKey) + case 5: try decoder.decodeSingularBytesField(value: &self.pendingChanID) + case 6: try decoder.decodeSingularUInt32Field(value: &self.thawHeight) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.amt != 0 { + try visitor.visitSingularInt64Field(value: self.amt, fieldNumber: 1) + } + if let v = self._chanPoint { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } + if let v = self._localKey { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } + if !self.remoteKey.isEmpty { + try visitor.visitSingularBytesField(value: self.remoteKey, fieldNumber: 4) + } + if !self.pendingChanID.isEmpty { + try visitor.visitSingularBytesField(value: self.pendingChanID, fieldNumber: 5) + } + if self.thawHeight != 0 { + try visitor.visitSingularUInt32Field(value: self.thawHeight, fieldNumber: 6) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ChanPointShim, rhs: Lnrpc_ChanPointShim) -> Bool { + if lhs.amt != rhs.amt {return false} + if lhs._chanPoint != rhs._chanPoint {return false} + if lhs._localKey != rhs._localKey {return false} + if lhs.remoteKey != rhs.remoteKey {return false} + if lhs.pendingChanID != rhs.pendingChanID {return false} + if lhs.thawHeight != rhs.thawHeight {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_PsbtShim: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".PsbtShim" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "pending_chan_id"), + 2: .standard(proto: "base_psbt"), + 3: .standard(proto: "no_publish"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.pendingChanID) + case 2: try decoder.decodeSingularBytesField(value: &self.basePsbt) + case 3: try decoder.decodeSingularBoolField(value: &self.noPublish) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.pendingChanID.isEmpty { + try visitor.visitSingularBytesField(value: self.pendingChanID, fieldNumber: 1) + } + if !self.basePsbt.isEmpty { + try visitor.visitSingularBytesField(value: self.basePsbt, fieldNumber: 2) + } + if self.noPublish != false { + try visitor.visitSingularBoolField(value: self.noPublish, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_PsbtShim, rhs: Lnrpc_PsbtShim) -> Bool { + if lhs.pendingChanID != rhs.pendingChanID {return false} + if lhs.basePsbt != rhs.basePsbt {return false} + if lhs.noPublish != rhs.noPublish {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_FundingShim: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".FundingShim" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "chan_point_shim"), + 2: .standard(proto: "psbt_shim"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: + var v: Lnrpc_ChanPointShim? + if let current = self.shim { + try decoder.handleConflictingOneOf() + if case .chanPointShim(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {self.shim = .chanPointShim(v)} + case 2: + var v: Lnrpc_PsbtShim? + if let current = self.shim { + try decoder.handleConflictingOneOf() + if case .psbtShim(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {self.shim = .psbtShim(v)} + default: break + } + } + } + + func traverse(visitor: inout V) throws { + switch self.shim { + case .chanPointShim(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + case .psbtShim(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + case nil: break + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_FundingShim, rhs: Lnrpc_FundingShim) -> Bool { + if lhs.shim != rhs.shim {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_FundingShimCancel: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".FundingShimCancel" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "pending_chan_id"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.pendingChanID) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.pendingChanID.isEmpty { + try visitor.visitSingularBytesField(value: self.pendingChanID, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_FundingShimCancel, rhs: Lnrpc_FundingShimCancel) -> Bool { + if lhs.pendingChanID != rhs.pendingChanID {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_FundingPsbtVerify: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".FundingPsbtVerify" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "funded_psbt"), + 2: .standard(proto: "pending_chan_id"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.fundedPsbt) + case 2: try decoder.decodeSingularBytesField(value: &self.pendingChanID) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.fundedPsbt.isEmpty { + try visitor.visitSingularBytesField(value: self.fundedPsbt, fieldNumber: 1) + } + if !self.pendingChanID.isEmpty { + try visitor.visitSingularBytesField(value: self.pendingChanID, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_FundingPsbtVerify, rhs: Lnrpc_FundingPsbtVerify) -> Bool { + if lhs.fundedPsbt != rhs.fundedPsbt {return false} + if lhs.pendingChanID != rhs.pendingChanID {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_FundingPsbtFinalize: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".FundingPsbtFinalize" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "signed_psbt"), + 2: .standard(proto: "pending_chan_id"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.signedPsbt) + case 2: try decoder.decodeSingularBytesField(value: &self.pendingChanID) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.signedPsbt.isEmpty { + try visitor.visitSingularBytesField(value: self.signedPsbt, fieldNumber: 1) + } + if !self.pendingChanID.isEmpty { + try visitor.visitSingularBytesField(value: self.pendingChanID, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_FundingPsbtFinalize, rhs: Lnrpc_FundingPsbtFinalize) -> Bool { + if lhs.signedPsbt != rhs.signedPsbt {return false} + if lhs.pendingChanID != rhs.pendingChanID {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_FundingTransitionMsg: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".FundingTransitionMsg" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "shim_register"), + 2: .standard(proto: "shim_cancel"), + 3: .standard(proto: "psbt_verify"), + 4: .standard(proto: "psbt_finalize"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: + var v: Lnrpc_FundingShim? + if let current = self.trigger { + try decoder.handleConflictingOneOf() + if case .shimRegister(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {self.trigger = .shimRegister(v)} + case 2: + var v: Lnrpc_FundingShimCancel? + if let current = self.trigger { + try decoder.handleConflictingOneOf() + if case .shimCancel(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {self.trigger = .shimCancel(v)} + case 3: + var v: Lnrpc_FundingPsbtVerify? + if let current = self.trigger { + try decoder.handleConflictingOneOf() + if case .psbtVerify(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {self.trigger = .psbtVerify(v)} + case 4: + var v: Lnrpc_FundingPsbtFinalize? + if let current = self.trigger { + try decoder.handleConflictingOneOf() + if case .psbtFinalize(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {self.trigger = .psbtFinalize(v)} + default: break + } + } + } + + func traverse(visitor: inout V) throws { + switch self.trigger { + case .shimRegister(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + case .shimCancel(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + case .psbtVerify(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + case .psbtFinalize(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 4) + case nil: break + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_FundingTransitionMsg, rhs: Lnrpc_FundingTransitionMsg) -> Bool { + if lhs.trigger != rhs.trigger {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_FundingStateStepResp: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".FundingStateStepResp" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_FundingStateStepResp, rhs: Lnrpc_FundingStateStepResp) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_PendingHTLC: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".PendingHTLC" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "incoming"), + 2: .same(proto: "amount"), + 3: .same(proto: "outpoint"), + 4: .standard(proto: "maturity_height"), + 5: .standard(proto: "blocks_til_maturity"), + 6: .same(proto: "stage"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBoolField(value: &self.incoming) + case 2: try decoder.decodeSingularInt64Field(value: &self.amount) + case 3: try decoder.decodeSingularStringField(value: &self.outpoint) + case 4: try decoder.decodeSingularUInt32Field(value: &self.maturityHeight) + case 5: try decoder.decodeSingularInt32Field(value: &self.blocksTilMaturity) + case 6: try decoder.decodeSingularUInt32Field(value: &self.stage) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.incoming != false { + try visitor.visitSingularBoolField(value: self.incoming, fieldNumber: 1) + } + if self.amount != 0 { + try visitor.visitSingularInt64Field(value: self.amount, fieldNumber: 2) + } + if !self.outpoint.isEmpty { + try visitor.visitSingularStringField(value: self.outpoint, fieldNumber: 3) + } + if self.maturityHeight != 0 { + try visitor.visitSingularUInt32Field(value: self.maturityHeight, fieldNumber: 4) + } + if self.blocksTilMaturity != 0 { + try visitor.visitSingularInt32Field(value: self.blocksTilMaturity, fieldNumber: 5) + } + if self.stage != 0 { + try visitor.visitSingularUInt32Field(value: self.stage, fieldNumber: 6) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_PendingHTLC, rhs: Lnrpc_PendingHTLC) -> Bool { + if lhs.incoming != rhs.incoming {return false} + if lhs.amount != rhs.amount {return false} + if lhs.outpoint != rhs.outpoint {return false} + if lhs.maturityHeight != rhs.maturityHeight {return false} + if lhs.blocksTilMaturity != rhs.blocksTilMaturity {return false} + if lhs.stage != rhs.stage {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_PendingChannelsRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".PendingChannelsRequest" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_PendingChannelsRequest, rhs: Lnrpc_PendingChannelsRequest) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_PendingChannelsResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".PendingChannelsResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "total_limbo_balance"), + 2: .standard(proto: "pending_open_channels"), + 3: .standard(proto: "pending_closing_channels"), + 4: .standard(proto: "pending_force_closing_channels"), + 5: .standard(proto: "waiting_close_channels"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularInt64Field(value: &self.totalLimboBalance) + case 2: try decoder.decodeRepeatedMessageField(value: &self.pendingOpenChannels) + case 3: try decoder.decodeRepeatedMessageField(value: &self.pendingClosingChannels) + case 4: try decoder.decodeRepeatedMessageField(value: &self.pendingForceClosingChannels) + case 5: try decoder.decodeRepeatedMessageField(value: &self.waitingCloseChannels) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.totalLimboBalance != 0 { + try visitor.visitSingularInt64Field(value: self.totalLimboBalance, fieldNumber: 1) + } + if !self.pendingOpenChannels.isEmpty { + try visitor.visitRepeatedMessageField(value: self.pendingOpenChannels, fieldNumber: 2) + } + if !self.pendingClosingChannels.isEmpty { + try visitor.visitRepeatedMessageField(value: self.pendingClosingChannels, fieldNumber: 3) + } + if !self.pendingForceClosingChannels.isEmpty { + try visitor.visitRepeatedMessageField(value: self.pendingForceClosingChannels, fieldNumber: 4) + } + if !self.waitingCloseChannels.isEmpty { + try visitor.visitRepeatedMessageField(value: self.waitingCloseChannels, fieldNumber: 5) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_PendingChannelsResponse, rhs: Lnrpc_PendingChannelsResponse) -> Bool { + if lhs.totalLimboBalance != rhs.totalLimboBalance {return false} + if lhs.pendingOpenChannels != rhs.pendingOpenChannels {return false} + if lhs.pendingClosingChannels != rhs.pendingClosingChannels {return false} + if lhs.pendingForceClosingChannels != rhs.pendingForceClosingChannels {return false} + if lhs.waitingCloseChannels != rhs.waitingCloseChannels {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_PendingChannelsResponse.PendingChannel: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = Lnrpc_PendingChannelsResponse.protoMessageName + ".PendingChannel" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "remote_node_pub"), + 2: .standard(proto: "channel_point"), + 3: .same(proto: "capacity"), + 4: .standard(proto: "local_balance"), + 5: .standard(proto: "remote_balance"), + 6: .standard(proto: "local_chan_reserve_sat"), + 7: .standard(proto: "remote_chan_reserve_sat"), + 8: .same(proto: "initiator"), + 9: .standard(proto: "commitment_type"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.remoteNodePub) + case 2: try decoder.decodeSingularStringField(value: &self.channelPoint) + case 3: try decoder.decodeSingularInt64Field(value: &self.capacity) + case 4: try decoder.decodeSingularInt64Field(value: &self.localBalance) + case 5: try decoder.decodeSingularInt64Field(value: &self.remoteBalance) + case 6: try decoder.decodeSingularInt64Field(value: &self.localChanReserveSat) + case 7: try decoder.decodeSingularInt64Field(value: &self.remoteChanReserveSat) + case 8: try decoder.decodeSingularEnumField(value: &self.initiator) + case 9: try decoder.decodeSingularEnumField(value: &self.commitmentType) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.remoteNodePub.isEmpty { + try visitor.visitSingularStringField(value: self.remoteNodePub, fieldNumber: 1) + } + if !self.channelPoint.isEmpty { + try visitor.visitSingularStringField(value: self.channelPoint, fieldNumber: 2) + } + if self.capacity != 0 { + try visitor.visitSingularInt64Field(value: self.capacity, fieldNumber: 3) + } + if self.localBalance != 0 { + try visitor.visitSingularInt64Field(value: self.localBalance, fieldNumber: 4) + } + if self.remoteBalance != 0 { + try visitor.visitSingularInt64Field(value: self.remoteBalance, fieldNumber: 5) + } + if self.localChanReserveSat != 0 { + try visitor.visitSingularInt64Field(value: self.localChanReserveSat, fieldNumber: 6) + } + if self.remoteChanReserveSat != 0 { + try visitor.visitSingularInt64Field(value: self.remoteChanReserveSat, fieldNumber: 7) + } + if self.initiator != .unknown { + try visitor.visitSingularEnumField(value: self.initiator, fieldNumber: 8) + } + if self.commitmentType != .legacy { + try visitor.visitSingularEnumField(value: self.commitmentType, fieldNumber: 9) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_PendingChannelsResponse.PendingChannel, rhs: Lnrpc_PendingChannelsResponse.PendingChannel) -> Bool { + if lhs.remoteNodePub != rhs.remoteNodePub {return false} + if lhs.channelPoint != rhs.channelPoint {return false} + if lhs.capacity != rhs.capacity {return false} + if lhs.localBalance != rhs.localBalance {return false} + if lhs.remoteBalance != rhs.remoteBalance {return false} + if lhs.localChanReserveSat != rhs.localChanReserveSat {return false} + if lhs.remoteChanReserveSat != rhs.remoteChanReserveSat {return false} + if lhs.initiator != rhs.initiator {return false} + if lhs.commitmentType != rhs.commitmentType {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_PendingChannelsResponse.PendingOpenChannel: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = Lnrpc_PendingChannelsResponse.protoMessageName + ".PendingOpenChannel" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "channel"), + 2: .standard(proto: "confirmation_height"), + 4: .standard(proto: "commit_fee"), + 5: .standard(proto: "commit_weight"), + 6: .standard(proto: "fee_per_kw"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &self._channel) + case 2: try decoder.decodeSingularUInt32Field(value: &self.confirmationHeight) + case 4: try decoder.decodeSingularInt64Field(value: &self.commitFee) + case 5: try decoder.decodeSingularInt64Field(value: &self.commitWeight) + case 6: try decoder.decodeSingularInt64Field(value: &self.feePerKw) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._channel { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + if self.confirmationHeight != 0 { + try visitor.visitSingularUInt32Field(value: self.confirmationHeight, fieldNumber: 2) + } + if self.commitFee != 0 { + try visitor.visitSingularInt64Field(value: self.commitFee, fieldNumber: 4) + } + if self.commitWeight != 0 { + try visitor.visitSingularInt64Field(value: self.commitWeight, fieldNumber: 5) + } + if self.feePerKw != 0 { + try visitor.visitSingularInt64Field(value: self.feePerKw, fieldNumber: 6) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_PendingChannelsResponse.PendingOpenChannel, rhs: Lnrpc_PendingChannelsResponse.PendingOpenChannel) -> Bool { + if lhs._channel != rhs._channel {return false} + if lhs.confirmationHeight != rhs.confirmationHeight {return false} + if lhs.commitFee != rhs.commitFee {return false} + if lhs.commitWeight != rhs.commitWeight {return false} + if lhs.feePerKw != rhs.feePerKw {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_PendingChannelsResponse.WaitingCloseChannel: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = Lnrpc_PendingChannelsResponse.protoMessageName + ".WaitingCloseChannel" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "channel"), + 2: .standard(proto: "limbo_balance"), + 3: .same(proto: "commitments"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &self._channel) + case 2: try decoder.decodeSingularInt64Field(value: &self.limboBalance) + case 3: try decoder.decodeSingularMessageField(value: &self._commitments) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._channel { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + if self.limboBalance != 0 { + try visitor.visitSingularInt64Field(value: self.limboBalance, fieldNumber: 2) + } + if let v = self._commitments { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_PendingChannelsResponse.WaitingCloseChannel, rhs: Lnrpc_PendingChannelsResponse.WaitingCloseChannel) -> Bool { + if lhs._channel != rhs._channel {return false} + if lhs.limboBalance != rhs.limboBalance {return false} + if lhs._commitments != rhs._commitments {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_PendingChannelsResponse.Commitments: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = Lnrpc_PendingChannelsResponse.protoMessageName + ".Commitments" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "local_txid"), + 2: .standard(proto: "remote_txid"), + 3: .standard(proto: "remote_pending_txid"), + 4: .standard(proto: "local_commit_fee_sat"), + 5: .standard(proto: "remote_commit_fee_sat"), + 6: .standard(proto: "remote_pending_commit_fee_sat"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.localTxid) + case 2: try decoder.decodeSingularStringField(value: &self.remoteTxid) + case 3: try decoder.decodeSingularStringField(value: &self.remotePendingTxid) + case 4: try decoder.decodeSingularUInt64Field(value: &self.localCommitFeeSat) + case 5: try decoder.decodeSingularUInt64Field(value: &self.remoteCommitFeeSat) + case 6: try decoder.decodeSingularUInt64Field(value: &self.remotePendingCommitFeeSat) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.localTxid.isEmpty { + try visitor.visitSingularStringField(value: self.localTxid, fieldNumber: 1) + } + if !self.remoteTxid.isEmpty { + try visitor.visitSingularStringField(value: self.remoteTxid, fieldNumber: 2) + } + if !self.remotePendingTxid.isEmpty { + try visitor.visitSingularStringField(value: self.remotePendingTxid, fieldNumber: 3) + } + if self.localCommitFeeSat != 0 { + try visitor.visitSingularUInt64Field(value: self.localCommitFeeSat, fieldNumber: 4) + } + if self.remoteCommitFeeSat != 0 { + try visitor.visitSingularUInt64Field(value: self.remoteCommitFeeSat, fieldNumber: 5) + } + if self.remotePendingCommitFeeSat != 0 { + try visitor.visitSingularUInt64Field(value: self.remotePendingCommitFeeSat, fieldNumber: 6) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_PendingChannelsResponse.Commitments, rhs: Lnrpc_PendingChannelsResponse.Commitments) -> Bool { + if lhs.localTxid != rhs.localTxid {return false} + if lhs.remoteTxid != rhs.remoteTxid {return false} + if lhs.remotePendingTxid != rhs.remotePendingTxid {return false} + if lhs.localCommitFeeSat != rhs.localCommitFeeSat {return false} + if lhs.remoteCommitFeeSat != rhs.remoteCommitFeeSat {return false} + if lhs.remotePendingCommitFeeSat != rhs.remotePendingCommitFeeSat {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_PendingChannelsResponse.ClosedChannel: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = Lnrpc_PendingChannelsResponse.protoMessageName + ".ClosedChannel" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "channel"), + 2: .standard(proto: "closing_txid"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &self._channel) + case 2: try decoder.decodeSingularStringField(value: &self.closingTxid) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._channel { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + if !self.closingTxid.isEmpty { + try visitor.visitSingularStringField(value: self.closingTxid, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_PendingChannelsResponse.ClosedChannel, rhs: Lnrpc_PendingChannelsResponse.ClosedChannel) -> Bool { + if lhs._channel != rhs._channel {return false} + if lhs.closingTxid != rhs.closingTxid {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_PendingChannelsResponse.ForceClosedChannel: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = Lnrpc_PendingChannelsResponse.protoMessageName + ".ForceClosedChannel" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "channel"), + 2: .standard(proto: "closing_txid"), + 3: .standard(proto: "limbo_balance"), + 4: .standard(proto: "maturity_height"), + 5: .standard(proto: "blocks_til_maturity"), + 6: .standard(proto: "recovered_balance"), + 8: .standard(proto: "pending_htlcs"), + 9: .same(proto: "anchor"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &self._channel) + case 2: try decoder.decodeSingularStringField(value: &self.closingTxid) + case 3: try decoder.decodeSingularInt64Field(value: &self.limboBalance) + case 4: try decoder.decodeSingularUInt32Field(value: &self.maturityHeight) + case 5: try decoder.decodeSingularInt32Field(value: &self.blocksTilMaturity) + case 6: try decoder.decodeSingularInt64Field(value: &self.recoveredBalance) + case 8: try decoder.decodeRepeatedMessageField(value: &self.pendingHtlcs) + case 9: try decoder.decodeSingularEnumField(value: &self.anchor) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._channel { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + if !self.closingTxid.isEmpty { + try visitor.visitSingularStringField(value: self.closingTxid, fieldNumber: 2) + } + if self.limboBalance != 0 { + try visitor.visitSingularInt64Field(value: self.limboBalance, fieldNumber: 3) + } + if self.maturityHeight != 0 { + try visitor.visitSingularUInt32Field(value: self.maturityHeight, fieldNumber: 4) + } + if self.blocksTilMaturity != 0 { + try visitor.visitSingularInt32Field(value: self.blocksTilMaturity, fieldNumber: 5) + } + if self.recoveredBalance != 0 { + try visitor.visitSingularInt64Field(value: self.recoveredBalance, fieldNumber: 6) + } + if !self.pendingHtlcs.isEmpty { + try visitor.visitRepeatedMessageField(value: self.pendingHtlcs, fieldNumber: 8) + } + if self.anchor != .limbo { + try visitor.visitSingularEnumField(value: self.anchor, fieldNumber: 9) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_PendingChannelsResponse.ForceClosedChannel, rhs: Lnrpc_PendingChannelsResponse.ForceClosedChannel) -> Bool { + if lhs._channel != rhs._channel {return false} + if lhs.closingTxid != rhs.closingTxid {return false} + if lhs.limboBalance != rhs.limboBalance {return false} + if lhs.maturityHeight != rhs.maturityHeight {return false} + if lhs.blocksTilMaturity != rhs.blocksTilMaturity {return false} + if lhs.recoveredBalance != rhs.recoveredBalance {return false} + if lhs.pendingHtlcs != rhs.pendingHtlcs {return false} + if lhs.anchor != rhs.anchor {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_PendingChannelsResponse.ForceClosedChannel.AnchorState: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "LIMBO"), + 1: .same(proto: "RECOVERED"), + 2: .same(proto: "LOST"), + ] +} + +extension Lnrpc_ChannelEventSubscription: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ChannelEventSubscription" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ChannelEventSubscription, rhs: Lnrpc_ChannelEventSubscription) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ChannelEventUpdate: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ChannelEventUpdate" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "open_channel"), + 2: .standard(proto: "closed_channel"), + 3: .standard(proto: "active_channel"), + 4: .standard(proto: "inactive_channel"), + 6: .standard(proto: "pending_open_channel"), + 5: .same(proto: "type"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: + var v: Lnrpc_Channel? + if let current = self.channel { + try decoder.handleConflictingOneOf() + if case .openChannel(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {self.channel = .openChannel(v)} + case 2: + var v: Lnrpc_ChannelCloseSummary? + if let current = self.channel { + try decoder.handleConflictingOneOf() + if case .closedChannel(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {self.channel = .closedChannel(v)} + case 3: + var v: Lnrpc_ChannelPoint? + if let current = self.channel { + try decoder.handleConflictingOneOf() + if case .activeChannel(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {self.channel = .activeChannel(v)} + case 4: + var v: Lnrpc_ChannelPoint? + if let current = self.channel { + try decoder.handleConflictingOneOf() + if case .inactiveChannel(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {self.channel = .inactiveChannel(v)} + case 5: try decoder.decodeSingularEnumField(value: &self.type) + case 6: + var v: Lnrpc_PendingUpdate? + if let current = self.channel { + try decoder.handleConflictingOneOf() + if case .pendingOpenChannel(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {self.channel = .pendingOpenChannel(v)} + default: break + } + } + } + + func traverse(visitor: inout V) throws { + switch self.channel { + case .openChannel(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + case .closedChannel(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + case .activeChannel(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + case .inactiveChannel(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 4) + case nil: break + default: break + } + if self.type != .openChannel { + try visitor.visitSingularEnumField(value: self.type, fieldNumber: 5) + } + if case .pendingOpenChannel(let v)? = self.channel { + try visitor.visitSingularMessageField(value: v, fieldNumber: 6) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ChannelEventUpdate, rhs: Lnrpc_ChannelEventUpdate) -> Bool { + if lhs.channel != rhs.channel {return false} + if lhs.type != rhs.type {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ChannelEventUpdate.UpdateType: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "OPEN_CHANNEL"), + 1: .same(proto: "CLOSED_CHANNEL"), + 2: .same(proto: "ACTIVE_CHANNEL"), + 3: .same(proto: "INACTIVE_CHANNEL"), + 4: .same(proto: "PENDING_OPEN_CHANNEL"), + ] +} + +extension Lnrpc_WalletBalanceRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".WalletBalanceRequest" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_WalletBalanceRequest, rhs: Lnrpc_WalletBalanceRequest) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_WalletBalanceResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".WalletBalanceResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "total_balance"), + 2: .standard(proto: "confirmed_balance"), + 3: .standard(proto: "unconfirmed_balance"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularInt64Field(value: &self.totalBalance) + case 2: try decoder.decodeSingularInt64Field(value: &self.confirmedBalance) + case 3: try decoder.decodeSingularInt64Field(value: &self.unconfirmedBalance) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.totalBalance != 0 { + try visitor.visitSingularInt64Field(value: self.totalBalance, fieldNumber: 1) + } + if self.confirmedBalance != 0 { + try visitor.visitSingularInt64Field(value: self.confirmedBalance, fieldNumber: 2) + } + if self.unconfirmedBalance != 0 { + try visitor.visitSingularInt64Field(value: self.unconfirmedBalance, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_WalletBalanceResponse, rhs: Lnrpc_WalletBalanceResponse) -> Bool { + if lhs.totalBalance != rhs.totalBalance {return false} + if lhs.confirmedBalance != rhs.confirmedBalance {return false} + if lhs.unconfirmedBalance != rhs.unconfirmedBalance {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ChannelBalanceRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ChannelBalanceRequest" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ChannelBalanceRequest, rhs: Lnrpc_ChannelBalanceRequest) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ChannelBalanceResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ChannelBalanceResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "balance"), + 2: .standard(proto: "pending_open_balance"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularInt64Field(value: &self.balance) + case 2: try decoder.decodeSingularInt64Field(value: &self.pendingOpenBalance) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.balance != 0 { + try visitor.visitSingularInt64Field(value: self.balance, fieldNumber: 1) + } + if self.pendingOpenBalance != 0 { + try visitor.visitSingularInt64Field(value: self.pendingOpenBalance, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ChannelBalanceResponse, rhs: Lnrpc_ChannelBalanceResponse) -> Bool { + if lhs.balance != rhs.balance {return false} + if lhs.pendingOpenBalance != rhs.pendingOpenBalance {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_QueryRoutesRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".QueryRoutesRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "pub_key"), + 2: .same(proto: "amt"), + 12: .standard(proto: "amt_msat"), + 4: .standard(proto: "final_cltv_delta"), + 5: .standard(proto: "fee_limit"), + 6: .standard(proto: "ignored_nodes"), + 7: .standard(proto: "ignored_edges"), + 8: .standard(proto: "source_pub_key"), + 9: .standard(proto: "use_mission_control"), + 10: .standard(proto: "ignored_pairs"), + 11: .standard(proto: "cltv_limit"), + 13: .standard(proto: "dest_custom_records"), + 14: .standard(proto: "outgoing_chan_id"), + 15: .standard(proto: "last_hop_pubkey"), + 16: .standard(proto: "route_hints"), + 17: .standard(proto: "dest_features"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.pubKey) + case 2: try decoder.decodeSingularInt64Field(value: &self.amt) + case 4: try decoder.decodeSingularInt32Field(value: &self.finalCltvDelta) + case 5: try decoder.decodeSingularMessageField(value: &self._feeLimit) + case 6: try decoder.decodeRepeatedBytesField(value: &self.ignoredNodes) + case 7: try decoder.decodeRepeatedMessageField(value: &self.ignoredEdges) + case 8: try decoder.decodeSingularStringField(value: &self.sourcePubKey) + case 9: try decoder.decodeSingularBoolField(value: &self.useMissionControl) + case 10: try decoder.decodeRepeatedMessageField(value: &self.ignoredPairs) + case 11: try decoder.decodeSingularUInt32Field(value: &self.cltvLimit) + case 12: try decoder.decodeSingularInt64Field(value: &self.amtMsat) + case 13: try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: &self.destCustomRecords) + case 14: try decoder.decodeSingularUInt64Field(value: &self.outgoingChanID) + case 15: try decoder.decodeSingularBytesField(value: &self.lastHopPubkey) + case 16: try decoder.decodeRepeatedMessageField(value: &self.routeHints) + case 17: try decoder.decodeRepeatedEnumField(value: &self.destFeatures) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.pubKey.isEmpty { + try visitor.visitSingularStringField(value: self.pubKey, fieldNumber: 1) + } + if self.amt != 0 { + try visitor.visitSingularInt64Field(value: self.amt, fieldNumber: 2) + } + if self.finalCltvDelta != 0 { + try visitor.visitSingularInt32Field(value: self.finalCltvDelta, fieldNumber: 4) + } + if let v = self._feeLimit { + try visitor.visitSingularMessageField(value: v, fieldNumber: 5) + } + if !self.ignoredNodes.isEmpty { + try visitor.visitRepeatedBytesField(value: self.ignoredNodes, fieldNumber: 6) + } + if !self.ignoredEdges.isEmpty { + try visitor.visitRepeatedMessageField(value: self.ignoredEdges, fieldNumber: 7) + } + if !self.sourcePubKey.isEmpty { + try visitor.visitSingularStringField(value: self.sourcePubKey, fieldNumber: 8) + } + if self.useMissionControl != false { + try visitor.visitSingularBoolField(value: self.useMissionControl, fieldNumber: 9) + } + if !self.ignoredPairs.isEmpty { + try visitor.visitRepeatedMessageField(value: self.ignoredPairs, fieldNumber: 10) + } + if self.cltvLimit != 0 { + try visitor.visitSingularUInt32Field(value: self.cltvLimit, fieldNumber: 11) + } + if self.amtMsat != 0 { + try visitor.visitSingularInt64Field(value: self.amtMsat, fieldNumber: 12) + } + if !self.destCustomRecords.isEmpty { + try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: self.destCustomRecords, fieldNumber: 13) + } + if self.outgoingChanID != 0 { + try visitor.visitSingularUInt64Field(value: self.outgoingChanID, fieldNumber: 14) + } + if !self.lastHopPubkey.isEmpty { + try visitor.visitSingularBytesField(value: self.lastHopPubkey, fieldNumber: 15) + } + if !self.routeHints.isEmpty { + try visitor.visitRepeatedMessageField(value: self.routeHints, fieldNumber: 16) + } + if !self.destFeatures.isEmpty { + try visitor.visitPackedEnumField(value: self.destFeatures, fieldNumber: 17) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_QueryRoutesRequest, rhs: Lnrpc_QueryRoutesRequest) -> Bool { + if lhs.pubKey != rhs.pubKey {return false} + if lhs.amt != rhs.amt {return false} + if lhs.amtMsat != rhs.amtMsat {return false} + if lhs.finalCltvDelta != rhs.finalCltvDelta {return false} + if lhs._feeLimit != rhs._feeLimit {return false} + if lhs.ignoredNodes != rhs.ignoredNodes {return false} + if lhs.ignoredEdges != rhs.ignoredEdges {return false} + if lhs.sourcePubKey != rhs.sourcePubKey {return false} + if lhs.useMissionControl != rhs.useMissionControl {return false} + if lhs.ignoredPairs != rhs.ignoredPairs {return false} + if lhs.cltvLimit != rhs.cltvLimit {return false} + if lhs.destCustomRecords != rhs.destCustomRecords {return false} + if lhs.outgoingChanID != rhs.outgoingChanID {return false} + if lhs.lastHopPubkey != rhs.lastHopPubkey {return false} + if lhs.routeHints != rhs.routeHints {return false} + if lhs.destFeatures != rhs.destFeatures {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_NodePair: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".NodePair" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "from"), + 2: .same(proto: "to"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.from) + case 2: try decoder.decodeSingularBytesField(value: &self.to) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.from.isEmpty { + try visitor.visitSingularBytesField(value: self.from, fieldNumber: 1) + } + if !self.to.isEmpty { + try visitor.visitSingularBytesField(value: self.to, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_NodePair, rhs: Lnrpc_NodePair) -> Bool { + if lhs.from != rhs.from {return false} + if lhs.to != rhs.to {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_EdgeLocator: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".EdgeLocator" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "channel_id"), + 2: .standard(proto: "direction_reverse"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt64Field(value: &self.channelID) + case 2: try decoder.decodeSingularBoolField(value: &self.directionReverse) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.channelID != 0 { + try visitor.visitSingularUInt64Field(value: self.channelID, fieldNumber: 1) + } + if self.directionReverse != false { + try visitor.visitSingularBoolField(value: self.directionReverse, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_EdgeLocator, rhs: Lnrpc_EdgeLocator) -> Bool { + if lhs.channelID != rhs.channelID {return false} + if lhs.directionReverse != rhs.directionReverse {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_QueryRoutesResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".QueryRoutesResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "routes"), + 2: .standard(proto: "success_prob"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedMessageField(value: &self.routes) + case 2: try decoder.decodeSingularDoubleField(value: &self.successProb) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.routes.isEmpty { + try visitor.visitRepeatedMessageField(value: self.routes, fieldNumber: 1) + } + if self.successProb != 0 { + try visitor.visitSingularDoubleField(value: self.successProb, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_QueryRoutesResponse, rhs: Lnrpc_QueryRoutesResponse) -> Bool { + if lhs.routes != rhs.routes {return false} + if lhs.successProb != rhs.successProb {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_Hop: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Hop" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "chan_id"), + 2: .standard(proto: "chan_capacity"), + 3: .standard(proto: "amt_to_forward"), + 4: .same(proto: "fee"), + 5: .same(proto: "expiry"), + 6: .standard(proto: "amt_to_forward_msat"), + 7: .standard(proto: "fee_msat"), + 8: .standard(proto: "pub_key"), + 9: .standard(proto: "tlv_payload"), + 10: .standard(proto: "mpp_record"), + 11: .standard(proto: "custom_records"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt64Field(value: &self.chanID) + case 2: try decoder.decodeSingularInt64Field(value: &self.chanCapacity) + case 3: try decoder.decodeSingularInt64Field(value: &self.amtToForward) + case 4: try decoder.decodeSingularInt64Field(value: &self.fee) + case 5: try decoder.decodeSingularUInt32Field(value: &self.expiry) + case 6: try decoder.decodeSingularInt64Field(value: &self.amtToForwardMsat) + case 7: try decoder.decodeSingularInt64Field(value: &self.feeMsat) + case 8: try decoder.decodeSingularStringField(value: &self.pubKey) + case 9: try decoder.decodeSingularBoolField(value: &self.tlvPayload) + case 10: try decoder.decodeSingularMessageField(value: &self._mppRecord) + case 11: try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: &self.customRecords) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.chanID != 0 { + try visitor.visitSingularUInt64Field(value: self.chanID, fieldNumber: 1) + } + if self.chanCapacity != 0 { + try visitor.visitSingularInt64Field(value: self.chanCapacity, fieldNumber: 2) + } + if self.amtToForward != 0 { + try visitor.visitSingularInt64Field(value: self.amtToForward, fieldNumber: 3) + } + if self.fee != 0 { + try visitor.visitSingularInt64Field(value: self.fee, fieldNumber: 4) + } + if self.expiry != 0 { + try visitor.visitSingularUInt32Field(value: self.expiry, fieldNumber: 5) + } + if self.amtToForwardMsat != 0 { + try visitor.visitSingularInt64Field(value: self.amtToForwardMsat, fieldNumber: 6) + } + if self.feeMsat != 0 { + try visitor.visitSingularInt64Field(value: self.feeMsat, fieldNumber: 7) + } + if !self.pubKey.isEmpty { + try visitor.visitSingularStringField(value: self.pubKey, fieldNumber: 8) + } + if self.tlvPayload != false { + try visitor.visitSingularBoolField(value: self.tlvPayload, fieldNumber: 9) + } + if let v = self._mppRecord { + try visitor.visitSingularMessageField(value: v, fieldNumber: 10) + } + if !self.customRecords.isEmpty { + try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: self.customRecords, fieldNumber: 11) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_Hop, rhs: Lnrpc_Hop) -> Bool { + if lhs.chanID != rhs.chanID {return false} + if lhs.chanCapacity != rhs.chanCapacity {return false} + if lhs.amtToForward != rhs.amtToForward {return false} + if lhs.fee != rhs.fee {return false} + if lhs.expiry != rhs.expiry {return false} + if lhs.amtToForwardMsat != rhs.amtToForwardMsat {return false} + if lhs.feeMsat != rhs.feeMsat {return false} + if lhs.pubKey != rhs.pubKey {return false} + if lhs.tlvPayload != rhs.tlvPayload {return false} + if lhs._mppRecord != rhs._mppRecord {return false} + if lhs.customRecords != rhs.customRecords {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_MPPRecord: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".MPPRecord" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 11: .standard(proto: "payment_addr"), + 10: .standard(proto: "total_amt_msat"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 10: try decoder.decodeSingularInt64Field(value: &self.totalAmtMsat) + case 11: try decoder.decodeSingularBytesField(value: &self.paymentAddr) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.totalAmtMsat != 0 { + try visitor.visitSingularInt64Field(value: self.totalAmtMsat, fieldNumber: 10) + } + if !self.paymentAddr.isEmpty { + try visitor.visitSingularBytesField(value: self.paymentAddr, fieldNumber: 11) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_MPPRecord, rhs: Lnrpc_MPPRecord) -> Bool { + if lhs.paymentAddr != rhs.paymentAddr {return false} + if lhs.totalAmtMsat != rhs.totalAmtMsat {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_Route: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Route" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "total_time_lock"), + 2: .standard(proto: "total_fees"), + 3: .standard(proto: "total_amt"), + 4: .same(proto: "hops"), + 5: .standard(proto: "total_fees_msat"), + 6: .standard(proto: "total_amt_msat"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt32Field(value: &self.totalTimeLock) + case 2: try decoder.decodeSingularInt64Field(value: &self.totalFees) + case 3: try decoder.decodeSingularInt64Field(value: &self.totalAmt) + case 4: try decoder.decodeRepeatedMessageField(value: &self.hops) + case 5: try decoder.decodeSingularInt64Field(value: &self.totalFeesMsat) + case 6: try decoder.decodeSingularInt64Field(value: &self.totalAmtMsat) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.totalTimeLock != 0 { + try visitor.visitSingularUInt32Field(value: self.totalTimeLock, fieldNumber: 1) + } + if self.totalFees != 0 { + try visitor.visitSingularInt64Field(value: self.totalFees, fieldNumber: 2) + } + if self.totalAmt != 0 { + try visitor.visitSingularInt64Field(value: self.totalAmt, fieldNumber: 3) + } + if !self.hops.isEmpty { + try visitor.visitRepeatedMessageField(value: self.hops, fieldNumber: 4) + } + if self.totalFeesMsat != 0 { + try visitor.visitSingularInt64Field(value: self.totalFeesMsat, fieldNumber: 5) + } + if self.totalAmtMsat != 0 { + try visitor.visitSingularInt64Field(value: self.totalAmtMsat, fieldNumber: 6) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_Route, rhs: Lnrpc_Route) -> Bool { + if lhs.totalTimeLock != rhs.totalTimeLock {return false} + if lhs.totalFees != rhs.totalFees {return false} + if lhs.totalAmt != rhs.totalAmt {return false} + if lhs.hops != rhs.hops {return false} + if lhs.totalFeesMsat != rhs.totalFeesMsat {return false} + if lhs.totalAmtMsat != rhs.totalAmtMsat {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_NodeInfoRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".NodeInfoRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "pub_key"), + 2: .standard(proto: "include_channels"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.pubKey) + case 2: try decoder.decodeSingularBoolField(value: &self.includeChannels) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.pubKey.isEmpty { + try visitor.visitSingularStringField(value: self.pubKey, fieldNumber: 1) + } + if self.includeChannels != false { + try visitor.visitSingularBoolField(value: self.includeChannels, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_NodeInfoRequest, rhs: Lnrpc_NodeInfoRequest) -> Bool { + if lhs.pubKey != rhs.pubKey {return false} + if lhs.includeChannels != rhs.includeChannels {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_NodeInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".NodeInfo" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "node"), + 2: .standard(proto: "num_channels"), + 3: .standard(proto: "total_capacity"), + 4: .same(proto: "channels"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &self._node) + case 2: try decoder.decodeSingularUInt32Field(value: &self.numChannels) + case 3: try decoder.decodeSingularInt64Field(value: &self.totalCapacity) + case 4: try decoder.decodeRepeatedMessageField(value: &self.channels) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._node { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + if self.numChannels != 0 { + try visitor.visitSingularUInt32Field(value: self.numChannels, fieldNumber: 2) + } + if self.totalCapacity != 0 { + try visitor.visitSingularInt64Field(value: self.totalCapacity, fieldNumber: 3) + } + if !self.channels.isEmpty { + try visitor.visitRepeatedMessageField(value: self.channels, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_NodeInfo, rhs: Lnrpc_NodeInfo) -> Bool { + if lhs._node != rhs._node {return false} + if lhs.numChannels != rhs.numChannels {return false} + if lhs.totalCapacity != rhs.totalCapacity {return false} + if lhs.channels != rhs.channels {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_LightningNode: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".LightningNode" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "last_update"), + 2: .standard(proto: "pub_key"), + 3: .same(proto: "alias"), + 4: .same(proto: "addresses"), + 5: .same(proto: "color"), + 6: .same(proto: "features"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt32Field(value: &self.lastUpdate) + case 2: try decoder.decodeSingularStringField(value: &self.pubKey) + case 3: try decoder.decodeSingularStringField(value: &self.alias) + case 4: try decoder.decodeRepeatedMessageField(value: &self.addresses) + case 5: try decoder.decodeSingularStringField(value: &self.color) + case 6: try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap.self, value: &self.features) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.lastUpdate != 0 { + try visitor.visitSingularUInt32Field(value: self.lastUpdate, fieldNumber: 1) + } + if !self.pubKey.isEmpty { + try visitor.visitSingularStringField(value: self.pubKey, fieldNumber: 2) + } + if !self.alias.isEmpty { + try visitor.visitSingularStringField(value: self.alias, fieldNumber: 3) + } + if !self.addresses.isEmpty { + try visitor.visitRepeatedMessageField(value: self.addresses, fieldNumber: 4) + } + if !self.color.isEmpty { + try visitor.visitSingularStringField(value: self.color, fieldNumber: 5) + } + if !self.features.isEmpty { + try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap.self, value: self.features, fieldNumber: 6) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_LightningNode, rhs: Lnrpc_LightningNode) -> Bool { + if lhs.lastUpdate != rhs.lastUpdate {return false} + if lhs.pubKey != rhs.pubKey {return false} + if lhs.alias != rhs.alias {return false} + if lhs.addresses != rhs.addresses {return false} + if lhs.color != rhs.color {return false} + if lhs.features != rhs.features {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_NodeAddress: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".NodeAddress" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "network"), + 2: .same(proto: "addr"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.network) + case 2: try decoder.decodeSingularStringField(value: &self.addr) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.network.isEmpty { + try visitor.visitSingularStringField(value: self.network, fieldNumber: 1) + } + if !self.addr.isEmpty { + try visitor.visitSingularStringField(value: self.addr, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_NodeAddress, rhs: Lnrpc_NodeAddress) -> Bool { + if lhs.network != rhs.network {return false} + if lhs.addr != rhs.addr {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_RoutingPolicy: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".RoutingPolicy" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "time_lock_delta"), + 2: .standard(proto: "min_htlc"), + 3: .standard(proto: "fee_base_msat"), + 4: .standard(proto: "fee_rate_milli_msat"), + 5: .same(proto: "disabled"), + 6: .standard(proto: "max_htlc_msat"), + 7: .standard(proto: "last_update"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt32Field(value: &self.timeLockDelta) + case 2: try decoder.decodeSingularInt64Field(value: &self.minHtlc) + case 3: try decoder.decodeSingularInt64Field(value: &self.feeBaseMsat) + case 4: try decoder.decodeSingularInt64Field(value: &self.feeRateMilliMsat) + case 5: try decoder.decodeSingularBoolField(value: &self.disabled) + case 6: try decoder.decodeSingularUInt64Field(value: &self.maxHtlcMsat) + case 7: try decoder.decodeSingularUInt32Field(value: &self.lastUpdate) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.timeLockDelta != 0 { + try visitor.visitSingularUInt32Field(value: self.timeLockDelta, fieldNumber: 1) + } + if self.minHtlc != 0 { + try visitor.visitSingularInt64Field(value: self.minHtlc, fieldNumber: 2) + } + if self.feeBaseMsat != 0 { + try visitor.visitSingularInt64Field(value: self.feeBaseMsat, fieldNumber: 3) + } + if self.feeRateMilliMsat != 0 { + try visitor.visitSingularInt64Field(value: self.feeRateMilliMsat, fieldNumber: 4) + } + if self.disabled != false { + try visitor.visitSingularBoolField(value: self.disabled, fieldNumber: 5) + } + if self.maxHtlcMsat != 0 { + try visitor.visitSingularUInt64Field(value: self.maxHtlcMsat, fieldNumber: 6) + } + if self.lastUpdate != 0 { + try visitor.visitSingularUInt32Field(value: self.lastUpdate, fieldNumber: 7) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_RoutingPolicy, rhs: Lnrpc_RoutingPolicy) -> Bool { + if lhs.timeLockDelta != rhs.timeLockDelta {return false} + if lhs.minHtlc != rhs.minHtlc {return false} + if lhs.feeBaseMsat != rhs.feeBaseMsat {return false} + if lhs.feeRateMilliMsat != rhs.feeRateMilliMsat {return false} + if lhs.disabled != rhs.disabled {return false} + if lhs.maxHtlcMsat != rhs.maxHtlcMsat {return false} + if lhs.lastUpdate != rhs.lastUpdate {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ChannelEdge: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ChannelEdge" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "channel_id"), + 2: .standard(proto: "chan_point"), + 3: .standard(proto: "last_update"), + 4: .standard(proto: "node1_pub"), + 5: .standard(proto: "node2_pub"), + 6: .same(proto: "capacity"), + 7: .standard(proto: "node1_policy"), + 8: .standard(proto: "node2_policy"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt64Field(value: &self.channelID) + case 2: try decoder.decodeSingularStringField(value: &self.chanPoint) + case 3: try decoder.decodeSingularUInt32Field(value: &self.lastUpdate) + case 4: try decoder.decodeSingularStringField(value: &self.node1Pub) + case 5: try decoder.decodeSingularStringField(value: &self.node2Pub) + case 6: try decoder.decodeSingularInt64Field(value: &self.capacity) + case 7: try decoder.decodeSingularMessageField(value: &self._node1Policy) + case 8: try decoder.decodeSingularMessageField(value: &self._node2Policy) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.channelID != 0 { + try visitor.visitSingularUInt64Field(value: self.channelID, fieldNumber: 1) + } + if !self.chanPoint.isEmpty { + try visitor.visitSingularStringField(value: self.chanPoint, fieldNumber: 2) + } + if self.lastUpdate != 0 { + try visitor.visitSingularUInt32Field(value: self.lastUpdate, fieldNumber: 3) + } + if !self.node1Pub.isEmpty { + try visitor.visitSingularStringField(value: self.node1Pub, fieldNumber: 4) + } + if !self.node2Pub.isEmpty { + try visitor.visitSingularStringField(value: self.node2Pub, fieldNumber: 5) + } + if self.capacity != 0 { + try visitor.visitSingularInt64Field(value: self.capacity, fieldNumber: 6) + } + if let v = self._node1Policy { + try visitor.visitSingularMessageField(value: v, fieldNumber: 7) + } + if let v = self._node2Policy { + try visitor.visitSingularMessageField(value: v, fieldNumber: 8) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ChannelEdge, rhs: Lnrpc_ChannelEdge) -> Bool { + if lhs.channelID != rhs.channelID {return false} + if lhs.chanPoint != rhs.chanPoint {return false} + if lhs.lastUpdate != rhs.lastUpdate {return false} + if lhs.node1Pub != rhs.node1Pub {return false} + if lhs.node2Pub != rhs.node2Pub {return false} + if lhs.capacity != rhs.capacity {return false} + if lhs._node1Policy != rhs._node1Policy {return false} + if lhs._node2Policy != rhs._node2Policy {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ChannelGraphRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ChannelGraphRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "include_unannounced"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBoolField(value: &self.includeUnannounced) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.includeUnannounced != false { + try visitor.visitSingularBoolField(value: self.includeUnannounced, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ChannelGraphRequest, rhs: Lnrpc_ChannelGraphRequest) -> Bool { + if lhs.includeUnannounced != rhs.includeUnannounced {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ChannelGraph: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ChannelGraph" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "nodes"), + 2: .same(proto: "edges"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedMessageField(value: &self.nodes) + case 2: try decoder.decodeRepeatedMessageField(value: &self.edges) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.nodes.isEmpty { + try visitor.visitRepeatedMessageField(value: self.nodes, fieldNumber: 1) + } + if !self.edges.isEmpty { + try visitor.visitRepeatedMessageField(value: self.edges, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ChannelGraph, rhs: Lnrpc_ChannelGraph) -> Bool { + if lhs.nodes != rhs.nodes {return false} + if lhs.edges != rhs.edges {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_NodeMetricsRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".NodeMetricsRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "types"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedEnumField(value: &self.types) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.types.isEmpty { + try visitor.visitPackedEnumField(value: self.types, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_NodeMetricsRequest, rhs: Lnrpc_NodeMetricsRequest) -> Bool { + if lhs.types != rhs.types {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_NodeMetricsResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".NodeMetricsResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "betweenness_centrality"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap.self, value: &self.betweennessCentrality) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.betweennessCentrality.isEmpty { + try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap.self, value: self.betweennessCentrality, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_NodeMetricsResponse, rhs: Lnrpc_NodeMetricsResponse) -> Bool { + if lhs.betweennessCentrality != rhs.betweennessCentrality {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_FloatMetric: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".FloatMetric" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "value"), + 2: .standard(proto: "normalized_value"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularDoubleField(value: &self.value) + case 2: try decoder.decodeSingularDoubleField(value: &self.normalizedValue) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.value != 0 { + try visitor.visitSingularDoubleField(value: self.value, fieldNumber: 1) + } + if self.normalizedValue != 0 { + try visitor.visitSingularDoubleField(value: self.normalizedValue, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_FloatMetric, rhs: Lnrpc_FloatMetric) -> Bool { + if lhs.value != rhs.value {return false} + if lhs.normalizedValue != rhs.normalizedValue {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ChanInfoRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ChanInfoRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "chan_id"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt64Field(value: &self.chanID) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.chanID != 0 { + try visitor.visitSingularUInt64Field(value: self.chanID, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ChanInfoRequest, rhs: Lnrpc_ChanInfoRequest) -> Bool { + if lhs.chanID != rhs.chanID {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_NetworkInfoRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".NetworkInfoRequest" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_NetworkInfoRequest, rhs: Lnrpc_NetworkInfoRequest) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_NetworkInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".NetworkInfo" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "graph_diameter"), + 2: .standard(proto: "avg_out_degree"), + 3: .standard(proto: "max_out_degree"), + 4: .standard(proto: "num_nodes"), + 5: .standard(proto: "num_channels"), + 6: .standard(proto: "total_network_capacity"), + 7: .standard(proto: "avg_channel_size"), + 8: .standard(proto: "min_channel_size"), + 9: .standard(proto: "max_channel_size"), + 10: .standard(proto: "median_channel_size_sat"), + 11: .standard(proto: "num_zombie_chans"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt32Field(value: &self.graphDiameter) + case 2: try decoder.decodeSingularDoubleField(value: &self.avgOutDegree) + case 3: try decoder.decodeSingularUInt32Field(value: &self.maxOutDegree) + case 4: try decoder.decodeSingularUInt32Field(value: &self.numNodes) + case 5: try decoder.decodeSingularUInt32Field(value: &self.numChannels) + case 6: try decoder.decodeSingularInt64Field(value: &self.totalNetworkCapacity) + case 7: try decoder.decodeSingularDoubleField(value: &self.avgChannelSize) + case 8: try decoder.decodeSingularInt64Field(value: &self.minChannelSize) + case 9: try decoder.decodeSingularInt64Field(value: &self.maxChannelSize) + case 10: try decoder.decodeSingularInt64Field(value: &self.medianChannelSizeSat) + case 11: try decoder.decodeSingularUInt64Field(value: &self.numZombieChans) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.graphDiameter != 0 { + try visitor.visitSingularUInt32Field(value: self.graphDiameter, fieldNumber: 1) + } + if self.avgOutDegree != 0 { + try visitor.visitSingularDoubleField(value: self.avgOutDegree, fieldNumber: 2) + } + if self.maxOutDegree != 0 { + try visitor.visitSingularUInt32Field(value: self.maxOutDegree, fieldNumber: 3) + } + if self.numNodes != 0 { + try visitor.visitSingularUInt32Field(value: self.numNodes, fieldNumber: 4) + } + if self.numChannels != 0 { + try visitor.visitSingularUInt32Field(value: self.numChannels, fieldNumber: 5) + } + if self.totalNetworkCapacity != 0 { + try visitor.visitSingularInt64Field(value: self.totalNetworkCapacity, fieldNumber: 6) + } + if self.avgChannelSize != 0 { + try visitor.visitSingularDoubleField(value: self.avgChannelSize, fieldNumber: 7) + } + if self.minChannelSize != 0 { + try visitor.visitSingularInt64Field(value: self.minChannelSize, fieldNumber: 8) + } + if self.maxChannelSize != 0 { + try visitor.visitSingularInt64Field(value: self.maxChannelSize, fieldNumber: 9) + } + if self.medianChannelSizeSat != 0 { + try visitor.visitSingularInt64Field(value: self.medianChannelSizeSat, fieldNumber: 10) + } + if self.numZombieChans != 0 { + try visitor.visitSingularUInt64Field(value: self.numZombieChans, fieldNumber: 11) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_NetworkInfo, rhs: Lnrpc_NetworkInfo) -> Bool { + if lhs.graphDiameter != rhs.graphDiameter {return false} + if lhs.avgOutDegree != rhs.avgOutDegree {return false} + if lhs.maxOutDegree != rhs.maxOutDegree {return false} + if lhs.numNodes != rhs.numNodes {return false} + if lhs.numChannels != rhs.numChannels {return false} + if lhs.totalNetworkCapacity != rhs.totalNetworkCapacity {return false} + if lhs.avgChannelSize != rhs.avgChannelSize {return false} + if lhs.minChannelSize != rhs.minChannelSize {return false} + if lhs.maxChannelSize != rhs.maxChannelSize {return false} + if lhs.medianChannelSizeSat != rhs.medianChannelSizeSat {return false} + if lhs.numZombieChans != rhs.numZombieChans {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_StopRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".StopRequest" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_StopRequest, rhs: Lnrpc_StopRequest) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_StopResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".StopResponse" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_StopResponse, rhs: Lnrpc_StopResponse) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_GraphTopologySubscription: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".GraphTopologySubscription" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_GraphTopologySubscription, rhs: Lnrpc_GraphTopologySubscription) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_GraphTopologyUpdate: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".GraphTopologyUpdate" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "node_updates"), + 2: .standard(proto: "channel_updates"), + 3: .standard(proto: "closed_chans"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedMessageField(value: &self.nodeUpdates) + case 2: try decoder.decodeRepeatedMessageField(value: &self.channelUpdates) + case 3: try decoder.decodeRepeatedMessageField(value: &self.closedChans) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.nodeUpdates.isEmpty { + try visitor.visitRepeatedMessageField(value: self.nodeUpdates, fieldNumber: 1) + } + if !self.channelUpdates.isEmpty { + try visitor.visitRepeatedMessageField(value: self.channelUpdates, fieldNumber: 2) + } + if !self.closedChans.isEmpty { + try visitor.visitRepeatedMessageField(value: self.closedChans, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_GraphTopologyUpdate, rhs: Lnrpc_GraphTopologyUpdate) -> Bool { + if lhs.nodeUpdates != rhs.nodeUpdates {return false} + if lhs.channelUpdates != rhs.channelUpdates {return false} + if lhs.closedChans != rhs.closedChans {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_NodeUpdate: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".NodeUpdate" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "addresses"), + 2: .standard(proto: "identity_key"), + 3: .standard(proto: "global_features"), + 4: .same(proto: "alias"), + 5: .same(proto: "color"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedStringField(value: &self.addresses) + case 2: try decoder.decodeSingularStringField(value: &self.identityKey) + case 3: try decoder.decodeSingularBytesField(value: &self.globalFeatures) + case 4: try decoder.decodeSingularStringField(value: &self.alias) + case 5: try decoder.decodeSingularStringField(value: &self.color) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.addresses.isEmpty { + try visitor.visitRepeatedStringField(value: self.addresses, fieldNumber: 1) + } + if !self.identityKey.isEmpty { + try visitor.visitSingularStringField(value: self.identityKey, fieldNumber: 2) + } + if !self.globalFeatures.isEmpty { + try visitor.visitSingularBytesField(value: self.globalFeatures, fieldNumber: 3) + } + if !self.alias.isEmpty { + try visitor.visitSingularStringField(value: self.alias, fieldNumber: 4) + } + if !self.color.isEmpty { + try visitor.visitSingularStringField(value: self.color, fieldNumber: 5) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_NodeUpdate, rhs: Lnrpc_NodeUpdate) -> Bool { + if lhs.addresses != rhs.addresses {return false} + if lhs.identityKey != rhs.identityKey {return false} + if lhs.globalFeatures != rhs.globalFeatures {return false} + if lhs.alias != rhs.alias {return false} + if lhs.color != rhs.color {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ChannelEdgeUpdate: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ChannelEdgeUpdate" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "chan_id"), + 2: .standard(proto: "chan_point"), + 3: .same(proto: "capacity"), + 4: .standard(proto: "routing_policy"), + 5: .standard(proto: "advertising_node"), + 6: .standard(proto: "connecting_node"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt64Field(value: &self.chanID) + case 2: try decoder.decodeSingularMessageField(value: &self._chanPoint) + case 3: try decoder.decodeSingularInt64Field(value: &self.capacity) + case 4: try decoder.decodeSingularMessageField(value: &self._routingPolicy) + case 5: try decoder.decodeSingularStringField(value: &self.advertisingNode) + case 6: try decoder.decodeSingularStringField(value: &self.connectingNode) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.chanID != 0 { + try visitor.visitSingularUInt64Field(value: self.chanID, fieldNumber: 1) + } + if let v = self._chanPoint { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } + if self.capacity != 0 { + try visitor.visitSingularInt64Field(value: self.capacity, fieldNumber: 3) + } + if let v = self._routingPolicy { + try visitor.visitSingularMessageField(value: v, fieldNumber: 4) + } + if !self.advertisingNode.isEmpty { + try visitor.visitSingularStringField(value: self.advertisingNode, fieldNumber: 5) + } + if !self.connectingNode.isEmpty { + try visitor.visitSingularStringField(value: self.connectingNode, fieldNumber: 6) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ChannelEdgeUpdate, rhs: Lnrpc_ChannelEdgeUpdate) -> Bool { + if lhs.chanID != rhs.chanID {return false} + if lhs._chanPoint != rhs._chanPoint {return false} + if lhs.capacity != rhs.capacity {return false} + if lhs._routingPolicy != rhs._routingPolicy {return false} + if lhs.advertisingNode != rhs.advertisingNode {return false} + if lhs.connectingNode != rhs.connectingNode {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ClosedChannelUpdate: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ClosedChannelUpdate" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "chan_id"), + 2: .same(proto: "capacity"), + 3: .standard(proto: "closed_height"), + 4: .standard(proto: "chan_point"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt64Field(value: &self.chanID) + case 2: try decoder.decodeSingularInt64Field(value: &self.capacity) + case 3: try decoder.decodeSingularUInt32Field(value: &self.closedHeight) + case 4: try decoder.decodeSingularMessageField(value: &self._chanPoint) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.chanID != 0 { + try visitor.visitSingularUInt64Field(value: self.chanID, fieldNumber: 1) + } + if self.capacity != 0 { + try visitor.visitSingularInt64Field(value: self.capacity, fieldNumber: 2) + } + if self.closedHeight != 0 { + try visitor.visitSingularUInt32Field(value: self.closedHeight, fieldNumber: 3) + } + if let v = self._chanPoint { + try visitor.visitSingularMessageField(value: v, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ClosedChannelUpdate, rhs: Lnrpc_ClosedChannelUpdate) -> Bool { + if lhs.chanID != rhs.chanID {return false} + if lhs.capacity != rhs.capacity {return false} + if lhs.closedHeight != rhs.closedHeight {return false} + if lhs._chanPoint != rhs._chanPoint {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_HopHint: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".HopHint" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "node_id"), + 2: .standard(proto: "chan_id"), + 3: .standard(proto: "fee_base_msat"), + 4: .standard(proto: "fee_proportional_millionths"), + 5: .standard(proto: "cltv_expiry_delta"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.nodeID) + case 2: try decoder.decodeSingularUInt64Field(value: &self.chanID) + case 3: try decoder.decodeSingularUInt32Field(value: &self.feeBaseMsat) + case 4: try decoder.decodeSingularUInt32Field(value: &self.feeProportionalMillionths) + case 5: try decoder.decodeSingularUInt32Field(value: &self.cltvExpiryDelta) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.nodeID.isEmpty { + try visitor.visitSingularStringField(value: self.nodeID, fieldNumber: 1) + } + if self.chanID != 0 { + try visitor.visitSingularUInt64Field(value: self.chanID, fieldNumber: 2) + } + if self.feeBaseMsat != 0 { + try visitor.visitSingularUInt32Field(value: self.feeBaseMsat, fieldNumber: 3) + } + if self.feeProportionalMillionths != 0 { + try visitor.visitSingularUInt32Field(value: self.feeProportionalMillionths, fieldNumber: 4) + } + if self.cltvExpiryDelta != 0 { + try visitor.visitSingularUInt32Field(value: self.cltvExpiryDelta, fieldNumber: 5) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_HopHint, rhs: Lnrpc_HopHint) -> Bool { + if lhs.nodeID != rhs.nodeID {return false} + if lhs.chanID != rhs.chanID {return false} + if lhs.feeBaseMsat != rhs.feeBaseMsat {return false} + if lhs.feeProportionalMillionths != rhs.feeProportionalMillionths {return false} + if lhs.cltvExpiryDelta != rhs.cltvExpiryDelta {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_RouteHint: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".RouteHint" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "hop_hints"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedMessageField(value: &self.hopHints) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.hopHints.isEmpty { + try visitor.visitRepeatedMessageField(value: self.hopHints, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_RouteHint, rhs: Lnrpc_RouteHint) -> Bool { + if lhs.hopHints != rhs.hopHints {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_Invoice: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Invoice" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "memo"), + 3: .standard(proto: "r_preimage"), + 4: .standard(proto: "r_hash"), + 5: .same(proto: "value"), + 23: .standard(proto: "value_msat"), + 6: .same(proto: "settled"), + 7: .standard(proto: "creation_date"), + 8: .standard(proto: "settle_date"), + 9: .standard(proto: "payment_request"), + 10: .standard(proto: "description_hash"), + 11: .same(proto: "expiry"), + 12: .standard(proto: "fallback_addr"), + 13: .standard(proto: "cltv_expiry"), + 14: .standard(proto: "route_hints"), + 15: .same(proto: "private"), + 16: .standard(proto: "add_index"), + 17: .standard(proto: "settle_index"), + 18: .standard(proto: "amt_paid"), + 19: .standard(proto: "amt_paid_sat"), + 20: .standard(proto: "amt_paid_msat"), + 21: .same(proto: "state"), + 22: .same(proto: "htlcs"), + 24: .same(proto: "features"), + 25: .standard(proto: "is_keysend"), + ] + + fileprivate class _StorageClass { + var _memo: String = String() + var _rPreimage: Data = SwiftProtobuf.Internal.emptyData + var _rHash: Data = SwiftProtobuf.Internal.emptyData + var _value: Int64 = 0 + var _valueMsat: Int64 = 0 + var _settled: Bool = false + var _creationDate: Int64 = 0 + var _settleDate: Int64 = 0 + var _paymentRequest: String = String() + var _descriptionHash: Data = SwiftProtobuf.Internal.emptyData + var _expiry: Int64 = 0 + var _fallbackAddr: String = String() + var _cltvExpiry: UInt64 = 0 + var _routeHints: [Lnrpc_RouteHint] = [] + var _private: Bool = false + var _addIndex: UInt64 = 0 + var _settleIndex: UInt64 = 0 + var _amtPaid: Int64 = 0 + var _amtPaidSat: Int64 = 0 + var _amtPaidMsat: Int64 = 0 + var _state: Lnrpc_Invoice.InvoiceState = .open + var _htlcs: [Lnrpc_InvoiceHTLC] = [] + var _features: Dictionary = [:] + var _isKeysend: Bool = false + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _memo = source._memo + _rPreimage = source._rPreimage + _rHash = source._rHash + _value = source._value + _valueMsat = source._valueMsat + _settled = source._settled + _creationDate = source._creationDate + _settleDate = source._settleDate + _paymentRequest = source._paymentRequest + _descriptionHash = source._descriptionHash + _expiry = source._expiry + _fallbackAddr = source._fallbackAddr + _cltvExpiry = source._cltvExpiry + _routeHints = source._routeHints + _private = source._private + _addIndex = source._addIndex + _settleIndex = source._settleIndex + _amtPaid = source._amtPaid + _amtPaidSat = source._amtPaidSat + _amtPaidMsat = source._amtPaidMsat + _state = source._state + _htlcs = source._htlcs + _features = source._features + _isKeysend = source._isKeysend + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + + mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &_storage._memo) + case 3: try decoder.decodeSingularBytesField(value: &_storage._rPreimage) + case 4: try decoder.decodeSingularBytesField(value: &_storage._rHash) + case 5: try decoder.decodeSingularInt64Field(value: &_storage._value) + case 6: try decoder.decodeSingularBoolField(value: &_storage._settled) + case 7: try decoder.decodeSingularInt64Field(value: &_storage._creationDate) + case 8: try decoder.decodeSingularInt64Field(value: &_storage._settleDate) + case 9: try decoder.decodeSingularStringField(value: &_storage._paymentRequest) + case 10: try decoder.decodeSingularBytesField(value: &_storage._descriptionHash) + case 11: try decoder.decodeSingularInt64Field(value: &_storage._expiry) + case 12: try decoder.decodeSingularStringField(value: &_storage._fallbackAddr) + case 13: try decoder.decodeSingularUInt64Field(value: &_storage._cltvExpiry) + case 14: try decoder.decodeRepeatedMessageField(value: &_storage._routeHints) + case 15: try decoder.decodeSingularBoolField(value: &_storage._private) + case 16: try decoder.decodeSingularUInt64Field(value: &_storage._addIndex) + case 17: try decoder.decodeSingularUInt64Field(value: &_storage._settleIndex) + case 18: try decoder.decodeSingularInt64Field(value: &_storage._amtPaid) + case 19: try decoder.decodeSingularInt64Field(value: &_storage._amtPaidSat) + case 20: try decoder.decodeSingularInt64Field(value: &_storage._amtPaidMsat) + case 21: try decoder.decodeSingularEnumField(value: &_storage._state) + case 22: try decoder.decodeRepeatedMessageField(value: &_storage._htlcs) + case 23: try decoder.decodeSingularInt64Field(value: &_storage._valueMsat) + case 24: try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap.self, value: &_storage._features) + case 25: try decoder.decodeSingularBoolField(value: &_storage._isKeysend) + default: break + } + } + } + } + + func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + if !_storage._memo.isEmpty { + try visitor.visitSingularStringField(value: _storage._memo, fieldNumber: 1) + } + if !_storage._rPreimage.isEmpty { + try visitor.visitSingularBytesField(value: _storage._rPreimage, fieldNumber: 3) + } + if !_storage._rHash.isEmpty { + try visitor.visitSingularBytesField(value: _storage._rHash, fieldNumber: 4) + } + if _storage._value != 0 { + try visitor.visitSingularInt64Field(value: _storage._value, fieldNumber: 5) + } + if _storage._settled != false { + try visitor.visitSingularBoolField(value: _storage._settled, fieldNumber: 6) + } + if _storage._creationDate != 0 { + try visitor.visitSingularInt64Field(value: _storage._creationDate, fieldNumber: 7) + } + if _storage._settleDate != 0 { + try visitor.visitSingularInt64Field(value: _storage._settleDate, fieldNumber: 8) + } + if !_storage._paymentRequest.isEmpty { + try visitor.visitSingularStringField(value: _storage._paymentRequest, fieldNumber: 9) + } + if !_storage._descriptionHash.isEmpty { + try visitor.visitSingularBytesField(value: _storage._descriptionHash, fieldNumber: 10) + } + if _storage._expiry != 0 { + try visitor.visitSingularInt64Field(value: _storage._expiry, fieldNumber: 11) + } + if !_storage._fallbackAddr.isEmpty { + try visitor.visitSingularStringField(value: _storage._fallbackAddr, fieldNumber: 12) + } + if _storage._cltvExpiry != 0 { + try visitor.visitSingularUInt64Field(value: _storage._cltvExpiry, fieldNumber: 13) + } + if !_storage._routeHints.isEmpty { + try visitor.visitRepeatedMessageField(value: _storage._routeHints, fieldNumber: 14) + } + if _storage._private != false { + try visitor.visitSingularBoolField(value: _storage._private, fieldNumber: 15) + } + if _storage._addIndex != 0 { + try visitor.visitSingularUInt64Field(value: _storage._addIndex, fieldNumber: 16) + } + if _storage._settleIndex != 0 { + try visitor.visitSingularUInt64Field(value: _storage._settleIndex, fieldNumber: 17) + } + if _storage._amtPaid != 0 { + try visitor.visitSingularInt64Field(value: _storage._amtPaid, fieldNumber: 18) + } + if _storage._amtPaidSat != 0 { + try visitor.visitSingularInt64Field(value: _storage._amtPaidSat, fieldNumber: 19) + } + if _storage._amtPaidMsat != 0 { + try visitor.visitSingularInt64Field(value: _storage._amtPaidMsat, fieldNumber: 20) + } + if _storage._state != .open { + try visitor.visitSingularEnumField(value: _storage._state, fieldNumber: 21) + } + if !_storage._htlcs.isEmpty { + try visitor.visitRepeatedMessageField(value: _storage._htlcs, fieldNumber: 22) + } + if _storage._valueMsat != 0 { + try visitor.visitSingularInt64Field(value: _storage._valueMsat, fieldNumber: 23) + } + if !_storage._features.isEmpty { + try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap.self, value: _storage._features, fieldNumber: 24) + } + if _storage._isKeysend != false { + try visitor.visitSingularBoolField(value: _storage._isKeysend, fieldNumber: 25) + } + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_Invoice, rhs: Lnrpc_Invoice) -> Bool { + if lhs._storage !== rhs._storage { + let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let rhs_storage = _args.1 + if _storage._memo != rhs_storage._memo {return false} + if _storage._rPreimage != rhs_storage._rPreimage {return false} + if _storage._rHash != rhs_storage._rHash {return false} + if _storage._value != rhs_storage._value {return false} + if _storage._valueMsat != rhs_storage._valueMsat {return false} + if _storage._settled != rhs_storage._settled {return false} + if _storage._creationDate != rhs_storage._creationDate {return false} + if _storage._settleDate != rhs_storage._settleDate {return false} + if _storage._paymentRequest != rhs_storage._paymentRequest {return false} + if _storage._descriptionHash != rhs_storage._descriptionHash {return false} + if _storage._expiry != rhs_storage._expiry {return false} + if _storage._fallbackAddr != rhs_storage._fallbackAddr {return false} + if _storage._cltvExpiry != rhs_storage._cltvExpiry {return false} + if _storage._routeHints != rhs_storage._routeHints {return false} + if _storage._private != rhs_storage._private {return false} + if _storage._addIndex != rhs_storage._addIndex {return false} + if _storage._settleIndex != rhs_storage._settleIndex {return false} + if _storage._amtPaid != rhs_storage._amtPaid {return false} + if _storage._amtPaidSat != rhs_storage._amtPaidSat {return false} + if _storage._amtPaidMsat != rhs_storage._amtPaidMsat {return false} + if _storage._state != rhs_storage._state {return false} + if _storage._htlcs != rhs_storage._htlcs {return false} + if _storage._features != rhs_storage._features {return false} + if _storage._isKeysend != rhs_storage._isKeysend {return false} + return true + } + if !storagesAreEqual {return false} + } + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_Invoice.InvoiceState: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "OPEN"), + 1: .same(proto: "SETTLED"), + 2: .same(proto: "CANCELED"), + 3: .same(proto: "ACCEPTED"), + ] +} + +extension Lnrpc_InvoiceHTLC: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".InvoiceHTLC" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "chan_id"), + 2: .standard(proto: "htlc_index"), + 3: .standard(proto: "amt_msat"), + 4: .standard(proto: "accept_height"), + 5: .standard(proto: "accept_time"), + 6: .standard(proto: "resolve_time"), + 7: .standard(proto: "expiry_height"), + 8: .same(proto: "state"), + 9: .standard(proto: "custom_records"), + 10: .standard(proto: "mpp_total_amt_msat"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt64Field(value: &self.chanID) + case 2: try decoder.decodeSingularUInt64Field(value: &self.htlcIndex) + case 3: try decoder.decodeSingularUInt64Field(value: &self.amtMsat) + case 4: try decoder.decodeSingularInt32Field(value: &self.acceptHeight) + case 5: try decoder.decodeSingularInt64Field(value: &self.acceptTime) + case 6: try decoder.decodeSingularInt64Field(value: &self.resolveTime) + case 7: try decoder.decodeSingularInt32Field(value: &self.expiryHeight) + case 8: try decoder.decodeSingularEnumField(value: &self.state) + case 9: try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: &self.customRecords) + case 10: try decoder.decodeSingularUInt64Field(value: &self.mppTotalAmtMsat) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.chanID != 0 { + try visitor.visitSingularUInt64Field(value: self.chanID, fieldNumber: 1) + } + if self.htlcIndex != 0 { + try visitor.visitSingularUInt64Field(value: self.htlcIndex, fieldNumber: 2) + } + if self.amtMsat != 0 { + try visitor.visitSingularUInt64Field(value: self.amtMsat, fieldNumber: 3) + } + if self.acceptHeight != 0 { + try visitor.visitSingularInt32Field(value: self.acceptHeight, fieldNumber: 4) + } + if self.acceptTime != 0 { + try visitor.visitSingularInt64Field(value: self.acceptTime, fieldNumber: 5) + } + if self.resolveTime != 0 { + try visitor.visitSingularInt64Field(value: self.resolveTime, fieldNumber: 6) + } + if self.expiryHeight != 0 { + try visitor.visitSingularInt32Field(value: self.expiryHeight, fieldNumber: 7) + } + if self.state != .accepted { + try visitor.visitSingularEnumField(value: self.state, fieldNumber: 8) + } + if !self.customRecords.isEmpty { + try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap.self, value: self.customRecords, fieldNumber: 9) + } + if self.mppTotalAmtMsat != 0 { + try visitor.visitSingularUInt64Field(value: self.mppTotalAmtMsat, fieldNumber: 10) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_InvoiceHTLC, rhs: Lnrpc_InvoiceHTLC) -> Bool { + if lhs.chanID != rhs.chanID {return false} + if lhs.htlcIndex != rhs.htlcIndex {return false} + if lhs.amtMsat != rhs.amtMsat {return false} + if lhs.acceptHeight != rhs.acceptHeight {return false} + if lhs.acceptTime != rhs.acceptTime {return false} + if lhs.resolveTime != rhs.resolveTime {return false} + if lhs.expiryHeight != rhs.expiryHeight {return false} + if lhs.state != rhs.state {return false} + if lhs.customRecords != rhs.customRecords {return false} + if lhs.mppTotalAmtMsat != rhs.mppTotalAmtMsat {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_AddInvoiceResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".AddInvoiceResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "r_hash"), + 2: .standard(proto: "payment_request"), + 16: .standard(proto: "add_index"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.rHash) + case 2: try decoder.decodeSingularStringField(value: &self.paymentRequest) + case 16: try decoder.decodeSingularUInt64Field(value: &self.addIndex) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.rHash.isEmpty { + try visitor.visitSingularBytesField(value: self.rHash, fieldNumber: 1) + } + if !self.paymentRequest.isEmpty { + try visitor.visitSingularStringField(value: self.paymentRequest, fieldNumber: 2) + } + if self.addIndex != 0 { + try visitor.visitSingularUInt64Field(value: self.addIndex, fieldNumber: 16) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_AddInvoiceResponse, rhs: Lnrpc_AddInvoiceResponse) -> Bool { + if lhs.rHash != rhs.rHash {return false} + if lhs.paymentRequest != rhs.paymentRequest {return false} + if lhs.addIndex != rhs.addIndex {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_PaymentHash: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".PaymentHash" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "r_hash_str"), + 2: .standard(proto: "r_hash"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.rHashStr) + case 2: try decoder.decodeSingularBytesField(value: &self.rHash) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.rHashStr.isEmpty { + try visitor.visitSingularStringField(value: self.rHashStr, fieldNumber: 1) + } + if !self.rHash.isEmpty { + try visitor.visitSingularBytesField(value: self.rHash, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_PaymentHash, rhs: Lnrpc_PaymentHash) -> Bool { + if lhs.rHashStr != rhs.rHashStr {return false} + if lhs.rHash != rhs.rHash {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ListInvoiceRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ListInvoiceRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "pending_only"), + 4: .standard(proto: "index_offset"), + 5: .standard(proto: "num_max_invoices"), + 6: .same(proto: "reversed"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBoolField(value: &self.pendingOnly) + case 4: try decoder.decodeSingularUInt64Field(value: &self.indexOffset) + case 5: try decoder.decodeSingularUInt64Field(value: &self.numMaxInvoices) + case 6: try decoder.decodeSingularBoolField(value: &self.reversed) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.pendingOnly != false { + try visitor.visitSingularBoolField(value: self.pendingOnly, fieldNumber: 1) + } + if self.indexOffset != 0 { + try visitor.visitSingularUInt64Field(value: self.indexOffset, fieldNumber: 4) + } + if self.numMaxInvoices != 0 { + try visitor.visitSingularUInt64Field(value: self.numMaxInvoices, fieldNumber: 5) + } + if self.reversed != false { + try visitor.visitSingularBoolField(value: self.reversed, fieldNumber: 6) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ListInvoiceRequest, rhs: Lnrpc_ListInvoiceRequest) -> Bool { + if lhs.pendingOnly != rhs.pendingOnly {return false} + if lhs.indexOffset != rhs.indexOffset {return false} + if lhs.numMaxInvoices != rhs.numMaxInvoices {return false} + if lhs.reversed != rhs.reversed {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ListInvoiceResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ListInvoiceResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "invoices"), + 2: .standard(proto: "last_index_offset"), + 3: .standard(proto: "first_index_offset"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedMessageField(value: &self.invoices) + case 2: try decoder.decodeSingularUInt64Field(value: &self.lastIndexOffset) + case 3: try decoder.decodeSingularUInt64Field(value: &self.firstIndexOffset) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.invoices.isEmpty { + try visitor.visitRepeatedMessageField(value: self.invoices, fieldNumber: 1) + } + if self.lastIndexOffset != 0 { + try visitor.visitSingularUInt64Field(value: self.lastIndexOffset, fieldNumber: 2) + } + if self.firstIndexOffset != 0 { + try visitor.visitSingularUInt64Field(value: self.firstIndexOffset, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ListInvoiceResponse, rhs: Lnrpc_ListInvoiceResponse) -> Bool { + if lhs.invoices != rhs.invoices {return false} + if lhs.lastIndexOffset != rhs.lastIndexOffset {return false} + if lhs.firstIndexOffset != rhs.firstIndexOffset {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_InvoiceSubscription: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".InvoiceSubscription" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "add_index"), + 2: .standard(proto: "settle_index"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt64Field(value: &self.addIndex) + case 2: try decoder.decodeSingularUInt64Field(value: &self.settleIndex) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.addIndex != 0 { + try visitor.visitSingularUInt64Field(value: self.addIndex, fieldNumber: 1) + } + if self.settleIndex != 0 { + try visitor.visitSingularUInt64Field(value: self.settleIndex, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_InvoiceSubscription, rhs: Lnrpc_InvoiceSubscription) -> Bool { + if lhs.addIndex != rhs.addIndex {return false} + if lhs.settleIndex != rhs.settleIndex {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_Payment: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Payment" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "payment_hash"), + 2: .same(proto: "value"), + 3: .standard(proto: "creation_date"), + 5: .same(proto: "fee"), + 6: .standard(proto: "payment_preimage"), + 7: .standard(proto: "value_sat"), + 8: .standard(proto: "value_msat"), + 9: .standard(proto: "payment_request"), + 10: .same(proto: "status"), + 11: .standard(proto: "fee_sat"), + 12: .standard(proto: "fee_msat"), + 13: .standard(proto: "creation_time_ns"), + 14: .same(proto: "htlcs"), + 15: .standard(proto: "payment_index"), + 16: .standard(proto: "failure_reason"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.paymentHash) + case 2: try decoder.decodeSingularInt64Field(value: &self.value) + case 3: try decoder.decodeSingularInt64Field(value: &self.creationDate) + case 5: try decoder.decodeSingularInt64Field(value: &self.fee) + case 6: try decoder.decodeSingularStringField(value: &self.paymentPreimage) + case 7: try decoder.decodeSingularInt64Field(value: &self.valueSat) + case 8: try decoder.decodeSingularInt64Field(value: &self.valueMsat) + case 9: try decoder.decodeSingularStringField(value: &self.paymentRequest) + case 10: try decoder.decodeSingularEnumField(value: &self.status) + case 11: try decoder.decodeSingularInt64Field(value: &self.feeSat) + case 12: try decoder.decodeSingularInt64Field(value: &self.feeMsat) + case 13: try decoder.decodeSingularInt64Field(value: &self.creationTimeNs) + case 14: try decoder.decodeRepeatedMessageField(value: &self.htlcs) + case 15: try decoder.decodeSingularUInt64Field(value: &self.paymentIndex) + case 16: try decoder.decodeSingularEnumField(value: &self.failureReason) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.paymentHash.isEmpty { + try visitor.visitSingularStringField(value: self.paymentHash, fieldNumber: 1) + } + if self.value != 0 { + try visitor.visitSingularInt64Field(value: self.value, fieldNumber: 2) + } + if self.creationDate != 0 { + try visitor.visitSingularInt64Field(value: self.creationDate, fieldNumber: 3) + } + if self.fee != 0 { + try visitor.visitSingularInt64Field(value: self.fee, fieldNumber: 5) + } + if !self.paymentPreimage.isEmpty { + try visitor.visitSingularStringField(value: self.paymentPreimage, fieldNumber: 6) + } + if self.valueSat != 0 { + try visitor.visitSingularInt64Field(value: self.valueSat, fieldNumber: 7) + } + if self.valueMsat != 0 { + try visitor.visitSingularInt64Field(value: self.valueMsat, fieldNumber: 8) + } + if !self.paymentRequest.isEmpty { + try visitor.visitSingularStringField(value: self.paymentRequest, fieldNumber: 9) + } + if self.status != .unknown { + try visitor.visitSingularEnumField(value: self.status, fieldNumber: 10) + } + if self.feeSat != 0 { + try visitor.visitSingularInt64Field(value: self.feeSat, fieldNumber: 11) + } + if self.feeMsat != 0 { + try visitor.visitSingularInt64Field(value: self.feeMsat, fieldNumber: 12) + } + if self.creationTimeNs != 0 { + try visitor.visitSingularInt64Field(value: self.creationTimeNs, fieldNumber: 13) + } + if !self.htlcs.isEmpty { + try visitor.visitRepeatedMessageField(value: self.htlcs, fieldNumber: 14) + } + if self.paymentIndex != 0 { + try visitor.visitSingularUInt64Field(value: self.paymentIndex, fieldNumber: 15) + } + if self.failureReason != .failureReasonNone { + try visitor.visitSingularEnumField(value: self.failureReason, fieldNumber: 16) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_Payment, rhs: Lnrpc_Payment) -> Bool { + if lhs.paymentHash != rhs.paymentHash {return false} + if lhs.value != rhs.value {return false} + if lhs.creationDate != rhs.creationDate {return false} + if lhs.fee != rhs.fee {return false} + if lhs.paymentPreimage != rhs.paymentPreimage {return false} + if lhs.valueSat != rhs.valueSat {return false} + if lhs.valueMsat != rhs.valueMsat {return false} + if lhs.paymentRequest != rhs.paymentRequest {return false} + if lhs.status != rhs.status {return false} + if lhs.feeSat != rhs.feeSat {return false} + if lhs.feeMsat != rhs.feeMsat {return false} + if lhs.creationTimeNs != rhs.creationTimeNs {return false} + if lhs.htlcs != rhs.htlcs {return false} + if lhs.paymentIndex != rhs.paymentIndex {return false} + if lhs.failureReason != rhs.failureReason {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_Payment.PaymentStatus: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN"), + 1: .same(proto: "IN_FLIGHT"), + 2: .same(proto: "SUCCEEDED"), + 3: .same(proto: "FAILED"), + ] +} + +extension Lnrpc_HTLCAttempt: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".HTLCAttempt" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "status"), + 2: .same(proto: "route"), + 3: .standard(proto: "attempt_time_ns"), + 4: .standard(proto: "resolve_time_ns"), + 5: .same(proto: "failure"), + 6: .same(proto: "preimage"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularEnumField(value: &self.status) + case 2: try decoder.decodeSingularMessageField(value: &self._route) + case 3: try decoder.decodeSingularInt64Field(value: &self.attemptTimeNs) + case 4: try decoder.decodeSingularInt64Field(value: &self.resolveTimeNs) + case 5: try decoder.decodeSingularMessageField(value: &self._failure) + case 6: try decoder.decodeSingularBytesField(value: &self.preimage) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.status != .inFlight { + try visitor.visitSingularEnumField(value: self.status, fieldNumber: 1) + } + if let v = self._route { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } + if self.attemptTimeNs != 0 { + try visitor.visitSingularInt64Field(value: self.attemptTimeNs, fieldNumber: 3) + } + if self.resolveTimeNs != 0 { + try visitor.visitSingularInt64Field(value: self.resolveTimeNs, fieldNumber: 4) + } + if let v = self._failure { + try visitor.visitSingularMessageField(value: v, fieldNumber: 5) + } + if !self.preimage.isEmpty { + try visitor.visitSingularBytesField(value: self.preimage, fieldNumber: 6) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_HTLCAttempt, rhs: Lnrpc_HTLCAttempt) -> Bool { + if lhs.status != rhs.status {return false} + if lhs._route != rhs._route {return false} + if lhs.attemptTimeNs != rhs.attemptTimeNs {return false} + if lhs.resolveTimeNs != rhs.resolveTimeNs {return false} + if lhs._failure != rhs._failure {return false} + if lhs.preimage != rhs.preimage {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_HTLCAttempt.HTLCStatus: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "IN_FLIGHT"), + 1: .same(proto: "SUCCEEDED"), + 2: .same(proto: "FAILED"), + ] +} + +extension Lnrpc_ListPaymentsRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ListPaymentsRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "include_incomplete"), + 2: .standard(proto: "index_offset"), + 3: .standard(proto: "max_payments"), + 4: .same(proto: "reversed"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBoolField(value: &self.includeIncomplete) + case 2: try decoder.decodeSingularUInt64Field(value: &self.indexOffset) + case 3: try decoder.decodeSingularUInt64Field(value: &self.maxPayments) + case 4: try decoder.decodeSingularBoolField(value: &self.reversed) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.includeIncomplete != false { + try visitor.visitSingularBoolField(value: self.includeIncomplete, fieldNumber: 1) + } + if self.indexOffset != 0 { + try visitor.visitSingularUInt64Field(value: self.indexOffset, fieldNumber: 2) + } + if self.maxPayments != 0 { + try visitor.visitSingularUInt64Field(value: self.maxPayments, fieldNumber: 3) + } + if self.reversed != false { + try visitor.visitSingularBoolField(value: self.reversed, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ListPaymentsRequest, rhs: Lnrpc_ListPaymentsRequest) -> Bool { + if lhs.includeIncomplete != rhs.includeIncomplete {return false} + if lhs.indexOffset != rhs.indexOffset {return false} + if lhs.maxPayments != rhs.maxPayments {return false} + if lhs.reversed != rhs.reversed {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ListPaymentsResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ListPaymentsResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "payments"), + 2: .standard(proto: "first_index_offset"), + 3: .standard(proto: "last_index_offset"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedMessageField(value: &self.payments) + case 2: try decoder.decodeSingularUInt64Field(value: &self.firstIndexOffset) + case 3: try decoder.decodeSingularUInt64Field(value: &self.lastIndexOffset) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.payments.isEmpty { + try visitor.visitRepeatedMessageField(value: self.payments, fieldNumber: 1) + } + if self.firstIndexOffset != 0 { + try visitor.visitSingularUInt64Field(value: self.firstIndexOffset, fieldNumber: 2) + } + if self.lastIndexOffset != 0 { + try visitor.visitSingularUInt64Field(value: self.lastIndexOffset, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ListPaymentsResponse, rhs: Lnrpc_ListPaymentsResponse) -> Bool { + if lhs.payments != rhs.payments {return false} + if lhs.firstIndexOffset != rhs.firstIndexOffset {return false} + if lhs.lastIndexOffset != rhs.lastIndexOffset {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_DeleteAllPaymentsRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".DeleteAllPaymentsRequest" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_DeleteAllPaymentsRequest, rhs: Lnrpc_DeleteAllPaymentsRequest) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_DeleteAllPaymentsResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".DeleteAllPaymentsResponse" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_DeleteAllPaymentsResponse, rhs: Lnrpc_DeleteAllPaymentsResponse) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_AbandonChannelRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".AbandonChannelRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "channel_point"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &self._channelPoint) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._channelPoint { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_AbandonChannelRequest, rhs: Lnrpc_AbandonChannelRequest) -> Bool { + if lhs._channelPoint != rhs._channelPoint {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_AbandonChannelResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".AbandonChannelResponse" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_AbandonChannelResponse, rhs: Lnrpc_AbandonChannelResponse) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_DebugLevelRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".DebugLevelRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "show"), + 2: .standard(proto: "level_spec"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBoolField(value: &self.show) + case 2: try decoder.decodeSingularStringField(value: &self.levelSpec) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.show != false { + try visitor.visitSingularBoolField(value: self.show, fieldNumber: 1) + } + if !self.levelSpec.isEmpty { + try visitor.visitSingularStringField(value: self.levelSpec, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_DebugLevelRequest, rhs: Lnrpc_DebugLevelRequest) -> Bool { + if lhs.show != rhs.show {return false} + if lhs.levelSpec != rhs.levelSpec {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_DebugLevelResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".DebugLevelResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "sub_systems"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.subSystems) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.subSystems.isEmpty { + try visitor.visitSingularStringField(value: self.subSystems, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_DebugLevelResponse, rhs: Lnrpc_DebugLevelResponse) -> Bool { + if lhs.subSystems != rhs.subSystems {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_PayReqString: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".PayReqString" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "pay_req"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.payReq) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.payReq.isEmpty { + try visitor.visitSingularStringField(value: self.payReq, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_PayReqString, rhs: Lnrpc_PayReqString) -> Bool { + if lhs.payReq != rhs.payReq {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_PayReq: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".PayReq" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "destination"), + 2: .standard(proto: "payment_hash"), + 3: .standard(proto: "num_satoshis"), + 4: .same(proto: "timestamp"), + 5: .same(proto: "expiry"), + 6: .same(proto: "description"), + 7: .standard(proto: "description_hash"), + 8: .standard(proto: "fallback_addr"), + 9: .standard(proto: "cltv_expiry"), + 10: .standard(proto: "route_hints"), + 11: .standard(proto: "payment_addr"), + 12: .standard(proto: "num_msat"), + 13: .same(proto: "features"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.destination) + case 2: try decoder.decodeSingularStringField(value: &self.paymentHash) + case 3: try decoder.decodeSingularInt64Field(value: &self.numSatoshis) + case 4: try decoder.decodeSingularInt64Field(value: &self.timestamp) + case 5: try decoder.decodeSingularInt64Field(value: &self.expiry) + case 6: try decoder.decodeSingularStringField(value: &self.description_p) + case 7: try decoder.decodeSingularStringField(value: &self.descriptionHash) + case 8: try decoder.decodeSingularStringField(value: &self.fallbackAddr) + case 9: try decoder.decodeSingularInt64Field(value: &self.cltvExpiry) + case 10: try decoder.decodeRepeatedMessageField(value: &self.routeHints) + case 11: try decoder.decodeSingularBytesField(value: &self.paymentAddr) + case 12: try decoder.decodeSingularInt64Field(value: &self.numMsat) + case 13: try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap.self, value: &self.features) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.destination.isEmpty { + try visitor.visitSingularStringField(value: self.destination, fieldNumber: 1) + } + if !self.paymentHash.isEmpty { + try visitor.visitSingularStringField(value: self.paymentHash, fieldNumber: 2) + } + if self.numSatoshis != 0 { + try visitor.visitSingularInt64Field(value: self.numSatoshis, fieldNumber: 3) + } + if self.timestamp != 0 { + try visitor.visitSingularInt64Field(value: self.timestamp, fieldNumber: 4) + } + if self.expiry != 0 { + try visitor.visitSingularInt64Field(value: self.expiry, fieldNumber: 5) + } + if !self.description_p.isEmpty { + try visitor.visitSingularStringField(value: self.description_p, fieldNumber: 6) + } + if !self.descriptionHash.isEmpty { + try visitor.visitSingularStringField(value: self.descriptionHash, fieldNumber: 7) + } + if !self.fallbackAddr.isEmpty { + try visitor.visitSingularStringField(value: self.fallbackAddr, fieldNumber: 8) + } + if self.cltvExpiry != 0 { + try visitor.visitSingularInt64Field(value: self.cltvExpiry, fieldNumber: 9) + } + if !self.routeHints.isEmpty { + try visitor.visitRepeatedMessageField(value: self.routeHints, fieldNumber: 10) + } + if !self.paymentAddr.isEmpty { + try visitor.visitSingularBytesField(value: self.paymentAddr, fieldNumber: 11) + } + if self.numMsat != 0 { + try visitor.visitSingularInt64Field(value: self.numMsat, fieldNumber: 12) + } + if !self.features.isEmpty { + try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap.self, value: self.features, fieldNumber: 13) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_PayReq, rhs: Lnrpc_PayReq) -> Bool { + if lhs.destination != rhs.destination {return false} + if lhs.paymentHash != rhs.paymentHash {return false} + if lhs.numSatoshis != rhs.numSatoshis {return false} + if lhs.timestamp != rhs.timestamp {return false} + if lhs.expiry != rhs.expiry {return false} + if lhs.description_p != rhs.description_p {return false} + if lhs.descriptionHash != rhs.descriptionHash {return false} + if lhs.fallbackAddr != rhs.fallbackAddr {return false} + if lhs.cltvExpiry != rhs.cltvExpiry {return false} + if lhs.routeHints != rhs.routeHints {return false} + if lhs.paymentAddr != rhs.paymentAddr {return false} + if lhs.numMsat != rhs.numMsat {return false} + if lhs.features != rhs.features {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_Feature: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Feature" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 2: .same(proto: "name"), + 3: .standard(proto: "is_required"), + 4: .standard(proto: "is_known"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 2: try decoder.decodeSingularStringField(value: &self.name) + case 3: try decoder.decodeSingularBoolField(value: &self.isRequired) + case 4: try decoder.decodeSingularBoolField(value: &self.isKnown) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.name.isEmpty { + try visitor.visitSingularStringField(value: self.name, fieldNumber: 2) + } + if self.isRequired != false { + try visitor.visitSingularBoolField(value: self.isRequired, fieldNumber: 3) + } + if self.isKnown != false { + try visitor.visitSingularBoolField(value: self.isKnown, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_Feature, rhs: Lnrpc_Feature) -> Bool { + if lhs.name != rhs.name {return false} + if lhs.isRequired != rhs.isRequired {return false} + if lhs.isKnown != rhs.isKnown {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_FeeReportRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".FeeReportRequest" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_FeeReportRequest, rhs: Lnrpc_FeeReportRequest) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ChannelFeeReport: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ChannelFeeReport" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 5: .standard(proto: "chan_id"), + 1: .standard(proto: "channel_point"), + 2: .standard(proto: "base_fee_msat"), + 3: .standard(proto: "fee_per_mil"), + 4: .standard(proto: "fee_rate"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.channelPoint) + case 2: try decoder.decodeSingularInt64Field(value: &self.baseFeeMsat) + case 3: try decoder.decodeSingularInt64Field(value: &self.feePerMil) + case 4: try decoder.decodeSingularDoubleField(value: &self.feeRate) + case 5: try decoder.decodeSingularUInt64Field(value: &self.chanID) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.channelPoint.isEmpty { + try visitor.visitSingularStringField(value: self.channelPoint, fieldNumber: 1) + } + if self.baseFeeMsat != 0 { + try visitor.visitSingularInt64Field(value: self.baseFeeMsat, fieldNumber: 2) + } + if self.feePerMil != 0 { + try visitor.visitSingularInt64Field(value: self.feePerMil, fieldNumber: 3) + } + if self.feeRate != 0 { + try visitor.visitSingularDoubleField(value: self.feeRate, fieldNumber: 4) + } + if self.chanID != 0 { + try visitor.visitSingularUInt64Field(value: self.chanID, fieldNumber: 5) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ChannelFeeReport, rhs: Lnrpc_ChannelFeeReport) -> Bool { + if lhs.chanID != rhs.chanID {return false} + if lhs.channelPoint != rhs.channelPoint {return false} + if lhs.baseFeeMsat != rhs.baseFeeMsat {return false} + if lhs.feePerMil != rhs.feePerMil {return false} + if lhs.feeRate != rhs.feeRate {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_FeeReportResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".FeeReportResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "channel_fees"), + 2: .standard(proto: "day_fee_sum"), + 3: .standard(proto: "week_fee_sum"), + 4: .standard(proto: "month_fee_sum"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedMessageField(value: &self.channelFees) + case 2: try decoder.decodeSingularUInt64Field(value: &self.dayFeeSum) + case 3: try decoder.decodeSingularUInt64Field(value: &self.weekFeeSum) + case 4: try decoder.decodeSingularUInt64Field(value: &self.monthFeeSum) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.channelFees.isEmpty { + try visitor.visitRepeatedMessageField(value: self.channelFees, fieldNumber: 1) + } + if self.dayFeeSum != 0 { + try visitor.visitSingularUInt64Field(value: self.dayFeeSum, fieldNumber: 2) + } + if self.weekFeeSum != 0 { + try visitor.visitSingularUInt64Field(value: self.weekFeeSum, fieldNumber: 3) + } + if self.monthFeeSum != 0 { + try visitor.visitSingularUInt64Field(value: self.monthFeeSum, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_FeeReportResponse, rhs: Lnrpc_FeeReportResponse) -> Bool { + if lhs.channelFees != rhs.channelFees {return false} + if lhs.dayFeeSum != rhs.dayFeeSum {return false} + if lhs.weekFeeSum != rhs.weekFeeSum {return false} + if lhs.monthFeeSum != rhs.monthFeeSum {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_PolicyUpdateRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".PolicyUpdateRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "global"), + 2: .standard(proto: "chan_point"), + 3: .standard(proto: "base_fee_msat"), + 4: .standard(proto: "fee_rate"), + 5: .standard(proto: "time_lock_delta"), + 6: .standard(proto: "max_htlc_msat"), + 7: .standard(proto: "min_htlc_msat"), + 8: .standard(proto: "min_htlc_msat_specified"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: + if self.scope != nil {try decoder.handleConflictingOneOf()} + var v: Bool? + try decoder.decodeSingularBoolField(value: &v) + if let v = v {self.scope = .global(v)} + case 2: + var v: Lnrpc_ChannelPoint? + if let current = self.scope { + try decoder.handleConflictingOneOf() + if case .chanPoint(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {self.scope = .chanPoint(v)} + case 3: try decoder.decodeSingularInt64Field(value: &self.baseFeeMsat) + case 4: try decoder.decodeSingularDoubleField(value: &self.feeRate) + case 5: try decoder.decodeSingularUInt32Field(value: &self.timeLockDelta) + case 6: try decoder.decodeSingularUInt64Field(value: &self.maxHtlcMsat) + case 7: try decoder.decodeSingularUInt64Field(value: &self.minHtlcMsat) + case 8: try decoder.decodeSingularBoolField(value: &self.minHtlcMsatSpecified) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + switch self.scope { + case .global(let v)?: + try visitor.visitSingularBoolField(value: v, fieldNumber: 1) + case .chanPoint(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + case nil: break + } + if self.baseFeeMsat != 0 { + try visitor.visitSingularInt64Field(value: self.baseFeeMsat, fieldNumber: 3) + } + if self.feeRate != 0 { + try visitor.visitSingularDoubleField(value: self.feeRate, fieldNumber: 4) + } + if self.timeLockDelta != 0 { + try visitor.visitSingularUInt32Field(value: self.timeLockDelta, fieldNumber: 5) + } + if self.maxHtlcMsat != 0 { + try visitor.visitSingularUInt64Field(value: self.maxHtlcMsat, fieldNumber: 6) + } + if self.minHtlcMsat != 0 { + try visitor.visitSingularUInt64Field(value: self.minHtlcMsat, fieldNumber: 7) + } + if self.minHtlcMsatSpecified != false { + try visitor.visitSingularBoolField(value: self.minHtlcMsatSpecified, fieldNumber: 8) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_PolicyUpdateRequest, rhs: Lnrpc_PolicyUpdateRequest) -> Bool { + if lhs.scope != rhs.scope {return false} + if lhs.baseFeeMsat != rhs.baseFeeMsat {return false} + if lhs.feeRate != rhs.feeRate {return false} + if lhs.timeLockDelta != rhs.timeLockDelta {return false} + if lhs.maxHtlcMsat != rhs.maxHtlcMsat {return false} + if lhs.minHtlcMsat != rhs.minHtlcMsat {return false} + if lhs.minHtlcMsatSpecified != rhs.minHtlcMsatSpecified {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_PolicyUpdateResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".PolicyUpdateResponse" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_PolicyUpdateResponse, rhs: Lnrpc_PolicyUpdateResponse) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ForwardingHistoryRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ForwardingHistoryRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "start_time"), + 2: .standard(proto: "end_time"), + 3: .standard(proto: "index_offset"), + 4: .standard(proto: "num_max_events"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt64Field(value: &self.startTime) + case 2: try decoder.decodeSingularUInt64Field(value: &self.endTime) + case 3: try decoder.decodeSingularUInt32Field(value: &self.indexOffset) + case 4: try decoder.decodeSingularUInt32Field(value: &self.numMaxEvents) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.startTime != 0 { + try visitor.visitSingularUInt64Field(value: self.startTime, fieldNumber: 1) + } + if self.endTime != 0 { + try visitor.visitSingularUInt64Field(value: self.endTime, fieldNumber: 2) + } + if self.indexOffset != 0 { + try visitor.visitSingularUInt32Field(value: self.indexOffset, fieldNumber: 3) + } + if self.numMaxEvents != 0 { + try visitor.visitSingularUInt32Field(value: self.numMaxEvents, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ForwardingHistoryRequest, rhs: Lnrpc_ForwardingHistoryRequest) -> Bool { + if lhs.startTime != rhs.startTime {return false} + if lhs.endTime != rhs.endTime {return false} + if lhs.indexOffset != rhs.indexOffset {return false} + if lhs.numMaxEvents != rhs.numMaxEvents {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ForwardingEvent: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ForwardingEvent" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "timestamp"), + 2: .standard(proto: "chan_id_in"), + 4: .standard(proto: "chan_id_out"), + 5: .standard(proto: "amt_in"), + 6: .standard(proto: "amt_out"), + 7: .same(proto: "fee"), + 8: .standard(proto: "fee_msat"), + 9: .standard(proto: "amt_in_msat"), + 10: .standard(proto: "amt_out_msat"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt64Field(value: &self.timestamp) + case 2: try decoder.decodeSingularUInt64Field(value: &self.chanIDIn) + case 4: try decoder.decodeSingularUInt64Field(value: &self.chanIDOut) + case 5: try decoder.decodeSingularUInt64Field(value: &self.amtIn) + case 6: try decoder.decodeSingularUInt64Field(value: &self.amtOut) + case 7: try decoder.decodeSingularUInt64Field(value: &self.fee) + case 8: try decoder.decodeSingularUInt64Field(value: &self.feeMsat) + case 9: try decoder.decodeSingularUInt64Field(value: &self.amtInMsat) + case 10: try decoder.decodeSingularUInt64Field(value: &self.amtOutMsat) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.timestamp != 0 { + try visitor.visitSingularUInt64Field(value: self.timestamp, fieldNumber: 1) + } + if self.chanIDIn != 0 { + try visitor.visitSingularUInt64Field(value: self.chanIDIn, fieldNumber: 2) + } + if self.chanIDOut != 0 { + try visitor.visitSingularUInt64Field(value: self.chanIDOut, fieldNumber: 4) + } + if self.amtIn != 0 { + try visitor.visitSingularUInt64Field(value: self.amtIn, fieldNumber: 5) + } + if self.amtOut != 0 { + try visitor.visitSingularUInt64Field(value: self.amtOut, fieldNumber: 6) + } + if self.fee != 0 { + try visitor.visitSingularUInt64Field(value: self.fee, fieldNumber: 7) + } + if self.feeMsat != 0 { + try visitor.visitSingularUInt64Field(value: self.feeMsat, fieldNumber: 8) + } + if self.amtInMsat != 0 { + try visitor.visitSingularUInt64Field(value: self.amtInMsat, fieldNumber: 9) + } + if self.amtOutMsat != 0 { + try visitor.visitSingularUInt64Field(value: self.amtOutMsat, fieldNumber: 10) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ForwardingEvent, rhs: Lnrpc_ForwardingEvent) -> Bool { + if lhs.timestamp != rhs.timestamp {return false} + if lhs.chanIDIn != rhs.chanIDIn {return false} + if lhs.chanIDOut != rhs.chanIDOut {return false} + if lhs.amtIn != rhs.amtIn {return false} + if lhs.amtOut != rhs.amtOut {return false} + if lhs.fee != rhs.fee {return false} + if lhs.feeMsat != rhs.feeMsat {return false} + if lhs.amtInMsat != rhs.amtInMsat {return false} + if lhs.amtOutMsat != rhs.amtOutMsat {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ForwardingHistoryResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ForwardingHistoryResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "forwarding_events"), + 2: .standard(proto: "last_offset_index"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedMessageField(value: &self.forwardingEvents) + case 2: try decoder.decodeSingularUInt32Field(value: &self.lastOffsetIndex) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.forwardingEvents.isEmpty { + try visitor.visitRepeatedMessageField(value: self.forwardingEvents, fieldNumber: 1) + } + if self.lastOffsetIndex != 0 { + try visitor.visitSingularUInt32Field(value: self.lastOffsetIndex, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ForwardingHistoryResponse, rhs: Lnrpc_ForwardingHistoryResponse) -> Bool { + if lhs.forwardingEvents != rhs.forwardingEvents {return false} + if lhs.lastOffsetIndex != rhs.lastOffsetIndex {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ExportChannelBackupRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ExportChannelBackupRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "chan_point"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &self._chanPoint) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._chanPoint { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ExportChannelBackupRequest, rhs: Lnrpc_ExportChannelBackupRequest) -> Bool { + if lhs._chanPoint != rhs._chanPoint {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ChannelBackup: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ChannelBackup" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "chan_point"), + 2: .standard(proto: "chan_backup"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &self._chanPoint) + case 2: try decoder.decodeSingularBytesField(value: &self.chanBackup) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._chanPoint { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + if !self.chanBackup.isEmpty { + try visitor.visitSingularBytesField(value: self.chanBackup, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ChannelBackup, rhs: Lnrpc_ChannelBackup) -> Bool { + if lhs._chanPoint != rhs._chanPoint {return false} + if lhs.chanBackup != rhs.chanBackup {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_MultiChanBackup: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".MultiChanBackup" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "chan_points"), + 2: .standard(proto: "multi_chan_backup"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedMessageField(value: &self.chanPoints) + case 2: try decoder.decodeSingularBytesField(value: &self.multiChanBackup) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.chanPoints.isEmpty { + try visitor.visitRepeatedMessageField(value: self.chanPoints, fieldNumber: 1) + } + if !self.multiChanBackup.isEmpty { + try visitor.visitSingularBytesField(value: self.multiChanBackup, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_MultiChanBackup, rhs: Lnrpc_MultiChanBackup) -> Bool { + if lhs.chanPoints != rhs.chanPoints {return false} + if lhs.multiChanBackup != rhs.multiChanBackup {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ChanBackupExportRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ChanBackupExportRequest" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ChanBackupExportRequest, rhs: Lnrpc_ChanBackupExportRequest) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ChanBackupSnapshot: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ChanBackupSnapshot" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "single_chan_backups"), + 2: .standard(proto: "multi_chan_backup"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &self._singleChanBackups) + case 2: try decoder.decodeSingularMessageField(value: &self._multiChanBackup) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._singleChanBackups { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + if let v = self._multiChanBackup { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ChanBackupSnapshot, rhs: Lnrpc_ChanBackupSnapshot) -> Bool { + if lhs._singleChanBackups != rhs._singleChanBackups {return false} + if lhs._multiChanBackup != rhs._multiChanBackup {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ChannelBackups: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ChannelBackups" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "chan_backups"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedMessageField(value: &self.chanBackups) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.chanBackups.isEmpty { + try visitor.visitRepeatedMessageField(value: self.chanBackups, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ChannelBackups, rhs: Lnrpc_ChannelBackups) -> Bool { + if lhs.chanBackups != rhs.chanBackups {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_RestoreChanBackupRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".RestoreChanBackupRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "chan_backups"), + 2: .standard(proto: "multi_chan_backup"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: + var v: Lnrpc_ChannelBackups? + if let current = self.backup { + try decoder.handleConflictingOneOf() + if case .chanBackups(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {self.backup = .chanBackups(v)} + case 2: + if self.backup != nil {try decoder.handleConflictingOneOf()} + var v: Data? + try decoder.decodeSingularBytesField(value: &v) + if let v = v {self.backup = .multiChanBackup(v)} + default: break + } + } + } + + func traverse(visitor: inout V) throws { + switch self.backup { + case .chanBackups(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + case .multiChanBackup(let v)?: + try visitor.visitSingularBytesField(value: v, fieldNumber: 2) + case nil: break + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_RestoreChanBackupRequest, rhs: Lnrpc_RestoreChanBackupRequest) -> Bool { + if lhs.backup != rhs.backup {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_RestoreBackupResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".RestoreBackupResponse" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_RestoreBackupResponse, rhs: Lnrpc_RestoreBackupResponse) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ChannelBackupSubscription: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ChannelBackupSubscription" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ChannelBackupSubscription, rhs: Lnrpc_ChannelBackupSubscription) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_VerifyChanBackupResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".VerifyChanBackupResponse" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_VerifyChanBackupResponse, rhs: Lnrpc_VerifyChanBackupResponse) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_MacaroonPermission: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".MacaroonPermission" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "entity"), + 2: .same(proto: "action"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.entity) + case 2: try decoder.decodeSingularStringField(value: &self.action) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.entity.isEmpty { + try visitor.visitSingularStringField(value: self.entity, fieldNumber: 1) + } + if !self.action.isEmpty { + try visitor.visitSingularStringField(value: self.action, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_MacaroonPermission, rhs: Lnrpc_MacaroonPermission) -> Bool { + if lhs.entity != rhs.entity {return false} + if lhs.action != rhs.action {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_BakeMacaroonRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".BakeMacaroonRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "permissions"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedMessageField(value: &self.permissions) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.permissions.isEmpty { + try visitor.visitRepeatedMessageField(value: self.permissions, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_BakeMacaroonRequest, rhs: Lnrpc_BakeMacaroonRequest) -> Bool { + if lhs.permissions != rhs.permissions {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_BakeMacaroonResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".BakeMacaroonResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "macaroon"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.macaroon) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.macaroon.isEmpty { + try visitor.visitSingularStringField(value: self.macaroon, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_BakeMacaroonResponse, rhs: Lnrpc_BakeMacaroonResponse) -> Bool { + if lhs.macaroon != rhs.macaroon {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_Failure: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Failure" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "code"), + 3: .standard(proto: "channel_update"), + 4: .standard(proto: "htlc_msat"), + 5: .standard(proto: "onion_sha_256"), + 6: .standard(proto: "cltv_expiry"), + 7: .same(proto: "flags"), + 8: .standard(proto: "failure_source_index"), + 9: .same(proto: "height"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularEnumField(value: &self.code) + case 3: try decoder.decodeSingularMessageField(value: &self._channelUpdate) + case 4: try decoder.decodeSingularUInt64Field(value: &self.htlcMsat) + case 5: try decoder.decodeSingularBytesField(value: &self.onionSha256) + case 6: try decoder.decodeSingularUInt32Field(value: &self.cltvExpiry) + case 7: try decoder.decodeSingularUInt32Field(value: &self.flags) + case 8: try decoder.decodeSingularUInt32Field(value: &self.failureSourceIndex) + case 9: try decoder.decodeSingularUInt32Field(value: &self.height) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.code != .reserved { + try visitor.visitSingularEnumField(value: self.code, fieldNumber: 1) + } + if let v = self._channelUpdate { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } + if self.htlcMsat != 0 { + try visitor.visitSingularUInt64Field(value: self.htlcMsat, fieldNumber: 4) + } + if !self.onionSha256.isEmpty { + try visitor.visitSingularBytesField(value: self.onionSha256, fieldNumber: 5) + } + if self.cltvExpiry != 0 { + try visitor.visitSingularUInt32Field(value: self.cltvExpiry, fieldNumber: 6) + } + if self.flags != 0 { + try visitor.visitSingularUInt32Field(value: self.flags, fieldNumber: 7) + } + if self.failureSourceIndex != 0 { + try visitor.visitSingularUInt32Field(value: self.failureSourceIndex, fieldNumber: 8) + } + if self.height != 0 { + try visitor.visitSingularUInt32Field(value: self.height, fieldNumber: 9) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_Failure, rhs: Lnrpc_Failure) -> Bool { + if lhs.code != rhs.code {return false} + if lhs._channelUpdate != rhs._channelUpdate {return false} + if lhs.htlcMsat != rhs.htlcMsat {return false} + if lhs.onionSha256 != rhs.onionSha256 {return false} + if lhs.cltvExpiry != rhs.cltvExpiry {return false} + if lhs.flags != rhs.flags {return false} + if lhs.failureSourceIndex != rhs.failureSourceIndex {return false} + if lhs.height != rhs.height {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_Failure.FailureCode: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "RESERVED"), + 1: .same(proto: "INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS"), + 2: .same(proto: "INCORRECT_PAYMENT_AMOUNT"), + 3: .same(proto: "FINAL_INCORRECT_CLTV_EXPIRY"), + 4: .same(proto: "FINAL_INCORRECT_HTLC_AMOUNT"), + 5: .same(proto: "FINAL_EXPIRY_TOO_SOON"), + 6: .same(proto: "INVALID_REALM"), + 7: .same(proto: "EXPIRY_TOO_SOON"), + 8: .same(proto: "INVALID_ONION_VERSION"), + 9: .same(proto: "INVALID_ONION_HMAC"), + 10: .same(proto: "INVALID_ONION_KEY"), + 11: .same(proto: "AMOUNT_BELOW_MINIMUM"), + 12: .same(proto: "FEE_INSUFFICIENT"), + 13: .same(proto: "INCORRECT_CLTV_EXPIRY"), + 14: .same(proto: "CHANNEL_DISABLED"), + 15: .same(proto: "TEMPORARY_CHANNEL_FAILURE"), + 16: .same(proto: "REQUIRED_NODE_FEATURE_MISSING"), + 17: .same(proto: "REQUIRED_CHANNEL_FEATURE_MISSING"), + 18: .same(proto: "UNKNOWN_NEXT_PEER"), + 19: .same(proto: "TEMPORARY_NODE_FAILURE"), + 20: .same(proto: "PERMANENT_NODE_FAILURE"), + 21: .same(proto: "PERMANENT_CHANNEL_FAILURE"), + 22: .same(proto: "EXPIRY_TOO_FAR"), + 23: .same(proto: "MPP_TIMEOUT"), + 997: .same(proto: "INTERNAL_FAILURE"), + 998: .same(proto: "UNKNOWN_FAILURE"), + 999: .same(proto: "UNREADABLE_FAILURE"), + ] +} + +extension Lnrpc_ChannelUpdate: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ChannelUpdate" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "signature"), + 2: .standard(proto: "chain_hash"), + 3: .standard(proto: "chan_id"), + 4: .same(proto: "timestamp"), + 10: .standard(proto: "message_flags"), + 5: .standard(proto: "channel_flags"), + 6: .standard(proto: "time_lock_delta"), + 7: .standard(proto: "htlc_minimum_msat"), + 8: .standard(proto: "base_fee"), + 9: .standard(proto: "fee_rate"), + 11: .standard(proto: "htlc_maximum_msat"), + 12: .standard(proto: "extra_opaque_data"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.signature) + case 2: try decoder.decodeSingularBytesField(value: &self.chainHash) + case 3: try decoder.decodeSingularUInt64Field(value: &self.chanID) + case 4: try decoder.decodeSingularUInt32Field(value: &self.timestamp) + case 5: try decoder.decodeSingularUInt32Field(value: &self.channelFlags) + case 6: try decoder.decodeSingularUInt32Field(value: &self.timeLockDelta) + case 7: try decoder.decodeSingularUInt64Field(value: &self.htlcMinimumMsat) + case 8: try decoder.decodeSingularUInt32Field(value: &self.baseFee) + case 9: try decoder.decodeSingularUInt32Field(value: &self.feeRate) + case 10: try decoder.decodeSingularUInt32Field(value: &self.messageFlags) + case 11: try decoder.decodeSingularUInt64Field(value: &self.htlcMaximumMsat) + case 12: try decoder.decodeSingularBytesField(value: &self.extraOpaqueData) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.signature.isEmpty { + try visitor.visitSingularBytesField(value: self.signature, fieldNumber: 1) + } + if !self.chainHash.isEmpty { + try visitor.visitSingularBytesField(value: self.chainHash, fieldNumber: 2) + } + if self.chanID != 0 { + try visitor.visitSingularUInt64Field(value: self.chanID, fieldNumber: 3) + } + if self.timestamp != 0 { + try visitor.visitSingularUInt32Field(value: self.timestamp, fieldNumber: 4) + } + if self.channelFlags != 0 { + try visitor.visitSingularUInt32Field(value: self.channelFlags, fieldNumber: 5) + } + if self.timeLockDelta != 0 { + try visitor.visitSingularUInt32Field(value: self.timeLockDelta, fieldNumber: 6) + } + if self.htlcMinimumMsat != 0 { + try visitor.visitSingularUInt64Field(value: self.htlcMinimumMsat, fieldNumber: 7) + } + if self.baseFee != 0 { + try visitor.visitSingularUInt32Field(value: self.baseFee, fieldNumber: 8) + } + if self.feeRate != 0 { + try visitor.visitSingularUInt32Field(value: self.feeRate, fieldNumber: 9) + } + if self.messageFlags != 0 { + try visitor.visitSingularUInt32Field(value: self.messageFlags, fieldNumber: 10) + } + if self.htlcMaximumMsat != 0 { + try visitor.visitSingularUInt64Field(value: self.htlcMaximumMsat, fieldNumber: 11) + } + if !self.extraOpaqueData.isEmpty { + try visitor.visitSingularBytesField(value: self.extraOpaqueData, fieldNumber: 12) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ChannelUpdate, rhs: Lnrpc_ChannelUpdate) -> Bool { + if lhs.signature != rhs.signature {return false} + if lhs.chainHash != rhs.chainHash {return false} + if lhs.chanID != rhs.chanID {return false} + if lhs.timestamp != rhs.timestamp {return false} + if lhs.messageFlags != rhs.messageFlags {return false} + if lhs.channelFlags != rhs.channelFlags {return false} + if lhs.timeLockDelta != rhs.timeLockDelta {return false} + if lhs.htlcMinimumMsat != rhs.htlcMinimumMsat {return false} + if lhs.baseFee != rhs.baseFee {return false} + if lhs.feeRate != rhs.feeRate {return false} + if lhs.htlcMaximumMsat != rhs.htlcMaximumMsat {return false} + if lhs.extraOpaqueData != rhs.extraOpaqueData {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/wallet/Lightning/rpc/signrpc/signer.pb.swift b/wallet/Lightning/rpc/signrpc/signer.pb.swift new file mode 100644 index 0000000..f47a48d --- /dev/null +++ b/wallet/Lightning/rpc/signrpc/signer.pb.swift @@ -0,0 +1,833 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: signrpc/signer.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +import Foundation +import SwiftProtobuf + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +struct Signrpc_KeyLocator { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The family of key being identified. + var keyFamily: Int32 = 0 + + /// The precise index of the key being identified. + var keyIndex: Int32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Signrpc_KeyDescriptor { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The raw bytes of the key being identified. Either this or the KeyLocator + ///must be specified. + var rawKeyBytes: Data = SwiftProtobuf.Internal.emptyData + + /// + ///The key locator that identifies which key to use for signing. Either this + ///or the raw bytes of the target key must be specified. + var keyLoc: Signrpc_KeyLocator { + get {return _keyLoc ?? Signrpc_KeyLocator()} + set {_keyLoc = newValue} + } + /// Returns true if `keyLoc` has been explicitly set. + var hasKeyLoc: Bool {return self._keyLoc != nil} + /// Clears the value of `keyLoc`. Subsequent reads from it will return its default value. + mutating func clearKeyLoc() {self._keyLoc = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _keyLoc: Signrpc_KeyLocator? = nil +} + +struct Signrpc_TxOut { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The value of the output being spent. + var value: Int64 = 0 + + /// The script of the output being spent. + var pkScript: Data = SwiftProtobuf.Internal.emptyData + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Signrpc_SignDescriptor { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///A descriptor that precisely describes *which* key to use for signing. This + ///may provide the raw public key directly, or require the Signer to re-derive + ///the key according to the populated derivation path. + /// + ///Note that if the key descriptor was obtained through walletrpc.DeriveKey, + ///then the key locator MUST always be provided, since the derived keys are not + ///persisted unlike with DeriveNextKey. + var keyDesc: Signrpc_KeyDescriptor { + get {return _keyDesc ?? Signrpc_KeyDescriptor()} + set {_keyDesc = newValue} + } + /// Returns true if `keyDesc` has been explicitly set. + var hasKeyDesc: Bool {return self._keyDesc != nil} + /// Clears the value of `keyDesc`. Subsequent reads from it will return its default value. + mutating func clearKeyDesc() {self._keyDesc = nil} + + /// + ///A scalar value that will be added to the private key corresponding to the + ///above public key to obtain the private key to be used to sign this input. + ///This value is typically derived via the following computation: + /// + /// derivedKey = privkey + sha256(perCommitmentPoint || pubKey) mod N + var singleTweak: Data = SwiftProtobuf.Internal.emptyData + + /// + ///A private key that will be used in combination with its corresponding + ///private key to derive the private key that is to be used to sign the target + ///input. Within the Lightning protocol, this value is typically the + ///commitment secret from a previously revoked commitment transaction. This + ///value is in combination with two hash values, and the original private key + ///to derive the private key to be used when signing. + /// + /// k = (privKey*sha256(pubKey || tweakPub) + + ///tweakPriv*sha256(tweakPub || pubKey)) mod N + var doubleTweak: Data = SwiftProtobuf.Internal.emptyData + + /// + ///The full script required to properly redeem the output. This field will + ///only be populated if a p2wsh or a p2sh output is being signed. + var witnessScript: Data = SwiftProtobuf.Internal.emptyData + + /// + ///A description of the output being spent. The value and script MUST be + ///provided. + var output: Signrpc_TxOut { + get {return _output ?? Signrpc_TxOut()} + set {_output = newValue} + } + /// Returns true if `output` has been explicitly set. + var hasOutput: Bool {return self._output != nil} + /// Clears the value of `output`. Subsequent reads from it will return its default value. + mutating func clearOutput() {self._output = nil} + + /// + ///The target sighash type that should be used when generating the final + ///sighash, and signature. + var sighash: UInt32 = 0 + + /// + ///The target input within the transaction that should be signed. + var inputIndex: Int32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _keyDesc: Signrpc_KeyDescriptor? = nil + fileprivate var _output: Signrpc_TxOut? = nil +} + +struct Signrpc_SignReq { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The raw bytes of the transaction to be signed. + var rawTxBytes: Data = SwiftProtobuf.Internal.emptyData + + /// A set of sign descriptors, for each input to be signed. + var signDescs: [Signrpc_SignDescriptor] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Signrpc_SignResp { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///A set of signatures realized in a fixed 64-byte format ordered in ascending + ///input order. + var rawSigs: [Data] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Signrpc_InputScript { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The serializes witness stack for the specified input. + var witness: [Data] = [] + + /// + ///The optional sig script for the specified witness that will only be set if + ///the input specified is a nested p2sh witness program. + var sigScript: Data = SwiftProtobuf.Internal.emptyData + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Signrpc_InputScriptResp { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The set of fully valid input scripts requested. + var inputScripts: [Signrpc_InputScript] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Signrpc_SignMessageReq { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The message to be signed. + var msg: Data = SwiftProtobuf.Internal.emptyData + + /// The key locator that identifies which key to use for signing. + var keyLoc: Signrpc_KeyLocator { + get {return _keyLoc ?? Signrpc_KeyLocator()} + set {_keyLoc = newValue} + } + /// Returns true if `keyLoc` has been explicitly set. + var hasKeyLoc: Bool {return self._keyLoc != nil} + /// Clears the value of `keyLoc`. Subsequent reads from it will return its default value. + mutating func clearKeyLoc() {self._keyLoc = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _keyLoc: Signrpc_KeyLocator? = nil +} + +struct Signrpc_SignMessageResp { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The signature for the given message in the fixed-size LN wire format. + var signature: Data = SwiftProtobuf.Internal.emptyData + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Signrpc_VerifyMessageReq { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The message over which the signature is to be verified. + var msg: Data = SwiftProtobuf.Internal.emptyData + + /// + ///The fixed-size LN wire encoded signature to be verified over the given + ///message. + var signature: Data = SwiftProtobuf.Internal.emptyData + + /// The public key the signature has to be valid for. + var pubkey: Data = SwiftProtobuf.Internal.emptyData + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Signrpc_VerifyMessageResp { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Whether the signature was valid over the given message. + var valid: Bool = false + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Signrpc_SharedKeyRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The ephemeral public key to use for the DH key derivation. + var ephemeralPubkey: Data = SwiftProtobuf.Internal.emptyData + + /// + ///The optional key locator of the local key that should be used. If this + ///parameter is not set then the node's identity private key will be used. + var keyLoc: Signrpc_KeyLocator { + get {return _keyLoc ?? Signrpc_KeyLocator()} + set {_keyLoc = newValue} + } + /// Returns true if `keyLoc` has been explicitly set. + var hasKeyLoc: Bool {return self._keyLoc != nil} + /// Clears the value of `keyLoc`. Subsequent reads from it will return its default value. + mutating func clearKeyLoc() {self._keyLoc = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _keyLoc: Signrpc_KeyLocator? = nil +} + +struct Signrpc_SharedKeyResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The shared public key, hashed with sha256. + var sharedKey: Data = SwiftProtobuf.Internal.emptyData + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "signrpc" + +extension Signrpc_KeyLocator: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".KeyLocator" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "key_family"), + 2: .standard(proto: "key_index"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularInt32Field(value: &self.keyFamily) + case 2: try decoder.decodeSingularInt32Field(value: &self.keyIndex) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.keyFamily != 0 { + try visitor.visitSingularInt32Field(value: self.keyFamily, fieldNumber: 1) + } + if self.keyIndex != 0 { + try visitor.visitSingularInt32Field(value: self.keyIndex, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Signrpc_KeyLocator, rhs: Signrpc_KeyLocator) -> Bool { + if lhs.keyFamily != rhs.keyFamily {return false} + if lhs.keyIndex != rhs.keyIndex {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Signrpc_KeyDescriptor: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".KeyDescriptor" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "raw_key_bytes"), + 2: .standard(proto: "key_loc"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.rawKeyBytes) + case 2: try decoder.decodeSingularMessageField(value: &self._keyLoc) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.rawKeyBytes.isEmpty { + try visitor.visitSingularBytesField(value: self.rawKeyBytes, fieldNumber: 1) + } + if let v = self._keyLoc { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Signrpc_KeyDescriptor, rhs: Signrpc_KeyDescriptor) -> Bool { + if lhs.rawKeyBytes != rhs.rawKeyBytes {return false} + if lhs._keyLoc != rhs._keyLoc {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Signrpc_TxOut: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".TxOut" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "value"), + 2: .standard(proto: "pk_script"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularInt64Field(value: &self.value) + case 2: try decoder.decodeSingularBytesField(value: &self.pkScript) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.value != 0 { + try visitor.visitSingularInt64Field(value: self.value, fieldNumber: 1) + } + if !self.pkScript.isEmpty { + try visitor.visitSingularBytesField(value: self.pkScript, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Signrpc_TxOut, rhs: Signrpc_TxOut) -> Bool { + if lhs.value != rhs.value {return false} + if lhs.pkScript != rhs.pkScript {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Signrpc_SignDescriptor: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SignDescriptor" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "key_desc"), + 2: .standard(proto: "single_tweak"), + 3: .standard(proto: "double_tweak"), + 4: .standard(proto: "witness_script"), + 5: .same(proto: "output"), + 7: .same(proto: "sighash"), + 8: .standard(proto: "input_index"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &self._keyDesc) + case 2: try decoder.decodeSingularBytesField(value: &self.singleTweak) + case 3: try decoder.decodeSingularBytesField(value: &self.doubleTweak) + case 4: try decoder.decodeSingularBytesField(value: &self.witnessScript) + case 5: try decoder.decodeSingularMessageField(value: &self._output) + case 7: try decoder.decodeSingularUInt32Field(value: &self.sighash) + case 8: try decoder.decodeSingularInt32Field(value: &self.inputIndex) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._keyDesc { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + if !self.singleTweak.isEmpty { + try visitor.visitSingularBytesField(value: self.singleTweak, fieldNumber: 2) + } + if !self.doubleTweak.isEmpty { + try visitor.visitSingularBytesField(value: self.doubleTweak, fieldNumber: 3) + } + if !self.witnessScript.isEmpty { + try visitor.visitSingularBytesField(value: self.witnessScript, fieldNumber: 4) + } + if let v = self._output { + try visitor.visitSingularMessageField(value: v, fieldNumber: 5) + } + if self.sighash != 0 { + try visitor.visitSingularUInt32Field(value: self.sighash, fieldNumber: 7) + } + if self.inputIndex != 0 { + try visitor.visitSingularInt32Field(value: self.inputIndex, fieldNumber: 8) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Signrpc_SignDescriptor, rhs: Signrpc_SignDescriptor) -> Bool { + if lhs._keyDesc != rhs._keyDesc {return false} + if lhs.singleTweak != rhs.singleTweak {return false} + if lhs.doubleTweak != rhs.doubleTweak {return false} + if lhs.witnessScript != rhs.witnessScript {return false} + if lhs._output != rhs._output {return false} + if lhs.sighash != rhs.sighash {return false} + if lhs.inputIndex != rhs.inputIndex {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Signrpc_SignReq: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SignReq" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "raw_tx_bytes"), + 2: .standard(proto: "sign_descs"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.rawTxBytes) + case 2: try decoder.decodeRepeatedMessageField(value: &self.signDescs) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.rawTxBytes.isEmpty { + try visitor.visitSingularBytesField(value: self.rawTxBytes, fieldNumber: 1) + } + if !self.signDescs.isEmpty { + try visitor.visitRepeatedMessageField(value: self.signDescs, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Signrpc_SignReq, rhs: Signrpc_SignReq) -> Bool { + if lhs.rawTxBytes != rhs.rawTxBytes {return false} + if lhs.signDescs != rhs.signDescs {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Signrpc_SignResp: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SignResp" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "raw_sigs"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedBytesField(value: &self.rawSigs) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.rawSigs.isEmpty { + try visitor.visitRepeatedBytesField(value: self.rawSigs, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Signrpc_SignResp, rhs: Signrpc_SignResp) -> Bool { + if lhs.rawSigs != rhs.rawSigs {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Signrpc_InputScript: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".InputScript" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "witness"), + 2: .standard(proto: "sig_script"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedBytesField(value: &self.witness) + case 2: try decoder.decodeSingularBytesField(value: &self.sigScript) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.witness.isEmpty { + try visitor.visitRepeatedBytesField(value: self.witness, fieldNumber: 1) + } + if !self.sigScript.isEmpty { + try visitor.visitSingularBytesField(value: self.sigScript, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Signrpc_InputScript, rhs: Signrpc_InputScript) -> Bool { + if lhs.witness != rhs.witness {return false} + if lhs.sigScript != rhs.sigScript {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Signrpc_InputScriptResp: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".InputScriptResp" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "input_scripts"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedMessageField(value: &self.inputScripts) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.inputScripts.isEmpty { + try visitor.visitRepeatedMessageField(value: self.inputScripts, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Signrpc_InputScriptResp, rhs: Signrpc_InputScriptResp) -> Bool { + if lhs.inputScripts != rhs.inputScripts {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Signrpc_SignMessageReq: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SignMessageReq" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "msg"), + 2: .standard(proto: "key_loc"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.msg) + case 2: try decoder.decodeSingularMessageField(value: &self._keyLoc) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.msg.isEmpty { + try visitor.visitSingularBytesField(value: self.msg, fieldNumber: 1) + } + if let v = self._keyLoc { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Signrpc_SignMessageReq, rhs: Signrpc_SignMessageReq) -> Bool { + if lhs.msg != rhs.msg {return false} + if lhs._keyLoc != rhs._keyLoc {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Signrpc_SignMessageResp: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SignMessageResp" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "signature"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.signature) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.signature.isEmpty { + try visitor.visitSingularBytesField(value: self.signature, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Signrpc_SignMessageResp, rhs: Signrpc_SignMessageResp) -> Bool { + if lhs.signature != rhs.signature {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Signrpc_VerifyMessageReq: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".VerifyMessageReq" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "msg"), + 2: .same(proto: "signature"), + 3: .same(proto: "pubkey"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.msg) + case 2: try decoder.decodeSingularBytesField(value: &self.signature) + case 3: try decoder.decodeSingularBytesField(value: &self.pubkey) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.msg.isEmpty { + try visitor.visitSingularBytesField(value: self.msg, fieldNumber: 1) + } + if !self.signature.isEmpty { + try visitor.visitSingularBytesField(value: self.signature, fieldNumber: 2) + } + if !self.pubkey.isEmpty { + try visitor.visitSingularBytesField(value: self.pubkey, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Signrpc_VerifyMessageReq, rhs: Signrpc_VerifyMessageReq) -> Bool { + if lhs.msg != rhs.msg {return false} + if lhs.signature != rhs.signature {return false} + if lhs.pubkey != rhs.pubkey {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Signrpc_VerifyMessageResp: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".VerifyMessageResp" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "valid"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBoolField(value: &self.valid) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.valid != false { + try visitor.visitSingularBoolField(value: self.valid, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Signrpc_VerifyMessageResp, rhs: Signrpc_VerifyMessageResp) -> Bool { + if lhs.valid != rhs.valid {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Signrpc_SharedKeyRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SharedKeyRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "ephemeral_pubkey"), + 2: .standard(proto: "key_loc"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.ephemeralPubkey) + case 2: try decoder.decodeSingularMessageField(value: &self._keyLoc) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.ephemeralPubkey.isEmpty { + try visitor.visitSingularBytesField(value: self.ephemeralPubkey, fieldNumber: 1) + } + if let v = self._keyLoc { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Signrpc_SharedKeyRequest, rhs: Signrpc_SharedKeyRequest) -> Bool { + if lhs.ephemeralPubkey != rhs.ephemeralPubkey {return false} + if lhs._keyLoc != rhs._keyLoc {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Signrpc_SharedKeyResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SharedKeyResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "shared_key"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.sharedKey) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.sharedKey.isEmpty { + try visitor.visitSingularBytesField(value: self.sharedKey, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Signrpc_SharedKeyResponse, rhs: Signrpc_SharedKeyResponse) -> Bool { + if lhs.sharedKey != rhs.sharedKey {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/wallet/Lightning/rpc/verrpc/verrpc.pb.swift b/wallet/Lightning/rpc/verrpc/verrpc.pb.swift new file mode 100644 index 0000000..9a719b7 --- /dev/null +++ b/wallet/Lightning/rpc/verrpc/verrpc.pb.swift @@ -0,0 +1,168 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: verrpc/verrpc.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +import Foundation +import SwiftProtobuf + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +struct Verrpc_VersionRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Verrpc_Version { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// A verbose description of the daemon's commit. + var commit: String = String() + + /// The SHA1 commit hash that the daemon is compiled with. + var commitHash: String = String() + + /// The semantic version. + var version: String = String() + + /// The major application version. + var appMajor: UInt32 = 0 + + /// The minor application version. + var appMinor: UInt32 = 0 + + /// The application patch number. + var appPatch: UInt32 = 0 + + /// The application pre-release modifier, possibly empty. + var appPreRelease: String = String() + + /// The list of build tags that were supplied during compilation. + var buildTags: [String] = [] + + /// The version of go that compiled the executable. + var goVersion: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "verrpc" + +extension Verrpc_VersionRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".VersionRequest" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Verrpc_VersionRequest, rhs: Verrpc_VersionRequest) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Verrpc_Version: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Version" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "commit"), + 2: .standard(proto: "commit_hash"), + 3: .same(proto: "version"), + 4: .standard(proto: "app_major"), + 5: .standard(proto: "app_minor"), + 6: .standard(proto: "app_patch"), + 7: .standard(proto: "app_pre_release"), + 8: .standard(proto: "build_tags"), + 9: .standard(proto: "go_version"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.commit) + case 2: try decoder.decodeSingularStringField(value: &self.commitHash) + case 3: try decoder.decodeSingularStringField(value: &self.version) + case 4: try decoder.decodeSingularUInt32Field(value: &self.appMajor) + case 5: try decoder.decodeSingularUInt32Field(value: &self.appMinor) + case 6: try decoder.decodeSingularUInt32Field(value: &self.appPatch) + case 7: try decoder.decodeSingularStringField(value: &self.appPreRelease) + case 8: try decoder.decodeRepeatedStringField(value: &self.buildTags) + case 9: try decoder.decodeSingularStringField(value: &self.goVersion) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.commit.isEmpty { + try visitor.visitSingularStringField(value: self.commit, fieldNumber: 1) + } + if !self.commitHash.isEmpty { + try visitor.visitSingularStringField(value: self.commitHash, fieldNumber: 2) + } + if !self.version.isEmpty { + try visitor.visitSingularStringField(value: self.version, fieldNumber: 3) + } + if self.appMajor != 0 { + try visitor.visitSingularUInt32Field(value: self.appMajor, fieldNumber: 4) + } + if self.appMinor != 0 { + try visitor.visitSingularUInt32Field(value: self.appMinor, fieldNumber: 5) + } + if self.appPatch != 0 { + try visitor.visitSingularUInt32Field(value: self.appPatch, fieldNumber: 6) + } + if !self.appPreRelease.isEmpty { + try visitor.visitSingularStringField(value: self.appPreRelease, fieldNumber: 7) + } + if !self.buildTags.isEmpty { + try visitor.visitRepeatedStringField(value: self.buildTags, fieldNumber: 8) + } + if !self.goVersion.isEmpty { + try visitor.visitSingularStringField(value: self.goVersion, fieldNumber: 9) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Verrpc_Version, rhs: Verrpc_Version) -> Bool { + if lhs.commit != rhs.commit {return false} + if lhs.commitHash != rhs.commitHash {return false} + if lhs.version != rhs.version {return false} + if lhs.appMajor != rhs.appMajor {return false} + if lhs.appMinor != rhs.appMinor {return false} + if lhs.appPatch != rhs.appPatch {return false} + if lhs.appPreRelease != rhs.appPreRelease {return false} + if lhs.buildTags != rhs.buildTags {return false} + if lhs.goVersion != rhs.goVersion {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/wallet/Lightning/rpc/walletrpc/walletkit.pb.swift b/wallet/Lightning/rpc/walletrpc/walletkit.pb.swift new file mode 100644 index 0000000..0088f15 --- /dev/null +++ b/wallet/Lightning/rpc/walletrpc/walletkit.pb.swift @@ -0,0 +1,1484 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: walletrpc/walletkit.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +import Foundation +import SwiftProtobuf + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +enum Walletrpc_WitnessType: SwiftProtobuf.Enum { + typealias RawValue = Int + case unknownWitness // = 0 + + /// + ///A witness that allows us to spend the output of a commitment transaction + ///after a relative lock-time lockout. + case commitmentTimeLock // = 1 + + /// + ///A witness that allows us to spend a settled no-delay output immediately on a + ///counterparty's commitment transaction. + case commitmentNoDelay // = 2 + + /// + ///A witness that allows us to sweep the settled output of a malicious + ///counterparty's who broadcasts a revoked commitment transaction. + case commitmentRevoke // = 3 + + /// + ///A witness that allows us to sweep an HTLC which we offered to the remote + ///party in the case that they broadcast a revoked commitment state. + case htlcOfferedRevoke // = 4 + + /// + ///A witness that allows us to sweep an HTLC output sent to us in the case that + ///the remote party broadcasts a revoked commitment state. + case htlcAcceptedRevoke // = 5 + + /// + ///A witness that allows us to sweep an HTLC output that we extended to a + ///party, but was never fulfilled. This HTLC output isn't directly on the + ///commitment transaction, but is the result of a confirmed second-level HTLC + ///transaction. As a result, we can only spend this after a CSV delay. + case htlcOfferedTimeoutSecondLevel // = 6 + + /// + ///A witness that allows us to sweep an HTLC output that was offered to us, and + ///for which we have a payment preimage. This HTLC output isn't directly on our + ///commitment transaction, but is the result of confirmed second-level HTLC + ///transaction. As a result, we can only spend this after a CSV delay. + case htlcAcceptedSuccessSecondLevel // = 7 + + /// + ///A witness that allows us to sweep an HTLC that we offered to the remote + ///party which lies in the commitment transaction of the remote party. We can + ///spend this output after the absolute CLTV timeout of the HTLC as passed. + case htlcOfferedRemoteTimeout // = 8 + + /// + ///A witness that allows us to sweep an HTLC that was offered to us by the + ///remote party. We use this witness in the case that the remote party goes to + ///chain, and we know the pre-image to the HTLC. We can sweep this without any + ///additional timeout. + case htlcAcceptedRemoteSuccess // = 9 + + /// + ///A witness that allows us to sweep an HTLC from the remote party's commitment + ///transaction in the case that the broadcast a revoked commitment, but then + ///also immediately attempt to go to the second level to claim the HTLC. + case htlcSecondLevelRevoke // = 10 + + /// + ///A witness type that allows us to spend a regular p2wkh output that's sent to + ///an output which is under complete control of the backing wallet. + case witnessKeyHash // = 11 + + /// + ///A witness type that allows us to sweep an output that sends to a nested P2SH + ///script that pays to a key solely under our control. + case nestedWitnessKeyHash // = 12 + + /// + ///A witness type that allows us to spend our anchor on the commitment + ///transaction. + case commitmentAnchor // = 13 + case UNRECOGNIZED(Int) + + init() { + self = .unknownWitness + } + + init?(rawValue: Int) { + switch rawValue { + case 0: self = .unknownWitness + case 1: self = .commitmentTimeLock + case 2: self = .commitmentNoDelay + case 3: self = .commitmentRevoke + case 4: self = .htlcOfferedRevoke + case 5: self = .htlcAcceptedRevoke + case 6: self = .htlcOfferedTimeoutSecondLevel + case 7: self = .htlcAcceptedSuccessSecondLevel + case 8: self = .htlcOfferedRemoteTimeout + case 9: self = .htlcAcceptedRemoteSuccess + case 10: self = .htlcSecondLevelRevoke + case 11: self = .witnessKeyHash + case 12: self = .nestedWitnessKeyHash + case 13: self = .commitmentAnchor + default: self = .UNRECOGNIZED(rawValue) + } + } + + var rawValue: Int { + switch self { + case .unknownWitness: return 0 + case .commitmentTimeLock: return 1 + case .commitmentNoDelay: return 2 + case .commitmentRevoke: return 3 + case .htlcOfferedRevoke: return 4 + case .htlcAcceptedRevoke: return 5 + case .htlcOfferedTimeoutSecondLevel: return 6 + case .htlcAcceptedSuccessSecondLevel: return 7 + case .htlcOfferedRemoteTimeout: return 8 + case .htlcAcceptedRemoteSuccess: return 9 + case .htlcSecondLevelRevoke: return 10 + case .witnessKeyHash: return 11 + case .nestedWitnessKeyHash: return 12 + case .commitmentAnchor: return 13 + case .UNRECOGNIZED(let i): return i + } + } + +} + +#if swift(>=4.2) + +extension Walletrpc_WitnessType: CaseIterable { + // The compiler won't synthesize support with the UNRECOGNIZED case. + static var allCases: [Walletrpc_WitnessType] = [ + .unknownWitness, + .commitmentTimeLock, + .commitmentNoDelay, + .commitmentRevoke, + .htlcOfferedRevoke, + .htlcAcceptedRevoke, + .htlcOfferedTimeoutSecondLevel, + .htlcAcceptedSuccessSecondLevel, + .htlcOfferedRemoteTimeout, + .htlcAcceptedRemoteSuccess, + .htlcSecondLevelRevoke, + .witnessKeyHash, + .nestedWitnessKeyHash, + .commitmentAnchor, + ] +} + +#endif // swift(>=4.2) + +struct Walletrpc_ListUnspentRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The minimum number of confirmations to be included. + var minConfs: Int32 = 0 + + /// The maximum number of confirmations to be included. + var maxConfs: Int32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Walletrpc_ListUnspentResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// A list of utxos satisfying the specified number of confirmations. + var utxos: [Lnrpc_Utxo] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Walletrpc_LeaseOutputRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///An ID of 32 random bytes that must be unique for each distinct application + ///using this RPC which will be used to bound the output lease to. + var id: Data = SwiftProtobuf.Internal.emptyData + + /// The identifying outpoint of the output being leased. + var outpoint: Lnrpc_OutPoint { + get {return _outpoint ?? Lnrpc_OutPoint()} + set {_outpoint = newValue} + } + /// Returns true if `outpoint` has been explicitly set. + var hasOutpoint: Bool {return self._outpoint != nil} + /// Clears the value of `outpoint`. Subsequent reads from it will return its default value. + mutating func clearOutpoint() {self._outpoint = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _outpoint: Lnrpc_OutPoint? = nil +} + +struct Walletrpc_LeaseOutputResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The absolute expiration of the output lease represented as a unix timestamp. + var expiration: UInt64 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Walletrpc_ReleaseOutputRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The unique ID that was used to lock the output. + var id: Data = SwiftProtobuf.Internal.emptyData + + /// The identifying outpoint of the output being released. + var outpoint: Lnrpc_OutPoint { + get {return _outpoint ?? Lnrpc_OutPoint()} + set {_outpoint = newValue} + } + /// Returns true if `outpoint` has been explicitly set. + var hasOutpoint: Bool {return self._outpoint != nil} + /// Clears the value of `outpoint`. Subsequent reads from it will return its default value. + mutating func clearOutpoint() {self._outpoint = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _outpoint: Lnrpc_OutPoint? = nil +} + +struct Walletrpc_ReleaseOutputResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Walletrpc_KeyReq { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///Is the key finger print of the root pubkey that this request is targeting. + ///This allows the WalletKit to possibly serve out keys for multiple HD chains + ///via public derivation. + var keyFingerPrint: Int32 = 0 + + /// + ///The target key family to derive a key from. In other contexts, this is + ///known as the "account". + var keyFamily: Int32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +/// No fields, as we always give out a p2wkh address. +struct Walletrpc_AddrRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Walletrpc_AddrResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The address encoded using a bech32 format. + var addr: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Walletrpc_Transaction { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The raw serialized transaction. + var txHex: Data = SwiftProtobuf.Internal.emptyData + + /// + ///An optional label to save with the transaction. Limited to 500 characters. + var label: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Walletrpc_PublishResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///If blank, then no error occurred and the transaction was successfully + ///published. If not the empty string, then a string representation of the + ///broadcast error. + /// + ///TODO(roasbeef): map to a proper enum type + var publishError: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Walletrpc_SendOutputsRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The number of satoshis per kilo weight that should be used when crafting + ///this transaction. + var satPerKw: Int64 = 0 + + /// + ///A slice of the outputs that should be created in the transaction produced. + var outputs: [Signrpc_TxOut] = [] + + /// An optional label for the transaction, limited to 500 characters. + var label: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Walletrpc_SendOutputsResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The serialized transaction sent out on the network. + var rawTx: Data = SwiftProtobuf.Internal.emptyData + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Walletrpc_EstimateFeeRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The number of confirmations to shoot for when estimating the fee. + var confTarget: Int32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Walletrpc_EstimateFeeResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The amount of satoshis per kw that should be used in order to reach the + ///confirmation target in the request. + var satPerKw: Int64 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Walletrpc_PendingSweep { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The outpoint of the output we're attempting to sweep. + var outpoint: Lnrpc_OutPoint { + get {return _outpoint ?? Lnrpc_OutPoint()} + set {_outpoint = newValue} + } + /// Returns true if `outpoint` has been explicitly set. + var hasOutpoint: Bool {return self._outpoint != nil} + /// Clears the value of `outpoint`. Subsequent reads from it will return its default value. + mutating func clearOutpoint() {self._outpoint = nil} + + /// The witness type of the output we're attempting to sweep. + var witnessType: Walletrpc_WitnessType = .unknownWitness + + /// The value of the output we're attempting to sweep. + var amountSat: UInt32 = 0 + + /// + ///The fee rate we'll use to sweep the output. The fee rate is only determined + ///once a sweeping transaction for the output is created, so it's possible for + ///this to be 0 before this. + var satPerByte: UInt32 = 0 + + /// The number of broadcast attempts we've made to sweep the output. + var broadcastAttempts: UInt32 = 0 + + /// + ///The next height of the chain at which we'll attempt to broadcast the + ///sweep transaction of the output. + var nextBroadcastHeight: UInt32 = 0 + + /// The requested confirmation target for this output. + var requestedConfTarget: UInt32 = 0 + + /// The requested fee rate, expressed in sat/byte, for this output. + var requestedSatPerByte: UInt32 = 0 + + /// + ///Whether this input must be force-swept. This means that it is swept even + ///if it has a negative yield. + var force: Bool = false + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _outpoint: Lnrpc_OutPoint? = nil +} + +struct Walletrpc_PendingSweepsRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Walletrpc_PendingSweepsResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The set of outputs currently being swept by lnd's central batching engine. + var pendingSweeps: [Walletrpc_PendingSweep] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Walletrpc_BumpFeeRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The input we're attempting to bump the fee of. + var outpoint: Lnrpc_OutPoint { + get {return _outpoint ?? Lnrpc_OutPoint()} + set {_outpoint = newValue} + } + /// Returns true if `outpoint` has been explicitly set. + var hasOutpoint: Bool {return self._outpoint != nil} + /// Clears the value of `outpoint`. Subsequent reads from it will return its default value. + mutating func clearOutpoint() {self._outpoint = nil} + + /// The target number of blocks that the input should be spent within. + var targetConf: UInt32 = 0 + + /// + ///The fee rate, expressed in sat/byte, that should be used to spend the input + ///with. + var satPerByte: UInt32 = 0 + + /// + ///Whether this input must be force-swept. This means that it is swept even + ///if it has a negative yield. + var force: Bool = false + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _outpoint: Lnrpc_OutPoint? = nil +} + +struct Walletrpc_BumpFeeResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Walletrpc_ListSweepsRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///Retrieve the full sweep transaction details. If false, only the sweep txids + ///will be returned. + var verbose: Bool = false + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Walletrpc_ListSweepsResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var sweeps: Walletrpc_ListSweepsResponse.OneOf_Sweeps? = nil + + var transactionDetails: Lnrpc_TransactionDetails { + get { + if case .transactionDetails(let v)? = sweeps {return v} + return Lnrpc_TransactionDetails() + } + set {sweeps = .transactionDetails(newValue)} + } + + var transactionIds: Walletrpc_ListSweepsResponse.TransactionIDs { + get { + if case .transactionIds(let v)? = sweeps {return v} + return Walletrpc_ListSweepsResponse.TransactionIDs() + } + set {sweeps = .transactionIds(newValue)} + } + + var unknownFields = SwiftProtobuf.UnknownStorage() + + enum OneOf_Sweeps: Equatable { + case transactionDetails(Lnrpc_TransactionDetails) + case transactionIds(Walletrpc_ListSweepsResponse.TransactionIDs) + + #if !swift(>=4.1) + static func ==(lhs: Walletrpc_ListSweepsResponse.OneOf_Sweeps, rhs: Walletrpc_ListSweepsResponse.OneOf_Sweeps) -> Bool { + switch (lhs, rhs) { + case (.transactionDetails(let l), .transactionDetails(let r)): return l == r + case (.transactionIds(let l), .transactionIds(let r)): return l == r + default: return false + } + } + #endif + } + + struct TransactionIDs { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///Reversed, hex-encoded string representing the transaction ids of the + ///sweeps that our node has broadcast. Note that these transactions may + ///not have confirmed yet, we record sweeps on broadcast, not confirmation. + var transactionIds: [String] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + } + + init() {} +} + +struct Walletrpc_LabelTransactionRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The txid of the transaction to label. + var txid: Data = SwiftProtobuf.Internal.emptyData + + /// The label to add to the transaction, limited to 500 characters. + var label: String = String() + + /// Whether to overwrite the existing label, if it is present. + var overwrite: Bool = false + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Walletrpc_LabelTransactionResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "walletrpc" + +extension Walletrpc_WitnessType: SwiftProtobuf._ProtoNameProviding { + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "UNKNOWN_WITNESS"), + 1: .same(proto: "COMMITMENT_TIME_LOCK"), + 2: .same(proto: "COMMITMENT_NO_DELAY"), + 3: .same(proto: "COMMITMENT_REVOKE"), + 4: .same(proto: "HTLC_OFFERED_REVOKE"), + 5: .same(proto: "HTLC_ACCEPTED_REVOKE"), + 6: .same(proto: "HTLC_OFFERED_TIMEOUT_SECOND_LEVEL"), + 7: .same(proto: "HTLC_ACCEPTED_SUCCESS_SECOND_LEVEL"), + 8: .same(proto: "HTLC_OFFERED_REMOTE_TIMEOUT"), + 9: .same(proto: "HTLC_ACCEPTED_REMOTE_SUCCESS"), + 10: .same(proto: "HTLC_SECOND_LEVEL_REVOKE"), + 11: .same(proto: "WITNESS_KEY_HASH"), + 12: .same(proto: "NESTED_WITNESS_KEY_HASH"), + 13: .same(proto: "COMMITMENT_ANCHOR"), + ] +} + +extension Walletrpc_ListUnspentRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ListUnspentRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "min_confs"), + 2: .standard(proto: "max_confs"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularInt32Field(value: &self.minConfs) + case 2: try decoder.decodeSingularInt32Field(value: &self.maxConfs) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.minConfs != 0 { + try visitor.visitSingularInt32Field(value: self.minConfs, fieldNumber: 1) + } + if self.maxConfs != 0 { + try visitor.visitSingularInt32Field(value: self.maxConfs, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Walletrpc_ListUnspentRequest, rhs: Walletrpc_ListUnspentRequest) -> Bool { + if lhs.minConfs != rhs.minConfs {return false} + if lhs.maxConfs != rhs.maxConfs {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Walletrpc_ListUnspentResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ListUnspentResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "utxos"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedMessageField(value: &self.utxos) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.utxos.isEmpty { + try visitor.visitRepeatedMessageField(value: self.utxos, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Walletrpc_ListUnspentResponse, rhs: Walletrpc_ListUnspentResponse) -> Bool { + if lhs.utxos != rhs.utxos {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Walletrpc_LeaseOutputRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".LeaseOutputRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "id"), + 2: .same(proto: "outpoint"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.id) + case 2: try decoder.decodeSingularMessageField(value: &self._outpoint) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.id.isEmpty { + try visitor.visitSingularBytesField(value: self.id, fieldNumber: 1) + } + if let v = self._outpoint { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Walletrpc_LeaseOutputRequest, rhs: Walletrpc_LeaseOutputRequest) -> Bool { + if lhs.id != rhs.id {return false} + if lhs._outpoint != rhs._outpoint {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Walletrpc_LeaseOutputResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".LeaseOutputResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "expiration"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt64Field(value: &self.expiration) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.expiration != 0 { + try visitor.visitSingularUInt64Field(value: self.expiration, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Walletrpc_LeaseOutputResponse, rhs: Walletrpc_LeaseOutputResponse) -> Bool { + if lhs.expiration != rhs.expiration {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Walletrpc_ReleaseOutputRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ReleaseOutputRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "id"), + 2: .same(proto: "outpoint"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.id) + case 2: try decoder.decodeSingularMessageField(value: &self._outpoint) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.id.isEmpty { + try visitor.visitSingularBytesField(value: self.id, fieldNumber: 1) + } + if let v = self._outpoint { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Walletrpc_ReleaseOutputRequest, rhs: Walletrpc_ReleaseOutputRequest) -> Bool { + if lhs.id != rhs.id {return false} + if lhs._outpoint != rhs._outpoint {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Walletrpc_ReleaseOutputResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ReleaseOutputResponse" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Walletrpc_ReleaseOutputResponse, rhs: Walletrpc_ReleaseOutputResponse) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Walletrpc_KeyReq: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".KeyReq" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "key_finger_print"), + 2: .standard(proto: "key_family"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularInt32Field(value: &self.keyFingerPrint) + case 2: try decoder.decodeSingularInt32Field(value: &self.keyFamily) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.keyFingerPrint != 0 { + try visitor.visitSingularInt32Field(value: self.keyFingerPrint, fieldNumber: 1) + } + if self.keyFamily != 0 { + try visitor.visitSingularInt32Field(value: self.keyFamily, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Walletrpc_KeyReq, rhs: Walletrpc_KeyReq) -> Bool { + if lhs.keyFingerPrint != rhs.keyFingerPrint {return false} + if lhs.keyFamily != rhs.keyFamily {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Walletrpc_AddrRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".AddrRequest" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Walletrpc_AddrRequest, rhs: Walletrpc_AddrRequest) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Walletrpc_AddrResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".AddrResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "addr"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.addr) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.addr.isEmpty { + try visitor.visitSingularStringField(value: self.addr, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Walletrpc_AddrResponse, rhs: Walletrpc_AddrResponse) -> Bool { + if lhs.addr != rhs.addr {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Walletrpc_Transaction: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Transaction" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "tx_hex"), + 2: .same(proto: "label"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.txHex) + case 2: try decoder.decodeSingularStringField(value: &self.label) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.txHex.isEmpty { + try visitor.visitSingularBytesField(value: self.txHex, fieldNumber: 1) + } + if !self.label.isEmpty { + try visitor.visitSingularStringField(value: self.label, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Walletrpc_Transaction, rhs: Walletrpc_Transaction) -> Bool { + if lhs.txHex != rhs.txHex {return false} + if lhs.label != rhs.label {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Walletrpc_PublishResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".PublishResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "publish_error"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularStringField(value: &self.publishError) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.publishError.isEmpty { + try visitor.visitSingularStringField(value: self.publishError, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Walletrpc_PublishResponse, rhs: Walletrpc_PublishResponse) -> Bool { + if lhs.publishError != rhs.publishError {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Walletrpc_SendOutputsRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SendOutputsRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "sat_per_kw"), + 2: .same(proto: "outputs"), + 3: .same(proto: "label"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularInt64Field(value: &self.satPerKw) + case 2: try decoder.decodeRepeatedMessageField(value: &self.outputs) + case 3: try decoder.decodeSingularStringField(value: &self.label) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.satPerKw != 0 { + try visitor.visitSingularInt64Field(value: self.satPerKw, fieldNumber: 1) + } + if !self.outputs.isEmpty { + try visitor.visitRepeatedMessageField(value: self.outputs, fieldNumber: 2) + } + if !self.label.isEmpty { + try visitor.visitSingularStringField(value: self.label, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Walletrpc_SendOutputsRequest, rhs: Walletrpc_SendOutputsRequest) -> Bool { + if lhs.satPerKw != rhs.satPerKw {return false} + if lhs.outputs != rhs.outputs {return false} + if lhs.label != rhs.label {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Walletrpc_SendOutputsResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".SendOutputsResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "raw_tx"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.rawTx) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.rawTx.isEmpty { + try visitor.visitSingularBytesField(value: self.rawTx, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Walletrpc_SendOutputsResponse, rhs: Walletrpc_SendOutputsResponse) -> Bool { + if lhs.rawTx != rhs.rawTx {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Walletrpc_EstimateFeeRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".EstimateFeeRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "conf_target"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularInt32Field(value: &self.confTarget) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.confTarget != 0 { + try visitor.visitSingularInt32Field(value: self.confTarget, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Walletrpc_EstimateFeeRequest, rhs: Walletrpc_EstimateFeeRequest) -> Bool { + if lhs.confTarget != rhs.confTarget {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Walletrpc_EstimateFeeResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".EstimateFeeResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "sat_per_kw"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularInt64Field(value: &self.satPerKw) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.satPerKw != 0 { + try visitor.visitSingularInt64Field(value: self.satPerKw, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Walletrpc_EstimateFeeResponse, rhs: Walletrpc_EstimateFeeResponse) -> Bool { + if lhs.satPerKw != rhs.satPerKw {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Walletrpc_PendingSweep: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".PendingSweep" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "outpoint"), + 2: .standard(proto: "witness_type"), + 3: .standard(proto: "amount_sat"), + 4: .standard(proto: "sat_per_byte"), + 5: .standard(proto: "broadcast_attempts"), + 6: .standard(proto: "next_broadcast_height"), + 8: .standard(proto: "requested_conf_target"), + 9: .standard(proto: "requested_sat_per_byte"), + 7: .same(proto: "force"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &self._outpoint) + case 2: try decoder.decodeSingularEnumField(value: &self.witnessType) + case 3: try decoder.decodeSingularUInt32Field(value: &self.amountSat) + case 4: try decoder.decodeSingularUInt32Field(value: &self.satPerByte) + case 5: try decoder.decodeSingularUInt32Field(value: &self.broadcastAttempts) + case 6: try decoder.decodeSingularUInt32Field(value: &self.nextBroadcastHeight) + case 7: try decoder.decodeSingularBoolField(value: &self.force) + case 8: try decoder.decodeSingularUInt32Field(value: &self.requestedConfTarget) + case 9: try decoder.decodeSingularUInt32Field(value: &self.requestedSatPerByte) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._outpoint { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + if self.witnessType != .unknownWitness { + try visitor.visitSingularEnumField(value: self.witnessType, fieldNumber: 2) + } + if self.amountSat != 0 { + try visitor.visitSingularUInt32Field(value: self.amountSat, fieldNumber: 3) + } + if self.satPerByte != 0 { + try visitor.visitSingularUInt32Field(value: self.satPerByte, fieldNumber: 4) + } + if self.broadcastAttempts != 0 { + try visitor.visitSingularUInt32Field(value: self.broadcastAttempts, fieldNumber: 5) + } + if self.nextBroadcastHeight != 0 { + try visitor.visitSingularUInt32Field(value: self.nextBroadcastHeight, fieldNumber: 6) + } + if self.force != false { + try visitor.visitSingularBoolField(value: self.force, fieldNumber: 7) + } + if self.requestedConfTarget != 0 { + try visitor.visitSingularUInt32Field(value: self.requestedConfTarget, fieldNumber: 8) + } + if self.requestedSatPerByte != 0 { + try visitor.visitSingularUInt32Field(value: self.requestedSatPerByte, fieldNumber: 9) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Walletrpc_PendingSweep, rhs: Walletrpc_PendingSweep) -> Bool { + if lhs._outpoint != rhs._outpoint {return false} + if lhs.witnessType != rhs.witnessType {return false} + if lhs.amountSat != rhs.amountSat {return false} + if lhs.satPerByte != rhs.satPerByte {return false} + if lhs.broadcastAttempts != rhs.broadcastAttempts {return false} + if lhs.nextBroadcastHeight != rhs.nextBroadcastHeight {return false} + if lhs.requestedConfTarget != rhs.requestedConfTarget {return false} + if lhs.requestedSatPerByte != rhs.requestedSatPerByte {return false} + if lhs.force != rhs.force {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Walletrpc_PendingSweepsRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".PendingSweepsRequest" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Walletrpc_PendingSweepsRequest, rhs: Walletrpc_PendingSweepsRequest) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Walletrpc_PendingSweepsResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".PendingSweepsResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "pending_sweeps"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedMessageField(value: &self.pendingSweeps) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.pendingSweeps.isEmpty { + try visitor.visitRepeatedMessageField(value: self.pendingSweeps, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Walletrpc_PendingSweepsResponse, rhs: Walletrpc_PendingSweepsResponse) -> Bool { + if lhs.pendingSweeps != rhs.pendingSweeps {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Walletrpc_BumpFeeRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".BumpFeeRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "outpoint"), + 2: .standard(proto: "target_conf"), + 3: .standard(proto: "sat_per_byte"), + 4: .same(proto: "force"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularMessageField(value: &self._outpoint) + case 2: try decoder.decodeSingularUInt32Field(value: &self.targetConf) + case 3: try decoder.decodeSingularUInt32Field(value: &self.satPerByte) + case 4: try decoder.decodeSingularBoolField(value: &self.force) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if let v = self._outpoint { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } + if self.targetConf != 0 { + try visitor.visitSingularUInt32Field(value: self.targetConf, fieldNumber: 2) + } + if self.satPerByte != 0 { + try visitor.visitSingularUInt32Field(value: self.satPerByte, fieldNumber: 3) + } + if self.force != false { + try visitor.visitSingularBoolField(value: self.force, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Walletrpc_BumpFeeRequest, rhs: Walletrpc_BumpFeeRequest) -> Bool { + if lhs._outpoint != rhs._outpoint {return false} + if lhs.targetConf != rhs.targetConf {return false} + if lhs.satPerByte != rhs.satPerByte {return false} + if lhs.force != rhs.force {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Walletrpc_BumpFeeResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".BumpFeeResponse" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Walletrpc_BumpFeeResponse, rhs: Walletrpc_BumpFeeResponse) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Walletrpc_ListSweepsRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ListSweepsRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "verbose"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBoolField(value: &self.verbose) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.verbose != false { + try visitor.visitSingularBoolField(value: self.verbose, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Walletrpc_ListSweepsRequest, rhs: Walletrpc_ListSweepsRequest) -> Bool { + if lhs.verbose != rhs.verbose {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Walletrpc_ListSweepsResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ListSweepsResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "transaction_details"), + 2: .standard(proto: "transaction_ids"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: + var v: Lnrpc_TransactionDetails? + if let current = self.sweeps { + try decoder.handleConflictingOneOf() + if case .transactionDetails(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {self.sweeps = .transactionDetails(v)} + case 2: + var v: Walletrpc_ListSweepsResponse.TransactionIDs? + if let current = self.sweeps { + try decoder.handleConflictingOneOf() + if case .transactionIds(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v {self.sweeps = .transactionIds(v)} + default: break + } + } + } + + func traverse(visitor: inout V) throws { + switch self.sweeps { + case .transactionDetails(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + case .transactionIds(let v)?: + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + case nil: break + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Walletrpc_ListSweepsResponse, rhs: Walletrpc_ListSweepsResponse) -> Bool { + if lhs.sweeps != rhs.sweeps {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Walletrpc_ListSweepsResponse.TransactionIDs: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = Walletrpc_ListSweepsResponse.protoMessageName + ".TransactionIDs" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "transaction_ids"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedStringField(value: &self.transactionIds) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.transactionIds.isEmpty { + try visitor.visitRepeatedStringField(value: self.transactionIds, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Walletrpc_ListSweepsResponse.TransactionIDs, rhs: Walletrpc_ListSweepsResponse.TransactionIDs) -> Bool { + if lhs.transactionIds != rhs.transactionIds {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Walletrpc_LabelTransactionRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".LabelTransactionRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "txid"), + 2: .same(proto: "label"), + 3: .same(proto: "overwrite"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.txid) + case 2: try decoder.decodeSingularStringField(value: &self.label) + case 3: try decoder.decodeSingularBoolField(value: &self.overwrite) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.txid.isEmpty { + try visitor.visitSingularBytesField(value: self.txid, fieldNumber: 1) + } + if !self.label.isEmpty { + try visitor.visitSingularStringField(value: self.label, fieldNumber: 2) + } + if self.overwrite != false { + try visitor.visitSingularBoolField(value: self.overwrite, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Walletrpc_LabelTransactionRequest, rhs: Walletrpc_LabelTransactionRequest) -> Bool { + if lhs.txid != rhs.txid {return false} + if lhs.label != rhs.label {return false} + if lhs.overwrite != rhs.overwrite {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Walletrpc_LabelTransactionResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".LabelTransactionResponse" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Walletrpc_LabelTransactionResponse, rhs: Walletrpc_LabelTransactionResponse) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/wallet/Lightning/rpc/walletunlocker.pb.swift b/wallet/Lightning/rpc/walletunlocker.pb.swift new file mode 100644 index 0000000..476d767 --- /dev/null +++ b/wallet/Lightning/rpc/walletunlocker.pb.swift @@ -0,0 +1,473 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: walletunlocker.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +import Foundation +import SwiftProtobuf + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +struct Lnrpc_GenSeedRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///aezeed_passphrase is an optional user provided passphrase that will be used + ///to encrypt the generated aezeed cipher seed. When using REST, this field + ///must be encoded as base64. + var aezeedPassphrase: Data = SwiftProtobuf.Internal.emptyData + + /// + ///seed_entropy is an optional 16-bytes generated via CSPRNG. If not + ///specified, then a fresh set of randomness will be used to create the seed. + ///When using REST, this field must be encoded as base64. + var seedEntropy: Data = SwiftProtobuf.Internal.emptyData + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_GenSeedResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///cipher_seed_mnemonic is a 24-word mnemonic that encodes a prior aezeed + ///cipher seed obtained by the user. This field is optional, as if not + ///provided, then the daemon will generate a new cipher seed for the user. + ///Otherwise, then the daemon will attempt to recover the wallet state linked + ///to this cipher seed. + var cipherSeedMnemonic: [String] = [] + + /// + ///enciphered_seed are the raw aezeed cipher seed bytes. This is the raw + ///cipher text before run through our mnemonic encoding scheme. + var encipheredSeed: Data = SwiftProtobuf.Internal.emptyData + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_InitWalletRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///wallet_password is the passphrase that should be used to encrypt the + ///wallet. This MUST be at least 8 chars in length. After creation, this + ///password is required to unlock the daemon. When using REST, this field + ///must be encoded as base64. + var walletPassword: Data = SwiftProtobuf.Internal.emptyData + + /// + ///cipher_seed_mnemonic is a 24-word mnemonic that encodes a prior aezeed + ///cipher seed obtained by the user. This may have been generated by the + ///GenSeed method, or be an existing seed. + var cipherSeedMnemonic: [String] = [] + + /// + ///aezeed_passphrase is an optional user provided passphrase that will be used + ///to encrypt the generated aezeed cipher seed. When using REST, this field + ///must be encoded as base64. + var aezeedPassphrase: Data = SwiftProtobuf.Internal.emptyData + + /// + ///recovery_window is an optional argument specifying the address lookahead + ///when restoring a wallet seed. The recovery window applies to each + ///individual branch of the BIP44 derivation paths. Supplying a recovery + ///window of zero indicates that no addresses should be recovered, such after + ///the first initialization of the wallet. + var recoveryWindow: Int32 = 0 + + /// + ///channel_backups is an optional argument that allows clients to recover the + ///settled funds within a set of channels. This should be populated if the + ///user was unable to close out all channels and sweep funds before partial or + ///total data loss occurred. If specified, then after on-chain recovery of + ///funds, lnd begin to carry out the data loss recovery protocol in order to + ///recover the funds in each channel from a remote force closed transaction. + var channelBackups: Lnrpc_ChanBackupSnapshot { + get {return _channelBackups ?? Lnrpc_ChanBackupSnapshot()} + set {_channelBackups = newValue} + } + /// Returns true if `channelBackups` has been explicitly set. + var hasChannelBackups: Bool {return self._channelBackups != nil} + /// Clears the value of `channelBackups`. Subsequent reads from it will return its default value. + mutating func clearChannelBackups() {self._channelBackups = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _channelBackups: Lnrpc_ChanBackupSnapshot? = nil +} + +struct Lnrpc_InitWalletResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_UnlockWalletRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///wallet_password should be the current valid passphrase for the daemon. This + ///will be required to decrypt on-disk material that the daemon requires to + ///function properly. When using REST, this field must be encoded as base64. + var walletPassword: Data = SwiftProtobuf.Internal.emptyData + + /// + ///recovery_window is an optional argument specifying the address lookahead + ///when restoring a wallet seed. The recovery window applies to each + ///individual branch of the BIP44 derivation paths. Supplying a recovery + ///window of zero indicates that no addresses should be recovered, such after + ///the first initialization of the wallet. + var recoveryWindow: Int32 = 0 + + /// + ///channel_backups is an optional argument that allows clients to recover the + ///settled funds within a set of channels. This should be populated if the + ///user was unable to close out all channels and sweep funds before partial or + ///total data loss occurred. If specified, then after on-chain recovery of + ///funds, lnd begin to carry out the data loss recovery protocol in order to + ///recover the funds in each channel from a remote force closed transaction. + var channelBackups: Lnrpc_ChanBackupSnapshot { + get {return _channelBackups ?? Lnrpc_ChanBackupSnapshot()} + set {_channelBackups = newValue} + } + /// Returns true if `channelBackups` has been explicitly set. + var hasChannelBackups: Bool {return self._channelBackups != nil} + /// Clears the value of `channelBackups`. Subsequent reads from it will return its default value. + mutating func clearChannelBackups() {self._channelBackups = nil} + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} + + fileprivate var _channelBackups: Lnrpc_ChanBackupSnapshot? = nil +} + +struct Lnrpc_UnlockWalletResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_ChangePasswordRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///current_password should be the current valid passphrase used to unlock the + ///daemon. When using REST, this field must be encoded as base64. + var currentPassword: Data = SwiftProtobuf.Internal.emptyData + + /// + ///new_password should be the new passphrase that will be needed to unlock the + ///daemon. When using REST, this field must be encoded as base64. + var newPassword: Data = SwiftProtobuf.Internal.emptyData + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Lnrpc_ChangePasswordResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "lnrpc" + +extension Lnrpc_GenSeedRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".GenSeedRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "aezeed_passphrase"), + 2: .standard(proto: "seed_entropy"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.aezeedPassphrase) + case 2: try decoder.decodeSingularBytesField(value: &self.seedEntropy) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.aezeedPassphrase.isEmpty { + try visitor.visitSingularBytesField(value: self.aezeedPassphrase, fieldNumber: 1) + } + if !self.seedEntropy.isEmpty { + try visitor.visitSingularBytesField(value: self.seedEntropy, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_GenSeedRequest, rhs: Lnrpc_GenSeedRequest) -> Bool { + if lhs.aezeedPassphrase != rhs.aezeedPassphrase {return false} + if lhs.seedEntropy != rhs.seedEntropy {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_GenSeedResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".GenSeedResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "cipher_seed_mnemonic"), + 2: .standard(proto: "enciphered_seed"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedStringField(value: &self.cipherSeedMnemonic) + case 2: try decoder.decodeSingularBytesField(value: &self.encipheredSeed) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.cipherSeedMnemonic.isEmpty { + try visitor.visitRepeatedStringField(value: self.cipherSeedMnemonic, fieldNumber: 1) + } + if !self.encipheredSeed.isEmpty { + try visitor.visitSingularBytesField(value: self.encipheredSeed, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_GenSeedResponse, rhs: Lnrpc_GenSeedResponse) -> Bool { + if lhs.cipherSeedMnemonic != rhs.cipherSeedMnemonic {return false} + if lhs.encipheredSeed != rhs.encipheredSeed {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_InitWalletRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".InitWalletRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "wallet_password"), + 2: .standard(proto: "cipher_seed_mnemonic"), + 3: .standard(proto: "aezeed_passphrase"), + 4: .standard(proto: "recovery_window"), + 5: .standard(proto: "channel_backups"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.walletPassword) + case 2: try decoder.decodeRepeatedStringField(value: &self.cipherSeedMnemonic) + case 3: try decoder.decodeSingularBytesField(value: &self.aezeedPassphrase) + case 4: try decoder.decodeSingularInt32Field(value: &self.recoveryWindow) + case 5: try decoder.decodeSingularMessageField(value: &self._channelBackups) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.walletPassword.isEmpty { + try visitor.visitSingularBytesField(value: self.walletPassword, fieldNumber: 1) + } + if !self.cipherSeedMnemonic.isEmpty { + try visitor.visitRepeatedStringField(value: self.cipherSeedMnemonic, fieldNumber: 2) + } + if !self.aezeedPassphrase.isEmpty { + try visitor.visitSingularBytesField(value: self.aezeedPassphrase, fieldNumber: 3) + } + if self.recoveryWindow != 0 { + try visitor.visitSingularInt32Field(value: self.recoveryWindow, fieldNumber: 4) + } + if let v = self._channelBackups { + try visitor.visitSingularMessageField(value: v, fieldNumber: 5) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_InitWalletRequest, rhs: Lnrpc_InitWalletRequest) -> Bool { + if lhs.walletPassword != rhs.walletPassword {return false} + if lhs.cipherSeedMnemonic != rhs.cipherSeedMnemonic {return false} + if lhs.aezeedPassphrase != rhs.aezeedPassphrase {return false} + if lhs.recoveryWindow != rhs.recoveryWindow {return false} + if lhs._channelBackups != rhs._channelBackups {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_InitWalletResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".InitWalletResponse" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_InitWalletResponse, rhs: Lnrpc_InitWalletResponse) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_UnlockWalletRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".UnlockWalletRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "wallet_password"), + 2: .standard(proto: "recovery_window"), + 3: .standard(proto: "channel_backups"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.walletPassword) + case 2: try decoder.decodeSingularInt32Field(value: &self.recoveryWindow) + case 3: try decoder.decodeSingularMessageField(value: &self._channelBackups) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.walletPassword.isEmpty { + try visitor.visitSingularBytesField(value: self.walletPassword, fieldNumber: 1) + } + if self.recoveryWindow != 0 { + try visitor.visitSingularInt32Field(value: self.recoveryWindow, fieldNumber: 2) + } + if let v = self._channelBackups { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_UnlockWalletRequest, rhs: Lnrpc_UnlockWalletRequest) -> Bool { + if lhs.walletPassword != rhs.walletPassword {return false} + if lhs.recoveryWindow != rhs.recoveryWindow {return false} + if lhs._channelBackups != rhs._channelBackups {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_UnlockWalletResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".UnlockWalletResponse" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_UnlockWalletResponse, rhs: Lnrpc_UnlockWalletResponse) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ChangePasswordRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ChangePasswordRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "current_password"), + 2: .standard(proto: "new_password"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.currentPassword) + case 2: try decoder.decodeSingularBytesField(value: &self.newPassword) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.currentPassword.isEmpty { + try visitor.visitSingularBytesField(value: self.currentPassword, fieldNumber: 1) + } + if !self.newPassword.isEmpty { + try visitor.visitSingularBytesField(value: self.newPassword, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ChangePasswordRequest, rhs: Lnrpc_ChangePasswordRequest) -> Bool { + if lhs.currentPassword != rhs.currentPassword {return false} + if lhs.newPassword != rhs.newPassword {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Lnrpc_ChangePasswordResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ChangePasswordResponse" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Lnrpc_ChangePasswordResponse, rhs: Lnrpc_ChangePasswordResponse) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/wallet/Lightning/rpc/watchtowerrpc/watchtower.pb.swift b/wallet/Lightning/rpc/watchtowerrpc/watchtower.pb.swift new file mode 100644 index 0000000..ee7cf5b --- /dev/null +++ b/wallet/Lightning/rpc/watchtowerrpc/watchtower.pb.swift @@ -0,0 +1,114 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: watchtowerrpc/watchtower.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +import Foundation +import SwiftProtobuf + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +struct Watchtowerrpc_GetInfoRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Watchtowerrpc_GetInfoResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The public key of the watchtower. + var pubkey: Data = SwiftProtobuf.Internal.emptyData + + /// The listening addresses of the watchtower. + var listeners: [String] = [] + + /// The URIs of the watchtower. + var uris: [String] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "watchtowerrpc" + +extension Watchtowerrpc_GetInfoRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".GetInfoRequest" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Watchtowerrpc_GetInfoRequest, rhs: Watchtowerrpc_GetInfoRequest) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Watchtowerrpc_GetInfoResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".GetInfoResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "pubkey"), + 2: .same(proto: "listeners"), + 3: .same(proto: "uris"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.pubkey) + case 2: try decoder.decodeRepeatedStringField(value: &self.listeners) + case 3: try decoder.decodeRepeatedStringField(value: &self.uris) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.pubkey.isEmpty { + try visitor.visitSingularBytesField(value: self.pubkey, fieldNumber: 1) + } + if !self.listeners.isEmpty { + try visitor.visitRepeatedStringField(value: self.listeners, fieldNumber: 2) + } + if !self.uris.isEmpty { + try visitor.visitRepeatedStringField(value: self.uris, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Watchtowerrpc_GetInfoResponse, rhs: Watchtowerrpc_GetInfoResponse) -> Bool { + if lhs.pubkey != rhs.pubkey {return false} + if lhs.listeners != rhs.listeners {return false} + if lhs.uris != rhs.uris {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/wallet/Lightning/rpc/wtclientrpc/wtclient.pb.swift b/wallet/Lightning/rpc/wtclientrpc/wtclient.pb.swift new file mode 100644 index 0000000..afc195d --- /dev/null +++ b/wallet/Lightning/rpc/wtclientrpc/wtclient.pb.swift @@ -0,0 +1,673 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: wtclientrpc/wtclient.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +import Foundation +import SwiftProtobuf + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +struct Wtclientrpc_AddTowerRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The identifying public key of the watchtower to add. + var pubkey: Data = SwiftProtobuf.Internal.emptyData + + /// A network address the watchtower is reachable over. + var address: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Wtclientrpc_AddTowerResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Wtclientrpc_RemoveTowerRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The identifying public key of the watchtower to remove. + var pubkey: Data = SwiftProtobuf.Internal.emptyData + + /// + ///If set, then the record for this address will be removed, indicating that is + ///is stale. Otherwise, the watchtower will no longer be used for future + ///session negotiations and backups. + var address: String = String() + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Wtclientrpc_RemoveTowerResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Wtclientrpc_GetTowerInfoRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The identifying public key of the watchtower to retrieve information for. + var pubkey: Data = SwiftProtobuf.Internal.emptyData + + /// Whether we should include sessions with the watchtower in the response. + var includeSessions: Bool = false + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Wtclientrpc_TowerSession { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The total number of successful backups that have been made to the + ///watchtower session. + var numBackups: UInt32 = 0 + + /// + ///The total number of backups in the session that are currently pending to be + ///acknowledged by the watchtower. + var numPendingBackups: UInt32 = 0 + + /// The maximum number of backups allowed by the watchtower session. + var maxBackups: UInt32 = 0 + + /// + ///The fee rate, in satoshis per vbyte, that will be used by the watchtower for + ///the justice transaction in the event of a channel breach. + var sweepSatPerByte: UInt32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Wtclientrpc_Tower { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The identifying public key of the watchtower. + var pubkey: Data = SwiftProtobuf.Internal.emptyData + + /// The list of addresses the watchtower is reachable over. + var addresses: [String] = [] + + /// Whether the watchtower is currently a candidate for new sessions. + var activeSessionCandidate: Bool = false + + /// The number of sessions that have been negotiated with the watchtower. + var numSessions: UInt32 = 0 + + /// The list of sessions that have been negotiated with the watchtower. + var sessions: [Wtclientrpc_TowerSession] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Wtclientrpc_ListTowersRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// Whether we should include sessions with the watchtower in the response. + var includeSessions: Bool = false + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Wtclientrpc_ListTowersResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// The list of watchtowers available for new backups. + var towers: [Wtclientrpc_Tower] = [] + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Wtclientrpc_StatsRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Wtclientrpc_StatsResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The total number of backups made to all active and exhausted watchtower + ///sessions. + var numBackups: UInt32 = 0 + + /// + ///The total number of backups that are pending to be acknowledged by all + ///active and exhausted watchtower sessions. + var numPendingBackups: UInt32 = 0 + + /// + ///The total number of backups that all active and exhausted watchtower + ///sessions have failed to acknowledge. + var numFailedBackups: UInt32 = 0 + + /// The total number of new sessions made to watchtowers. + var numSessionsAcquired: UInt32 = 0 + + /// The total number of watchtower sessions that have been exhausted. + var numSessionsExhausted: UInt32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Wtclientrpc_PolicyRequest { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +struct Wtclientrpc_PolicyResponse { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + /// + ///The maximum number of updates each session we negotiate with watchtowers + ///should allow. + var maxUpdates: UInt32 = 0 + + /// + ///The fee rate, in satoshis per vbyte, that will be used by watchtowers for + ///justice transactions in response to channel breaches. + var sweepSatPerByte: UInt32 = 0 + + var unknownFields = SwiftProtobuf.UnknownStorage() + + init() {} +} + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "wtclientrpc" + +extension Wtclientrpc_AddTowerRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".AddTowerRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "pubkey"), + 2: .same(proto: "address"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.pubkey) + case 2: try decoder.decodeSingularStringField(value: &self.address) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.pubkey.isEmpty { + try visitor.visitSingularBytesField(value: self.pubkey, fieldNumber: 1) + } + if !self.address.isEmpty { + try visitor.visitSingularStringField(value: self.address, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Wtclientrpc_AddTowerRequest, rhs: Wtclientrpc_AddTowerRequest) -> Bool { + if lhs.pubkey != rhs.pubkey {return false} + if lhs.address != rhs.address {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Wtclientrpc_AddTowerResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".AddTowerResponse" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Wtclientrpc_AddTowerResponse, rhs: Wtclientrpc_AddTowerResponse) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Wtclientrpc_RemoveTowerRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".RemoveTowerRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "pubkey"), + 2: .same(proto: "address"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.pubkey) + case 2: try decoder.decodeSingularStringField(value: &self.address) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.pubkey.isEmpty { + try visitor.visitSingularBytesField(value: self.pubkey, fieldNumber: 1) + } + if !self.address.isEmpty { + try visitor.visitSingularStringField(value: self.address, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Wtclientrpc_RemoveTowerRequest, rhs: Wtclientrpc_RemoveTowerRequest) -> Bool { + if lhs.pubkey != rhs.pubkey {return false} + if lhs.address != rhs.address {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Wtclientrpc_RemoveTowerResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".RemoveTowerResponse" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Wtclientrpc_RemoveTowerResponse, rhs: Wtclientrpc_RemoveTowerResponse) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Wtclientrpc_GetTowerInfoRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".GetTowerInfoRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "pubkey"), + 2: .standard(proto: "include_sessions"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.pubkey) + case 2: try decoder.decodeSingularBoolField(value: &self.includeSessions) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.pubkey.isEmpty { + try visitor.visitSingularBytesField(value: self.pubkey, fieldNumber: 1) + } + if self.includeSessions != false { + try visitor.visitSingularBoolField(value: self.includeSessions, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Wtclientrpc_GetTowerInfoRequest, rhs: Wtclientrpc_GetTowerInfoRequest) -> Bool { + if lhs.pubkey != rhs.pubkey {return false} + if lhs.includeSessions != rhs.includeSessions {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Wtclientrpc_TowerSession: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".TowerSession" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "num_backups"), + 2: .standard(proto: "num_pending_backups"), + 3: .standard(proto: "max_backups"), + 4: .standard(proto: "sweep_sat_per_byte"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt32Field(value: &self.numBackups) + case 2: try decoder.decodeSingularUInt32Field(value: &self.numPendingBackups) + case 3: try decoder.decodeSingularUInt32Field(value: &self.maxBackups) + case 4: try decoder.decodeSingularUInt32Field(value: &self.sweepSatPerByte) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.numBackups != 0 { + try visitor.visitSingularUInt32Field(value: self.numBackups, fieldNumber: 1) + } + if self.numPendingBackups != 0 { + try visitor.visitSingularUInt32Field(value: self.numPendingBackups, fieldNumber: 2) + } + if self.maxBackups != 0 { + try visitor.visitSingularUInt32Field(value: self.maxBackups, fieldNumber: 3) + } + if self.sweepSatPerByte != 0 { + try visitor.visitSingularUInt32Field(value: self.sweepSatPerByte, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Wtclientrpc_TowerSession, rhs: Wtclientrpc_TowerSession) -> Bool { + if lhs.numBackups != rhs.numBackups {return false} + if lhs.numPendingBackups != rhs.numPendingBackups {return false} + if lhs.maxBackups != rhs.maxBackups {return false} + if lhs.sweepSatPerByte != rhs.sweepSatPerByte {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Wtclientrpc_Tower: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".Tower" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "pubkey"), + 2: .same(proto: "addresses"), + 3: .standard(proto: "active_session_candidate"), + 4: .standard(proto: "num_sessions"), + 5: .same(proto: "sessions"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBytesField(value: &self.pubkey) + case 2: try decoder.decodeRepeatedStringField(value: &self.addresses) + case 3: try decoder.decodeSingularBoolField(value: &self.activeSessionCandidate) + case 4: try decoder.decodeSingularUInt32Field(value: &self.numSessions) + case 5: try decoder.decodeRepeatedMessageField(value: &self.sessions) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.pubkey.isEmpty { + try visitor.visitSingularBytesField(value: self.pubkey, fieldNumber: 1) + } + if !self.addresses.isEmpty { + try visitor.visitRepeatedStringField(value: self.addresses, fieldNumber: 2) + } + if self.activeSessionCandidate != false { + try visitor.visitSingularBoolField(value: self.activeSessionCandidate, fieldNumber: 3) + } + if self.numSessions != 0 { + try visitor.visitSingularUInt32Field(value: self.numSessions, fieldNumber: 4) + } + if !self.sessions.isEmpty { + try visitor.visitRepeatedMessageField(value: self.sessions, fieldNumber: 5) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Wtclientrpc_Tower, rhs: Wtclientrpc_Tower) -> Bool { + if lhs.pubkey != rhs.pubkey {return false} + if lhs.addresses != rhs.addresses {return false} + if lhs.activeSessionCandidate != rhs.activeSessionCandidate {return false} + if lhs.numSessions != rhs.numSessions {return false} + if lhs.sessions != rhs.sessions {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Wtclientrpc_ListTowersRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ListTowersRequest" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "include_sessions"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularBoolField(value: &self.includeSessions) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.includeSessions != false { + try visitor.visitSingularBoolField(value: self.includeSessions, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Wtclientrpc_ListTowersRequest, rhs: Wtclientrpc_ListTowersRequest) -> Bool { + if lhs.includeSessions != rhs.includeSessions {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Wtclientrpc_ListTowersResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".ListTowersResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "towers"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeRepeatedMessageField(value: &self.towers) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if !self.towers.isEmpty { + try visitor.visitRepeatedMessageField(value: self.towers, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Wtclientrpc_ListTowersResponse, rhs: Wtclientrpc_ListTowersResponse) -> Bool { + if lhs.towers != rhs.towers {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Wtclientrpc_StatsRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".StatsRequest" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Wtclientrpc_StatsRequest, rhs: Wtclientrpc_StatsRequest) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Wtclientrpc_StatsResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".StatsResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "num_backups"), + 2: .standard(proto: "num_pending_backups"), + 3: .standard(proto: "num_failed_backups"), + 4: .standard(proto: "num_sessions_acquired"), + 5: .standard(proto: "num_sessions_exhausted"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt32Field(value: &self.numBackups) + case 2: try decoder.decodeSingularUInt32Field(value: &self.numPendingBackups) + case 3: try decoder.decodeSingularUInt32Field(value: &self.numFailedBackups) + case 4: try decoder.decodeSingularUInt32Field(value: &self.numSessionsAcquired) + case 5: try decoder.decodeSingularUInt32Field(value: &self.numSessionsExhausted) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.numBackups != 0 { + try visitor.visitSingularUInt32Field(value: self.numBackups, fieldNumber: 1) + } + if self.numPendingBackups != 0 { + try visitor.visitSingularUInt32Field(value: self.numPendingBackups, fieldNumber: 2) + } + if self.numFailedBackups != 0 { + try visitor.visitSingularUInt32Field(value: self.numFailedBackups, fieldNumber: 3) + } + if self.numSessionsAcquired != 0 { + try visitor.visitSingularUInt32Field(value: self.numSessionsAcquired, fieldNumber: 4) + } + if self.numSessionsExhausted != 0 { + try visitor.visitSingularUInt32Field(value: self.numSessionsExhausted, fieldNumber: 5) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Wtclientrpc_StatsResponse, rhs: Wtclientrpc_StatsResponse) -> Bool { + if lhs.numBackups != rhs.numBackups {return false} + if lhs.numPendingBackups != rhs.numPendingBackups {return false} + if lhs.numFailedBackups != rhs.numFailedBackups {return false} + if lhs.numSessionsAcquired != rhs.numSessionsAcquired {return false} + if lhs.numSessionsExhausted != rhs.numSessionsExhausted {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Wtclientrpc_PolicyRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".PolicyRequest" + static let _protobuf_nameMap = SwiftProtobuf._NameMap() + + mutating func decodeMessage(decoder: inout D) throws { + while let _ = try decoder.nextFieldNumber() { + } + } + + func traverse(visitor: inout V) throws { + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Wtclientrpc_PolicyRequest, rhs: Wtclientrpc_PolicyRequest) -> Bool { + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Wtclientrpc_PolicyResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + static let protoMessageName: String = _protobuf_package + ".PolicyResponse" + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "max_updates"), + 2: .standard(proto: "sweep_sat_per_byte"), + ] + + mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + switch fieldNumber { + case 1: try decoder.decodeSingularUInt32Field(value: &self.maxUpdates) + case 2: try decoder.decodeSingularUInt32Field(value: &self.sweepSatPerByte) + default: break + } + } + } + + func traverse(visitor: inout V) throws { + if self.maxUpdates != 0 { + try visitor.visitSingularUInt32Field(value: self.maxUpdates, fieldNumber: 1) + } + if self.sweepSatPerByte != 0 { + try visitor.visitSingularUInt32Field(value: self.sweepSatPerByte, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + static func ==(lhs: Wtclientrpc_PolicyResponse, rhs: Wtclientrpc_PolicyResponse) -> Bool { + if lhs.maxUpdates != rhs.maxUpdates {return false} + if lhs.sweepSatPerByte != rhs.sweepSatPerByte {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/wallet/Main.storyboard b/wallet/Main.storyboard new file mode 100644 index 0000000..93de733 --- /dev/null +++ b/wallet/Main.storyboard @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wallet/Repository/ExampleRepository.swift b/wallet/Repository/ExampleRepository.swift new file mode 100644 index 0000000..4848cc9 --- /dev/null +++ b/wallet/Repository/ExampleRepository.swift @@ -0,0 +1,20 @@ +// +// ExampleRepository.swift +// wallet +// +// Created by Jason on 8/23/20. +// Copyright © 2020 Jason. All rights reserved. +// + +import Foundation + +class ExampleRepository { + + // Perform fake request + func getRandomInt(onSuccess: @escaping (Int) -> Void, onFailure: @escaping (Error) -> Void) { + DispatchQueue.main.asyncAfter(deadline: .now() + 2) { + onSuccess(Int.random(in: 1..<100)) + } + } + +} diff --git a/wallet/Repository/LightningRepository.swift b/wallet/Repository/LightningRepository.swift new file mode 100644 index 0000000..b8adc3a --- /dev/null +++ b/wallet/Repository/LightningRepository.swift @@ -0,0 +1,310 @@ +// +// LightningRepository.swift +// wallet +// +// Created by Jason on 8/30/20. +// Copyright © 2020 Jason. All rights reserved. +// + +import Foundation + +class LightningRepository { + + func createWallet(password: String, onSuccess: @escaping ([String]) -> Void, onFailure: @escaping (Error?) -> Void) { + Lightning.shared.generateSeed { [weak self] (seed, error) in + guard let self = self else { return } + + guard error == nil else { + onFailure(error) + return + } + + Lightning.shared.createWallet(password: password, cipherSeedMnemonic: seed) { [weak self] (error) in + guard self != nil else { return } + + guard error == nil else { + onFailure(error) + return + } + + onSuccess(seed) + } + } + } + func closeChannel(channel:Lnrpc_Channel, onSuccess: @escaping (Lnrpc_ClosedChannelsResponse) -> Void, onFailure: @escaping (Error?) -> Void) { + Lightning.shared.closeChannel(channel: channel) { response, error in + guard error == nil else { + onFailure(error) + return + } + debugPrint("👍🏻👍🏻👍🏻👍🏻👍🏻👍🏻👍🏻 Close Channel error ", response) + onSuccess(response) + } + } + func openChannel(localFunding: Int64, pushSat: Int64, host: String, port: UInt, nodePubKey: NodePublicKey, closeAddress: String?, onSuccess: @escaping (String) -> Void, onFailure: @escaping (Error?) -> Void) { + + Lightning.shared.connectToNode(nodePubkey: nodePubKey, hostAddress: host, hostPort: port) { [weak self] (response, error) in + if error != nil && error?.localizedDescription.contains("already connected to peer") == false { + debugPrint("🔆🔆🔆🔆🔆 Connect to node error ", error) + onFailure(error) + return + } + + onSuccess("Connected to peer") + + Lightning.shared.openChannel(localFundingAmount: localFunding, pushSat: pushSat, closeAddress: closeAddress, nodePubkey: nodePubKey) { (response, error) in + guard error == nil else { + debugPrint("❤️❤️❤️❤️❤️❤️❤️ Open Channel error ", error) + onFailure(error) + return + } + + guard let update = response.update else { + return + } + + switch update { + case .chanPending(let pendingUpdate): + onSuccess("Channel open pending update\nTXID: \(pendingUpdate.txid.base64EncodedString())") + case .chanOpen(let openUpdate): + onSuccess("Channel open success update") + case .psbtFund(let onpsbtFund): + onSuccess("I don't know why you would get this error") + } + } + } + } + + func listChannels(onSuccess: @escaping (Lnrpc_ListChannelsResponse) -> Void, onFailure: @escaping (Error?) -> Void) { + + Lightning.shared.listChannels { (response, error) in + guard error == nil else { + onFailure(error) + return + } + debugPrint("👍🏻👍🏻👍🏻👍🏻👍🏻👍🏻👍🏻 List Channel error ", response) + onSuccess(response) + } + } + func listClosedChannels(onSuccess: @escaping (Lnrpc_ClosedChannelsResponse) -> Void, onFailure: @escaping (Error?) -> Void) { + + Lightning.shared.listClosedChannels { (response, error) in + guard error == nil else { + onFailure(error) + return + } + debugPrint("👍🏻👍🏻👍🏻👍🏻👍🏻👍🏻👍🏻 List Channel error ", response) + onSuccess(response) + } + } + func listPendingChannels(onSuccess: @escaping (Lnrpc_PendingChannelsResponse) -> Void, onFailure: @escaping (Error?) -> Void) { + + Lightning.shared.listPendingChannels { (response, error) in + guard error == nil else { + onFailure(error) + return + } + debugPrint("👍🏻👍🏻👍🏻👍🏻👍🏻👍🏻👍🏻 List Pending Channel error ", response) + onSuccess(response) + } + } + func getChannelInfo(id: UInt64, onSuccess: @escaping (Lnrpc_ChannelEdge) -> Void, onFailure: @escaping (Error?) -> Void) { + + Lightning.shared.getChanInfo(id: id) { (response, error) in + guard error == nil else { + onFailure(error) + return + } + debugPrint("👍🏻👍🏻👍🏻👍🏻👍🏻👍🏻👍🏻 Get Channel info error ", response) + onSuccess(response) + } + } + func listPeers(onSuccess: @escaping (Lnrpc_ListPeersResponse) -> Void, onFailure: @escaping (Error?) -> Void) { + Lightning.shared.listPeers { [weak self] (response, error) in + if error != nil && error?.localizedDescription.contains("already connected to peer") == false { + onFailure(error) + return + } + debugPrint("Listing peers ", response) + onSuccess(response) + } + } + func listInvoices(onSuccess: @escaping (Lnrpc_ListInvoiceResponse) -> Void, onFailure: @escaping (Error?) -> Void) { + + Lightning.shared.listInvoices { (response, error) in + guard error == nil else { + onFailure(error) + return + } + debugPrint("👍🏻👍🏻👍🏻👍🏻👍🏻👍🏻👍🏻 List Invoices error ", response) + for payment in response.invoices{ + Lightning.shared.queryRequestFee(key: payment.fallbackAddr) { responseQuery, error in + debugPrint("Query request fee", responseQuery, error) + } + } + onSuccess(response) + } + } + func listPayments(onSuccess: @escaping (Lnrpc_ListPaymentsResponse) -> Void, onFailure: @escaping (Error?) -> Void) { + + Lightning.shared.listPayments { (response, error) in + guard error == nil else { + onFailure(error) + return + } + debugPrint("👍🏻👍🏻👍🏻👍🏻👍🏻👍🏻👍🏻 List Payments error ", response) + onSuccess(response) + } + } + func wipeWallet(onSuccess: @escaping () -> Void, onFailure: @escaping (Error?) -> Void) { + Lightning.shared.stop { (error) in + + guard error == nil else { + onFailure(error) + return + } + + Lightning.shared.purge() + onSuccess() + + } + } + + func getWalletBalance(onSuccess: @escaping (_ total: Int64, _ confirmed: Int64, _ unconfirmed: Int64) -> Void, onFailure: @escaping (Error?) -> Void) { + Lightning.shared.walletBalance { [weak self] (balanceResponse, error) in + guard self != nil else { return } + + guard error == nil else { + onFailure(error) + return + } + + onSuccess( + balanceResponse.totalBalance, + balanceResponse.confirmedBalance, + balanceResponse.unconfirmedBalance + ) + } + } + + func getNewAddress(onSuccess: @escaping (String) -> Void, onFailure: @escaping (Error?) -> Void) { + Lightning.shared.newAddress { [weak self] (address, error) in + guard self != nil else { return } + + guard error == nil else { + onFailure(error) + return + } + + onSuccess(address) + } + } + + func getInfo(onSuccess: @escaping (Lnrpc_GetInfoResponse) -> Void, onFailure: @escaping (Error?) -> Void) { + Lightning.shared.info { [weak self] (info, error) in + guard self != nil else { return } + + guard error == nil else { + onFailure(error) + return + } + + onSuccess(info) + } + } + + func unlockWallet(password: String, onSuccess: @escaping () -> Void, onFailure: @escaping (Error?) -> Void) { + Lightning.shared.unlockWalet(password: password) { [weak self] (error) in + guard self != nil else { return } + + guard error == nil else { + onFailure(error) + return + } + + onSuccess() + } + } + func createInvoice(amount: Int, memo: String, onSuccess: @escaping (Lnrpc_AddInvoiceResponse) -> Void, onFailure: @escaping (Error?) -> Void) { + Lightning.shared.createPayRequest(amount: amount, memo: memo) { [weak self] (response, error) in + guard self != nil else { return } + + guard error == nil else { + onFailure(error) + return + } + + onSuccess(response) + } + } + func getPaymentInfo(paymentRequest: String, onSuccess: @escaping (Lnrpc_PayReq) -> Void, onFailure: @escaping (Error?) -> Void) { + Lightning.shared.decodePaymentRequest(paymentRequest) { [weak self] (decodedResponse, error) in + debugPrint("Decoded response", decodedResponse) + guard self != nil else { return } + + guard error == nil else { + onFailure(error) + return + } + onSuccess(decodedResponse) + } + } + + func getLightningChannelBalance(onSuccess: @escaping (_ balance: Lnrpc_ChannelBalanceResponse) -> Void, onFailure: @escaping (Error?) -> Void) { + Lightning.shared.lightningChannelBalance { [weak self] (balanceResponse, error) in + guard self != nil else { return } + + guard error == nil else { + onFailure(error) + return + } + + onSuccess(balanceResponse) + } + } + func estimateFee(address: String, amount: Int64, onSuccess: @escaping (Lnrpc_EstimateFeeResponse) -> Void, onFailure: @escaping (Error?) -> Void) { + Lightning.shared.estimateFee(address, amount: amount) { response, error in + guard error == nil else { + onFailure(error) + return + } + debugPrint("Estimate fee response",response) + onSuccess(response) + } + } + func feeReport(onSuccess: @escaping (Lnrpc_FeeReportResponse) -> Void, onFailure: @escaping (Error?) -> Void) { + Lightning.shared.feeReport(){ response, error in + guard error == nil else { + onFailure(error) + return + } + debugPrint("Fee Report fee response",response) + onSuccess(response) + } + } + func pay(paymentRequest: String, onSuccess: @escaping (Lnrpc_SendResponse) -> Void, onFailure: @escaping (Error?) -> Void) { + Lightning.shared.decodePaymentRequest(paymentRequest) { [weak self] (decodedResponse, error) in + debugPrint("Decoded response", decodedResponse) + guard self != nil else { return } + + guard error == nil else { + onFailure(error) + return + } + + //Requst decoded succesfully so can be used to make the payment + Lightning.shared.payRequest(paymentRequest) { [weak self] (sendResponse, error) in + guard self != nil else { return } + + guard error == nil else { + onFailure(error) + return + } + + onSuccess(sendResponse) + + } + } + } + +} diff --git a/wallet/SceneDelegate.swift b/wallet/SceneDelegate.swift new file mode 100644 index 0000000..deda06c --- /dev/null +++ b/wallet/SceneDelegate.swift @@ -0,0 +1,82 @@ +// +// SceneDelegate.swift +// wallet +// +// Created by Jason on 8/12/20. +// Copyright © 2020 Jason. All rights reserved. +// + +import UIKit + +class SceneDelegate: UIResponder, UIWindowSceneDelegate { + + var window: UIWindow? + + + func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { + // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. + // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. + // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). + + if let windowScene = scene as? UIWindowScene { + let window = UIWindow(windowScene: windowScene) + + let navigationController = UINavigationController(rootViewController: HomeVC()) + window.rootViewController = navigationController + self.window = window + window.makeKeyAndVisible() + + + } + } + + func sceneDidDisconnect(_ scene: UIScene) { + // Called as the scene is being released by the system. + // This occurs shortly after the scene enters the background, or when its session is discarded. + // Release any resources associated with this scene that can be re-created the next time the scene connects. + // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead). + } + + func sceneDidBecomeActive(_ scene: UIScene) { + // Called when the scene has moved from an inactive state to an active state. + // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. + } + + func sceneWillResignActive(_ scene: UIScene) { + // Called when the scene will move from an active state to an inactive state. + // This may occur due to temporary interruptions (ex. an incoming phone call). + } + + func sceneWillEnterForeground(_ scene: UIScene) { + // Called as the scene transitions from the background to the foreground. + // Use this method to undo the changes made on entering the background. + guard !Settings.isUnitTest else { + return + } + + Lightning.shared.start({ (error) in + guard error == nil else { + return print("LND start error") + } + }) { (error) in + guard error == nil else { + return print("RPC startup error") + } + } + } + + func sceneDidEnterBackground(_ scene: UIScene) { + // Called as the scene transitions from the foreground to the background. + // Use this method to save data, release shared resources, and store enough scene-specific state information + // to restore the scene back to its current state. + + Lightning.shared.stop { (error) in + guard error == nil else { + return print("LND stop error") + } + + print("LND stopped") + } + } +} + diff --git a/wallet/Utils/Colors.swift b/wallet/Utils/Colors.swift new file mode 100644 index 0000000..802d8d8 --- /dev/null +++ b/wallet/Utils/Colors.swift @@ -0,0 +1,19 @@ +// +// Colors.swift +// wallet +// +// Created by Jason on 8/20/20. +// Copyright © 2020 Jason. All rights reserved. +// + +import UIKit + +extension UIColor { + + public static let yellow500 = #colorLiteral(red: 1, green: 0.9176470588, blue: 0, alpha: 1) + public static let yellow600 = #colorLiteral(red: 0.9294117647, green: 0.8549019608, blue: 0.03137254902, alpha: 1) + public static let purple500 = #colorLiteral(red: 0.6156862745, green: 0.2352941176, blue: 1, alpha: 1) + public static let gray900 = #colorLiteral(red: 0.07058823529, green: 0.07058823529, blue: 0.07058823529, alpha: 1) + public static let white500 = #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1) + +} diff --git a/wallet/Utils/Dimens.swift b/wallet/Utils/Dimens.swift new file mode 100644 index 0000000..cce7b91 --- /dev/null +++ b/wallet/Utils/Dimens.swift @@ -0,0 +1,23 @@ +// +// Dimens.swift +// wallet +// +// Created by Jason on 8/27/20. +// Copyright © 2020 Jason. All rights reserved. +// + +import Foundation + +struct Dimens { + + public static let tall = 72 + public static let button = 56 + public static let bar = 88 + public static let minButtonWidth = 140 + public static let chip = 44 + public static let titleText = 20 + public static let normalText = 16 + public static let mediumMargin = 16 + public static let shadow = 2 + +} diff --git a/wallet/Utils/Extensions/Date.swift b/wallet/Utils/Extensions/Date.swift new file mode 100644 index 0000000..086e021 --- /dev/null +++ b/wallet/Utils/Extensions/Date.swift @@ -0,0 +1,24 @@ +// +// Date.swift +// wallet +// +// Created by Adriana Epure on 24.08.2022. +// Copyright © 2022 Jason. All rights reserved. +// + +import Foundation +extension Date{ + func adding(minutes: Int) -> Date { + return Calendar.current.date(byAdding: .minute, value: minutes, to: self)! + } + func adding(seconds: Int) -> Date { + return Calendar.current.date(byAdding: .second, value: seconds, to: self)! + } + func format(style: DateFormatter.Style)->String{ + + let utcDateFormatter = DateFormatter() + utcDateFormatter.dateStyle = style + utcDateFormatter.timeStyle = style + return utcDateFormatter.string(from: self) + } +} diff --git a/wallet/Utils/Extensions/Int64.swift b/wallet/Utils/Extensions/Int64.swift new file mode 100644 index 0000000..b21f4d8 --- /dev/null +++ b/wallet/Utils/Extensions/Int64.swift @@ -0,0 +1,15 @@ +// +// Date.swift +// wallet +// +// Created by Adriana Epure on 24.08.2022. +// Copyright © 2022 Jason. All rights reserved. +// + +import Foundation + +extension Int64{ + func getAsDate()->Date{ + return Date(timeIntervalSince1970: TimeInterval(self)) + } +} diff --git a/wallet/Utils/Extensions/Misc.swift b/wallet/Utils/Extensions/Misc.swift new file mode 100644 index 0000000..27ebf87 --- /dev/null +++ b/wallet/Utils/Extensions/Misc.swift @@ -0,0 +1,38 @@ +// +// Misc.swift +// wallet +// +// Created by Jason on 8/30/20. +// Copyright © 2020 Jason. All rights reserved. +// + +import UIKit + +extension Array { + + func chunked(into size: Int) -> [[Element]] { + return stride(from: 0, to: count, by: size).map { + Array(self[$0 ..< Swift.min($0 + size, count)]) + } + } + +} + +extension String { + + func toQR(scale: CGFloat = 15.0) -> UIImage? { + let data = self.data(using: String.Encoding.ascii) + + // Create the filter and transform it's scale + if let filter = CIFilter(name: "CIQRCodeGenerator") { + filter.setValue(data, forKey: "inputMessage") + let transform = CGAffineTransform(scaleX: scale, y: scale) + if let output = filter.outputImage?.transformed(by: transform) { + return UIImage(ciImage: output) + } + } + + return nil + } + +} diff --git a/wallet/Utils/Extensions/UIImage.swift b/wallet/Utils/Extensions/UIImage.swift new file mode 100644 index 0000000..6a06972 --- /dev/null +++ b/wallet/Utils/Extensions/UIImage.swift @@ -0,0 +1,17 @@ +// +// UIImageView.swift +// wallet +// +// Created by Jason on 8/27/20. +// Copyright © 2020 Jason. All rights reserved. +// + +import UIKit + +extension UIImage { + + func tint(_ color: UIColor) -> UIImage { + return withRenderingMode(.alwaysTemplate).withTintColor(color) + } + +} diff --git a/wallet/Utils/Extensions/UIView.swift b/wallet/Utils/Extensions/UIView.swift new file mode 100644 index 0000000..060399b --- /dev/null +++ b/wallet/Utils/Extensions/UIView.swift @@ -0,0 +1,22 @@ +// +// UIView.swift +// wallet +// +// Created by Jason on 8/23/20. +// Copyright © 2020 Jason. All rights reserved. +// + +import UIKit + +extension UIView { + + func addSubviewAndFill(_ view: UIView, top: CGFloat = 0.0, bottom: CGFloat = 0.0, leading: CGFloat = 0.0, trailing: CGFloat = 0.0) { + addSubview(view) + view.translatesAutoresizingMaskIntoConstraints = false + view.topAnchor.constraint(equalTo: topAnchor, constant: top).isActive = true + view.leadingAnchor.constraint(equalTo: leadingAnchor, constant: leading).isActive = true + view.trailingAnchor.constraint(equalTo: trailingAnchor, constant: trailing).isActive = true + view.bottomAnchor.constraint(equalTo: bottomAnchor, constant: bottom).isActive = true + } + +} diff --git a/wallet/Utils/Extensions/UIViewController.swift b/wallet/Utils/Extensions/UIViewController.swift new file mode 100644 index 0000000..c4c2c74 --- /dev/null +++ b/wallet/Utils/Extensions/UIViewController.swift @@ -0,0 +1,58 @@ +// +// UIViewController.swift +// wallet +// +// Created by Jason van den Berg on 2020/08/18. +// Copyright © 2020 Jason. All rights reserved. +// + +import UIKit + +extension UIViewController { + + func setTheme() { + view.backgroundColor = Theme.backgroundColor + setNavBarStyles() + } + + func setNavBarStyles() { + + // Color + navigationController?.navigationBar.barTintColor = Theme.backgroundColor + navigationController?.navigationBar.isTranslucent = false + navigationController?.navigationBar.tintColor = Theme.inverseBackgroundColor + + // Shadow + navigationController?.navigationBar.layer.shadowColor = Theme.shadowColor.cgColor + navigationController?.navigationBar.layer.shadowOffset = CGSize(width: 0.0, height: CGFloat(Dimens.shadow)) + navigationController?.navigationBar.layer.shadowRadius = 0.0 + navigationController?.navigationBar.layer.shadowOpacity = 1.0 + navigationController?.navigationBar.layer.masksToBounds = false + navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .any, barMetrics: .default) + navigationController?.navigationBar.shadowImage = UIImage() + + // Text + navigationController?.navigationBar.titleTextAttributes = [ + NSAttributedString.Key.foregroundColor: Theme.inverseBackgroundColor, + NSAttributedString.Key.font: Fonts.sofiaPro(weight: .medium, Dimens.titleText) + ] + + } + + func hideKeyboardWhenSwipedDown() { + let swipeDown = UISwipeGestureRecognizer(target: self, action: #selector(UIViewController.dismissKeyboard)) + swipeDown.direction = UISwipeGestureRecognizer.Direction.down + view.addGestureRecognizer(swipeDown) + } + + func hideKeyboardWhenTappedAround() { + let tap = UITapGestureRecognizer(target: self, action: #selector(UIViewController.dismissKeyboard)) + tap.cancelsTouchesInView = false + view.addGestureRecognizer(tap) + } + + @objc func dismissKeyboard() { + view.endEditing(true) + } + +} diff --git a/wallet/Utils/Fonts.swift b/wallet/Utils/Fonts.swift new file mode 100644 index 0000000..fab25ff --- /dev/null +++ b/wallet/Utils/Fonts.swift @@ -0,0 +1,31 @@ +// +// Fonts.swift +// wallet +// +// Created by Jason on 8/20/20. +// Copyright © 2020 Jason. All rights reserved. +// + +import UIKit + +public enum FontStyle { + case regular + case medium + case bold + + var name: String { + switch self { + case .regular: return "SofiaProRegular" + case .medium: return "SofiaProMedium" + case .bold: return "SofiaProBold" + } + } +} + +struct Fonts { + + public static func sofiaPro(weight: FontStyle = .regular, _ size: Int = 16) -> UIFont { + return UIFont(name: weight.name, size: CGFloat(size))! + } + +} diff --git a/wallet/Utils/Icons.swift b/wallet/Utils/Icons.swift new file mode 100644 index 0000000..db557e4 --- /dev/null +++ b/wallet/Utils/Icons.swift @@ -0,0 +1,16 @@ +// +// Icons.swift +// wallet +// +// Created by Jason on 8/27/20. +// Copyright © 2020 Jason. All rights reserved. +// + +import UIKit + +extension UIImage { + + public static let back = #imageLiteral(resourceName: "ic_back") + public static let delete = #imageLiteral(resourceName: "ic_backspace") + +} diff --git a/wallet/Utils/Navigation.swift b/wallet/Utils/Navigation.swift new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/wallet/Utils/Navigation.swift @@ -0,0 +1 @@ + diff --git a/wallet/Utils/Observable.swift b/wallet/Utils/Observable.swift new file mode 100644 index 0000000..e54228c --- /dev/null +++ b/wallet/Utils/Observable.swift @@ -0,0 +1,30 @@ +// +// Observable.swift +// wallet +// +// Created by Jason on 8/23/20. +// Copyright © 2020 Jason. All rights reserved. +// + +import Foundation + +class Observable { + + private let thread: DispatchQueue + var value: T? { + willSet(newValue) { + if let newValue = newValue { + thread.async { + self.observe?(newValue) + } + } + } + } + + var observe: ((T) -> ())? + init(_ value: T? = nil, thread dispatcherThread: DispatchQueue = DispatchQueue.main) { + self.thread = dispatcherThread + self.value = value + } + +} diff --git a/wallet/Utils/Settings.swift b/wallet/Utils/Settings.swift new file mode 100644 index 0000000..1f6ec82 --- /dev/null +++ b/wallet/Utils/Settings.swift @@ -0,0 +1,13 @@ +// +// Settings.swift +// wallet +// +// Created by Jason van den Berg on 2020/08/20. +// Copyright © 2020 Jason. All rights reserved. +// + +import Foundation + +class Settings { + static var isUnitTest = ProcessInfo.processInfo.environment["XCTestConfigurationFilePath"] != nil +} diff --git a/wallet/Utils/Strings.swift b/wallet/Utils/Strings.swift new file mode 100644 index 0000000..cf3987b --- /dev/null +++ b/wallet/Utils/Strings.swift @@ -0,0 +1,21 @@ +// +// Strings.swift +// wallet +// +// Created by Jason on 8/23/20. +// Copyright © 2020 Jason. All rights reserved. +// + +import Foundation + +extension String { + + public static let defaultError = NSLocalizedString("DEFAULT_ERROR", comment: "A fallback error") + public static let request = NSLocalizedString("REQUEST", comment: "Request") + public static let note = NSLocalizedString("NOTE", comment: "Note") + public static let next = NSLocalizedString("NEXT", comment: "Next") + public static let createQR = NSLocalizedString("CREATE_QR", comment: "Create a QR code") + public static let forLabel = NSLocalizedString("FOR", comment: "For") + public static let requestNotePlaceholder = NSLocalizedString("NOTE_PLACEHOLDER", comment: "Placeholder for the note") + +} diff --git a/wallet/Utils/Theme.swift b/wallet/Utils/Theme.swift new file mode 100644 index 0000000..4854db3 --- /dev/null +++ b/wallet/Utils/Theme.swift @@ -0,0 +1,63 @@ +// +// Theme.swift +// wallet +// +// Created by Jason on 8/20/20. +// Copyright © 2020 Jason. All rights reserved. +// + +import UIKit + +struct Theme { + + public static let primaryColor: UIColor = { + return UIColor { (UITraitCollection) -> UIColor in + if UITraitCollection.userInterfaceStyle == .dark { + return .systemTeal + } else { + return .systemTeal + } + } + }() + + public static let primaryDarkColor: UIColor = { + return UIColor { (UITraitCollection) -> UIColor in + if UITraitCollection.userInterfaceStyle == .dark { + return .systemBlue + } else { + return .systemBlue + } + } + }() + + public static let backgroundColor: UIColor = { + return UIColor { (UITraitCollection) -> UIColor in + if UITraitCollection.userInterfaceStyle == .dark { + return .gray900 + } else { + return .white500 + } + } + }() + + public static let inverseBackgroundColor: UIColor = { + return UIColor { (UITraitCollection) -> UIColor in + if UITraitCollection.userInterfaceStyle == .dark { + return .white500 + } else { + return .gray900 + } + } + }() + + public static let shadowColor: UIColor = { + return UIColor { (UITraitCollection) -> UIColor in + if UITraitCollection.userInterfaceStyle == .dark { + return UIColor.white500.withAlphaComponent(0.25) + } else { + return UIColor.gray900.withAlphaComponent(0.25) + } + } + }() + +} diff --git a/wallet/ViewControllers/ChannelsVC.swift b/wallet/ViewControllers/ChannelsVC.swift new file mode 100644 index 0000000..1bc10de --- /dev/null +++ b/wallet/ViewControllers/ChannelsVC.swift @@ -0,0 +1,431 @@ +// +// ChannelsVC.swift +// wallet +// +// Created by Adriana Epure on 22.08.2022. +// Copyright © 2022 Jason. All rights reserved. +// + +import UIKit + +class ChannelsVC: CustomViewController { + private let nodeKeyPlaceholder: String = "Public Node Key ..." + @IBOutlet weak var selectedListControl: UISegmentedControl! + @IBOutlet weak var tableView: UITableView! + + @IBOutlet weak var channelsBtnsStack: UIStackView! + + @IBOutlet weak var availableBalanceLbl: UILabel! + //MARK: Open Channel Outlets + @IBOutlet weak var newStackView: UIStackView! + @IBOutlet weak var newBtn: UIButton! + @IBOutlet weak var openAddressTextView: UITextView! + @IBOutlet weak var openBtn: UIButton! + @IBOutlet weak var cancelOpen: UIButton! + @IBOutlet weak var localFundingStepper: UIStepper! + @IBOutlet weak var pushAmountStepper: UIStepper! + @IBOutlet weak var localFundingAmount: UITextField! + @IBOutlet weak var closeAddressTextField: UITextField! + @IBOutlet weak var hostAddress: UITextField! + + @IBOutlet weak var portTextField: UITextField! + @IBOutlet weak var pushSatAmount: UITextField! + lazy var refreshControl: UIRefreshControl = { + let refreshControl = UIRefreshControl() + refreshControl.addTarget(self, action: + #selector(refreshData(_:)), + for: .valueChanged) + refreshControl.tintColor = UIColor.gray + + return refreshControl + }() + override func viewDidLoad() { + super.viewDidLoad() + title = "Channels" + self.selectedListControl.selectedSegmentIndex = 0 + self.selectedListControl.sendActions(for: .valueChanged) + tableView.delegate = self + tableView.dataSource = self + } + override func viewModelDidLoad() { + viewModel.channels.observe = { [weak self] channels in + self?.tableView.reloadData() + } + viewModel.pendingChannels.observe = { [weak self] channels in + self?.tableView.reloadData() + } + viewModel.closedChannels.observe = { [weak self] channels in + self?.tableView.reloadData() + } + viewModel.peers.observe = { [weak self] peers in + self?.tableView.reloadData() + } + viewModel.walletBalance.observe = { [weak self] walletBalance in + self?.availableBalanceLbl.text = String(walletBalance.total) + } + viewModel.load() + viewModel.getWalletBalance() + self.tableView.addSubview(self.refreshControl) + + } + @objc private func refreshData(_ sender: Any) { + // Fetch Weather Data + refreshList() + self.tableView.reloadData() + refreshControl.endRefreshing() + } + //MARK: - New Channel + + @IBAction func didPressNewBtn(_ sender: UIButton) { + openAddressTextView.text = nodeKeyPlaceholder + openAddressTextView.textColor = UIColor.lightGray + openAddressTextView.delegate = self + openAddressTextView.layer.borderColor = UIColor.lightGray.cgColor + openAddressTextView.layer.borderWidth = 1 + closeAddressTextField.delegate = self + localFundingAmount.delegate = self + pushSatAmount.delegate = self + showHideViews(isNew: true, isFinished: false) + openAddressTextView.text = "0245fc5e867abb5b83ead35b50dc5013dd358b9f3eb48c02f5e1cc9fc675039359" + } + @IBAction func didChangePushSatStepper(_ sender: UIStepper) { + pushSatAmount.text = String(String(format: "%.f", sender.value)) + toggleOpenBtn() + } + @IBAction func didChangeLocalFundingStepper(_ sender: UIStepper) { + localFundingAmount.text = String(String(format: "%.f", sender.value)) + toggleOpenBtn() + } + @IBAction func didPressOpenBtn(_ sender: UIButton) { + self.selectedListControl.selectedSegmentIndex = 0 + self.selectedListControl.sendActions(for: .valueChanged) + if let channelAddress = openAddressTextView.text{ + guard let pubKey = openAddressTextView.text else { + return + } + guard let host = hostAddress.text else { + return + } + guard let port = UInt(portTextField.text ?? "") else { + return + } + guard let funding = Int(localFundingAmount.text ?? "") else { + return + } + guard let push = Int(pushSatAmount.text ?? "") else { + return + } + + debugPrint("Channel Address ", channelAddress) + viewModel.openChannel(nodePubKey: pubKey, hostAddress: host, port: port, pushSat: push, localFunding: funding) { response in + self.showAlert(title: "Channel Open", errorMsg: "Channel Open Request Sent") + } onFailure: { error in + self.showAlert(title: "Channel Open", errorMsg: "Channel Open Request Failed") + } + } + showHideViews(isNew: true, isFinished: true) + + } + @IBAction func didPressCancelOpenBtn(_ sender: UIButton) { + showHideViews(isNew: !newStackView.isHidden, isFinished: true) + } + + //MARK: - Selection + @IBAction func didChangeSelection(_ sender: Any) { + refreshList() + tableView.reloadData() + } +} + +extension ChannelsVC{ + func refreshList(){ + switch selectedListControl.selectedSegmentIndex{ + case 0: + viewModel.listChannels() + case 1: + viewModel.listClosedChannels() + case 2, 3: + viewModel.listPendingChannels() + + default: + viewModel.listPeers() + } + } + func toggleOpenBtn(){ + openBtn.isHidden = true + let isNodeKeyFilled = !openAddressTextView.text.isEmpty && openAddressTextView.textColor != UIColor.lightGray + let isCloseAddressFilled = !(closeAddressTextField.text?.isEmpty ?? true) + guard let localFundingText = localFundingAmount.text else { + return + } + guard let pushSatText = pushSatAmount.text else { + return + } + openBtn.isHidden = !(isNodeKeyFilled && Int(localFundingText) ?? 0 > 0 && Int(pushSatText) ?? 0 > 0) + } + func showHideViews(isNew: Bool, isFinished: Bool){ + channelsBtnsStack.isHidden = !isFinished + newStackView.isHidden = isFinished || (!isFinished && !isNew) + tableView.isHidden = !isFinished + selectedListControl.isHidden = !isFinished +// openBtn.isHidden = true + if isFinished{ + localFundingAmount.text = "" + localFundingAmount.text = "0" + openAddressTextView.text = "" + } + } +} + +//MARK: - List + + +extension ChannelsVC: UITableViewDelegate, UITableViewDataSource{ + func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool { + if selectedListControl.selectedSegmentIndex == 0 { + return viewModel.channels.value?[indexPath.row].active ?? false + } else { + return false + } + } + func tableView(_ tableView: UITableView, titleForDeleteConfirmationButtonForRowAt indexPath: IndexPath) -> String? { + return "Close" + } + + func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) { + if selectedListControl.selectedSegmentIndex == 0 && editingStyle == .delete{ + if let channel = viewModel.channels.value?[indexPath.row]{ + debugPrint(channel) + let showAlert = UIAlertController(title: "Close Channel", message: "Are you sure you want to close this channel?", preferredStyle: .alert) + showAlert.addAction(UIAlertAction(title: "OK", style: .default, handler: { action in + self.viewModel.closeChannel(channel: channel) { response in + self.showAlert(title: "Closed Channel", description: "Channel Close Request Sent") + } onFailure: { error in + self.showAlert(title: "Closed Channel", description: "Channel Close Request Failed") + } + + debugPrint("✅✅ Close channel ✅✅") + })) + showAlert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: { action in + self.viewModel.listChannels() + })) + self.present(showAlert, animated: true, completion: nil) + } + } + } + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + let emptyLabel = UILabel(frame: CGRect(x: 0, y: 0, width: self.view.bounds.size.width, height: self.view.bounds.size.height)) + emptyLabel.text = "" + emptyLabel.textAlignment = NSTextAlignment.center + self.tableView.backgroundView = emptyLabel + switch selectedListControl.selectedSegmentIndex{ + case 0: + if let noOfChannels = viewModel.channels.value?.count{ + return noOfChannels + }else{ + emptyLabel.text = "No channels" + self.tableView.separatorStyle = UITableViewCell.SeparatorStyle.none + return 0 + } + case 1: + if let noOfClosedChannels = viewModel.closedChannels.value?.count{ + return noOfClosedChannels + }else{ + emptyLabel.text = "No closed channels" + self.tableView.separatorStyle = UITableViewCell.SeparatorStyle.none + return 0 + } + case 2: + if let noOfPendingChannels = viewModel.pendingChannels.value?.pendingOpenChannels.count { + return noOfPendingChannels + }else{ + emptyLabel.text = "No pending open channels" + self.tableView.separatorStyle = UITableViewCell.SeparatorStyle.none + return 0 + } + case 3: + if let noOfPendingChannels = viewModel.pendingChannels.value?.waitingCloseChannels.count { + return noOfPendingChannels + }else{ + emptyLabel.text = "No pending closed channels" + self.tableView.separatorStyle = UITableViewCell.SeparatorStyle.none + return 0 + } + default: + if let noOfPeers = viewModel.peers.value?.count{ + return noOfPeers + }else{ + emptyLabel.text = "No Peers" + self.tableView.separatorStyle = UITableViewCell.SeparatorStyle.none + return 0 + } + } + + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let reuseCellIdentifier = "cellIdentifier" + var cell = tableView.dequeueReusableCell(withIdentifier: reuseCellIdentifier) + if (!(cell != nil)) { + + cell = UITableViewCell(style: .subtitle, reuseIdentifier: reuseCellIdentifier) + } + cell?.textLabel?.numberOfLines = 0 + cell?.detailTextLabel?.numberOfLines = 0 + + switch selectedListControl.selectedSegmentIndex{ + case 0: + if let channel = viewModel.channels.value?[indexPath.row]{ + cell?.textLabel?.text = "Status: \(channel.active ? "active" : "inactive") \nFee per Kw: \(channel.feePerKw) sat \nUptime: \(channel.uptime) " + cell?.detailTextLabel?.text = "\nLocal Balance: \(channel.localBalance) sat \nRemote Balance: \(channel.remoteBalance) sat \nUnsettled balance: \(channel.unsettledBalance) sat \nPublic key: \(channel.remotePubkey)" + } + case 1: + if let channel = viewModel.closedChannels.value?[indexPath.row]{ + cell?.textLabel?.text = "\nSettled Balance per Kw: \(channel.settledBalance) sat \nCapacity: \(channel.capacity) " + cell?.detailTextLabel?.text = "\nOpen by: \(channel.openInitiator) sat \nClosed by: \(channel.closeInitiator) sat \nTime Locked balance: \(channel.timeLockedBalance) sat \nPublic key: \(channel.remotePubkey)" + } + case 2: + if let channel = viewModel.pendingChannels.value?.pendingOpenChannels[indexPath.row] as? Lnrpc_PendingChannelsResponse.PendingOpenChannel{ + debugPrint("Channel pending list", channel, indexPath) + cell?.textLabel?.text = "\n Pending Open " + cell?.detailTextLabel?.text = "\n \nCapacity: \(channel.channel.capacity) \nConfirmation Height \(channel.confirmationHeight) \nLocal Balance: \(channel.channel.localBalance) sat \nRemote Balance: \(channel.channel.remoteBalance) sat \n \(channel.channel.channelPoint)" + + } + case 3: + if let channel = viewModel.pendingChannels.value?.waitingCloseChannels[indexPath.row] as? Lnrpc_PendingChannelsResponse.WaitingCloseChannel{ + debugPrint("Channel pending list", channel, indexPath) + cell?.textLabel?.text = "\n Pending Close " + cell?.detailTextLabel?.text = "\n \nCapacity: \(channel.channel.capacity) \nLimbo Balance \(channel.limboBalance) \n\nLocal TX ID\(channel.commitments.localTxid) \n\nRemote TX ID\(channel.commitments.remoteTxid) \n\nLocal Commit Fee\(channel.commitments.localCommitFeeSat) sat \nRemote Commit Fee\(channel.commitments.remoteCommitFeeSat) sat \n\nLocal Balance: \(channel.channel.localBalance) sat \nRemote Balance: \(channel.channel.remoteBalance) sat \n \(channel.channel.channelPoint)" + + } + default: + if let peer = viewModel.peers.value?[indexPath.row]{ + cell?.textLabel?.text = "Received : \(peer.satRecv) sat \nSent: \(peer.satSent) sat " + cell?.detailTextLabel?.text = "\n Host: \(peer.address) \nInbound: \(peer.inbound) \nPing time:\(peer.pingTime) \nPublic key: \(peer.pubKey)" + } + } + + + return cell! + } + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + if selectedListControl.selectedSegmentIndex == 0{ + if let channel = viewModel.channels.value?[indexPath.row]{ + self.viewModel.getChannelInfo(id: channel.chanID) { channelInfo in + debugPrint(channelInfo) + let info = "🕓 Last Update: \(Int64(channelInfo.lastUpdate).getAsDate().format(style: .medium)) \n💰Capacity: \(channelInfo.capacity)sat \n💰 RemoteBalance: \(channel.remoteBalance)sat \n💰Local Balance: \(channel.localBalance)sat \nPoint: \(channelInfo.chanPoint) \n\n✅->>>>>> Node 1 <<<<<<-✅\n\n💰 Base Fee:\(channelInfo.node1Policy.feeBaseMsat)sat\nFee Rate:\(channelInfo.node2Policy.feeRateMilliMsat)msat \nPublic key: \n\(channelInfo.node1Pub) \n\n✅->>>>>> Node 2 <<<<<<-✅\n\n💰 Base Fee:\(channelInfo.node2Policy.feeBaseMsat)sat\nFee Rate:\(channelInfo.node2Policy.feeRateMilliMsat)msat\nPublic key: \n\(channelInfo.node2Pub) " + self.showAlert(title: "Channel Info", description: info) + } onFailure: { error in + debugPrint(error) + } + + } + }else{ + if let peer = viewModel.peers.value?[indexPath.row]{ + self.showAlert(title: "Peer", address: peer.pubKey) + } + } + } + +} + + +extension ChannelsVC: UITextFieldDelegate{ + /** + * Called when 'return' key pressed. return NO to ignore. + */ + func textFieldShouldReturn(_ textField: UITextField) -> Bool { + toggleOpenBtn() + textField.resignFirstResponder() + return true + } + + func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { + if textField == localFundingAmount || textField == pushSatAmount{ + let allowedCharacters = CharacterSet.decimalDigits + let characterSet = CharacterSet(charactersIn: string) + return allowedCharacters.isSuperset(of: characterSet) + } + return true + } + /** + * Called when the user click on the view (outside the UITextField). + */ + func touchesBegan(touches: Set, withEvent event: UIEvent?) { + self.view.endEditing(true) + } + +} +extension ChannelsVC: UITextPasteDelegate { + func textPasteConfigurationSupporting(_ textPasteConfigurationSupporting: UITextPasteConfigurationSupporting, shouldAnimatePasteOf attributedString: NSAttributedString, to textRange: UITextRange) -> Bool { + return false + } +} + +extension ChannelsVC: UITextViewDelegate{ + func textViewDidBeginEditing(_ textView: UITextView) { + if textView.textColor == UIColor.lightGray { + textView.text = nil + textView.textColor = UIColor.black + } + } + func textViewDidEndEditing(_ textView: UITextView) { + if textView.text.isEmpty { + textView.text = nodeKeyPlaceholder + textView.textColor = UIColor.lightGray + } + } + func textViewDidChange(_ textView: UITextView) { + + if(textView.text == UIPasteboard.general.string){ + + } + } + func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool { + + // Combine the textView text and the replacement text to + // create the updated text string + let currentText:String = textView.text + let updatedText = (currentText as NSString).replacingCharacters(in: range, with: text) + + // If updated text view will be empty, add the placeholder + // and set the cursor to the beginning of the text view + if updatedText.isEmpty { + + textView.text = nodeKeyPlaceholder + textView.textColor = UIColor.lightGray + + textView.selectedTextRange = textView.textRange(from: textView.beginningOfDocument, to: textView.beginningOfDocument) + } + + // Else if the text view's placeholder is showing and the + // length of the replacement string is greater than 0, set + // the text color to black then set its text to the + // replacement string + else if textView.textColor == UIColor.lightGray && !text.isEmpty { + textView.textColor = UIColor.black + textView.text = text + }else if text == "\n" { + textView.resignFirstResponder() + toggleOpenBtn() + return false + } + + // For every other case, the text should change with the usual + // behavior... + else { + return true + } + + // ...otherwise return false since the updates have already + // been made + return false + } + func textViewDidChangeSelection(_ textView: UITextView) { + if self.view.window != nil { + if textView.textColor == UIColor.lightGray { + textView.selectedTextRange = textView.textRange(from: textView.beginningOfDocument, to: textView.beginningOfDocument) + } + } + } +} diff --git a/wallet/ViewControllers/ChannelsVC.xib b/wallet/ViewControllers/ChannelsVC.xib new file mode 100644 index 0000000..dd34fd2 --- /dev/null +++ b/wallet/ViewControllers/ChannelsVC.xib @@ -0,0 +1,294 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wallet/ViewControllers/CustomViewController.swift b/wallet/ViewControllers/CustomViewController.swift new file mode 100644 index 0000000..b74de51 --- /dev/null +++ b/wallet/ViewControllers/CustomViewController.swift @@ -0,0 +1,125 @@ + +import UIKit + +class CustomViewController: UIViewController { + + private lazy var leftNavigationAction: () -> Void = { + self.navigationController?.popViewController(animated: true) + } + + var viewModel: VM! { + didSet { + viewModelDidLoad() + } + } + + lazy var loadingView: LoadingView = { + return LoadingView() + }() + + lazy var errorView: ErrorView = { + return ErrorView() + }() + + override func viewDidLoad() { + super.viewDidLoad() + + // Create the view model if needed + if (viewModel == nil) { + viewModel = VM() + } + +// setTheme() + } + + public func showContentView() { + dropViews([errorView, loadingView]) + } + + public func showLoadingView() { + dropViews([errorView]) + addViewIfNeeded(loadingView) + } + + public func showErrorView(error: String = .defaultError) { + dropViews([loadingView]) + addViewIfNeeded(errorView) + errorView.title = error + } + + private func dropViews(_ views: [UIView]) { + views.forEach { view in + view.removeFromSuperview() + } + } + + private func addViewIfNeeded(_ subview: UIView) { + if (!view.subviews.contains(subview)) { + view.addSubviewAndFill(subview) + view.bringSubviewToFront(subview) + } + } + + func viewModelDidLoad() { + // Empty + } + + @objc private func leftAction() { + leftNavigationAction() + } + + func setLeftNavigationButton(_ icon: UIImage, action: (() -> Void)? = nil) { + + // Attach left action + // Or fallback with a pop + if let leftAction = action { + leftNavigationAction = leftAction + } else { + leftNavigationAction = { + self.navigationController?.popViewController(animated: true) + } + } + + navigationItem.leftBarButtonItem = UIBarButtonItem( + image: .back, + style: .plain, + target: self, + action: #selector(CustomViewController.leftAction) + ) + } + func showAlert(title: String, address: String? = nil , errorMsg: String? = nil, description: String? = nil){ + + let showAlert = UIAlertController(title: title, message: errorMsg, preferredStyle: .alert) + if let address = address { + let imageView = UIImageView(frame: CGRect(x: 10, y: 50, width: 250, height: 250)) + imageView.image = generateQRCode(from: address) + imageView.layer.magnificationFilter = CALayerContentsFilter.nearest + showAlert.view.addSubview(imageView) + let height = NSLayoutConstraint(item: showAlert.view as Any, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 1, constant: 400) + let width = NSLayoutConstraint(item: showAlert.view as Any, attribute: .width, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 1, constant:250) + showAlert.view.addConstraint(height) + showAlert.view.addConstraint(width) + showAlert.addAction(UIAlertAction(title: "Copy Address", style: .default, handler: { action in + UIPasteboard.general.string = address + debugPrint("✅✅ Created Invoice ✅✅", address) + })) + + } + if let description = description { + showAlert.message = description + } + showAlert.addAction(UIAlertAction(title: "OK", style: .default, handler: { action in + + })) + self.present(showAlert, animated: true, completion: nil) + } + func generateQRCode(from string: String) -> UIImage? { + let data = string.data(using: String.Encoding.ascii) + if let QRFilter = CIFilter(name: "CIQRCodeGenerator") { + QRFilter.setValue(data, forKey: "inputMessage") + guard let QRImage = QRFilter.outputImage else {return nil} + return UIImage(ciImage: QRImage) + } + return nil + } +} diff --git a/wallet/ViewControllers/Home.swift b/wallet/ViewControllers/Home.swift new file mode 100644 index 0000000..652da92 --- /dev/null +++ b/wallet/ViewControllers/Home.swift @@ -0,0 +1,16 @@ +// +// Home.swift +// wallet +// +// Created by Adriana Epure on 19.08.2022. +// Copyright © 2022 Jason. All rights reserved. +// + +import UIKit + +class Home: UIViewController { + override func viewDidLoad() { + super.viewDidLoad() + view.backgroundColor = .red + } +} diff --git a/wallet/ViewControllers/HomeVC.swift b/wallet/ViewControllers/HomeVC.swift new file mode 100644 index 0000000..32d1817 --- /dev/null +++ b/wallet/ViewControllers/HomeVC.swift @@ -0,0 +1,166 @@ +// +// HomeVC.swift +// wallet +// +// Created by Adriana Epure on 19.08.2022. +// Copyright © 2022 Jason. All rights reserved. +// + +import UIKit + +class HomeVC: CustomViewController { + private let password = "sshhhhhh" + + /// LND Status + @IBOutlet weak var debugStatus: UILabel! + @IBOutlet weak var lndStatus: UIImageView! + @IBOutlet weak var syncToChainStatus: UIImageView! + @IBOutlet weak var walletStatus: UIImageView! + + + /// INFO + + @IBOutlet weak var infoStack: UIStackView! + @IBOutlet weak var peersCount: UILabel! + @IBOutlet weak var blockHeightCount: UILabel! + @IBOutlet weak var activeChannelsCount: UILabel! + @IBOutlet weak var inactiveChannelsCount: UILabel! + @IBOutlet weak var pendingChannelsCount: UILabel! + + /// Wallet + @IBOutlet weak var walletStack: UIStackView! + @IBOutlet weak var walletBalanceStack: UIStackView! + @IBOutlet weak var createWalletBtn: UIButton! + @IBOutlet weak var unlockWalletBtn: UIButton! + @IBOutlet weak var getBalanceBtn: UIButton! + @IBOutlet weak var walletInfo: UIButton! + + @IBOutlet weak var totalAmountLbl: UILabel! + @IBOutlet weak var unconfirmedLbl: UILabel! + @IBOutlet weak var confirmedAmountLbl: UILabel! + + + @IBOutlet weak var showChannelsBtn: UIButton! + @IBOutlet weak var showPaymentsBtn: UIButton! + //MARK: View LifeCycle + override func viewDidLoad() { + super.viewDidLoad() + title = "Home" + updateStatus() + } + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) + subscribe() + } + + //MARK: ViewModel + // This will get called when the ViewModel for this ViewController is ready to use + // This gives us a simple place to observe all changes to the datasources + // and can update the views accordingly as they change in real time + override func viewModelDidLoad() { + + viewModel.isLoading.observe = { [weak self] isLoading in + if (isLoading) { + self?.showLoadingView() + }else{ + self?.showContentView() + } + } + viewModel.walletBalance.observe = { [weak self] balance in + self?.updateBalance(balance) + } + + viewModel.newAddress.observe = { [weak self] address in + UIPasteboard.general.string = address + self?.showContentView() + } + + viewModel.walletWipe.observe = { _ in + UIControl().sendAction(#selector(NSXPCConnection.suspend), to: UIApplication.shared, for: nil) + DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { + exit(0) + } + } + viewModel.load() + + } + //MARK: Button Actions + + @IBAction func didPressUnlockBtn(_ sender: Any) { + self.viewModel.unlockWallet(password: self.password) + } + @IBAction func didPressPaymentsBtn(_ sender: Any) { + self.navigationController?.pushViewController(PaymentsVC(), animated: true) + } + @IBAction func didPressChannelsBtn(_ sender: Any) { + self.navigationController?.pushViewController(ChannelsVC(), animated: true) + } + + @IBAction func didPressWalletInfo(_ sender: Any) { + let walletAddress = LightningStateMonitor.shared.state.walletInfo.identityPubkey + self.showAlert(title: "My Wallet", address: walletAddress) + } + +} +//MARK: Subscribe +extension HomeVC{ + private func subscribe() { + EventBus.onMainThread(self, eventType: .lndStateChange) { [weak self] (_) in + self?.updateStatus() + } + EventBus.onMainThread(self, eventType: .lndStopped) { [weak self] (_) in + self?.updateStatus() + } + EventBus.onMainThread(self, eventType: .lndStarted) { [weak self] (_) in + self?.updateStatus() + } + EventBus.onMainThread(self, eventType: .lndRpcReady) { [weak self] (_) in + self?.updateStatus() + } + EventBus.onMainThread(self, eventType: .lndWalletUnlocked) { [weak self] (_) in + self?.updateStatus() + } + } + private func updateStatus() { + debugStatus.text = LightningStateMonitor.shared.state.debuggingStatus.joined(separator: "\n\n") + updateLND(isOn: LightningStateMonitor.shared.state.lndRunning) + updateRPC(isReady: LightningStateMonitor.shared.state.walletInfo.syncedToChain) + updateWallet(isUnlocked: LightningStateMonitor.shared.state.walletUnlocked) + updateInfo() + } + private func updateRPC(isReady: Bool){ + self.syncToChainStatus.tintColor = isReady ? .green : .red + self.syncToChainStatus.image = isReady ? UIImage(systemName: "point.3.filled.connected.trianglepath.dotted") : UIImage(systemName: "point.3.connected.trianglepath.dotted") + } + private func updateLND(isOn: Bool){ + self.unlockWalletBtn.isHidden = !isOn + self.unlockWalletBtn.isEnabled = isOn + self.lndStatus.tintColor = isOn ? .green : .red + self.lndStatus.image = isOn ? UIImage(systemName: "checkmark.circle.fill") : UIImage(systemName: "checkmark.circle.trianglebadge.exclamationmark") + } + private func updateInfo(){ + self.peersCount.text = String(LightningStateMonitor.shared.state.walletInfo.numPeers) + self.blockHeightCount.text = String(LightningStateMonitor.shared.state.walletInfo.blockHeight) + self.activeChannelsCount.text = String(LightningStateMonitor.shared.state.walletInfo.numActiveChannels) + self.inactiveChannelsCount.text = String(LightningStateMonitor.shared.state.walletInfo.numInactiveChannels) + self.pendingChannelsCount.text = String(LightningStateMonitor.shared.state.walletInfo.numPendingChannels) + self.viewModel.getWalletBalance() + } + private func updateBalance(_ balance: WalletBalance){ + self.totalAmountLbl.text = String(balance.total) + self.confirmedAmountLbl.text = String(balance.confirmed) + self.unconfirmedLbl.text = String(balance.unconfirmed) + } + private func updateWallet(isUnlocked: Bool){ + self.unlockWalletBtn.isHidden = isUnlocked + self.walletStatus.tintColor = isUnlocked ? .green : .red + self.walletStatus.image = isUnlocked ? UIImage(systemName: "lock.open") : UIImage(systemName: "lock") + self.infoStack.isHidden = !isUnlocked + self.walletBalanceStack.isHidden = !isUnlocked + self.walletInfo.isEnabled = isUnlocked +// self.getBalanceBtn.isHidden = !isUnlocked + self.showChannelsBtn.isHidden = !isUnlocked + self.showPaymentsBtn.isEnabled = isUnlocked + } +} + diff --git a/wallet/ViewControllers/HomeVC.xib b/wallet/ViewControllers/HomeVC.xib new file mode 100644 index 0000000..80c49e7 --- /dev/null +++ b/wallet/ViewControllers/HomeVC.xib @@ -0,0 +1,440 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wallet/ViewControllers/HomeViewController.swift b/wallet/ViewControllers/HomeViewController.swift new file mode 100644 index 0000000..8bf308b --- /dev/null +++ b/wallet/ViewControllers/HomeViewController.swift @@ -0,0 +1,519 @@ + +import UIKit + +class HomeViewController: CustomViewController { +// private let password = "sshhhhhh" +// private var unlockWallet : UIButton! +// private var getInfo : UIButton! +// private var listChannels : UIButton! +// private var openChannel : UIButton! +// private var showInvoices : UIButton! +// private var showPayments : UIButton! +// private var hideButton : UIButton! +// private var sendPayment : UIButton! +// private var receivePayment : UIButton! +// private var cancel : UIButton! +// private var generateInvoice : UIButton! +// private var payInvoice : UIButton! +// private var debugStatus : UILabel! +// private var resultMessage : UILabel! +// private var balance : UILabel! +// private var invoiceLbl : UILabel! +// var isShowPayments: Bool = true +// lazy var contentViewSize = CGSize(width: self.view.frame.width, height: self.view.frame.height) +// lazy var scrollView: UIScrollView = { +// let view = UIScrollView(frame: .zero) +// view.backgroundColor = .white +// view.frame = self.view.bounds +// view.contentSize = contentViewSize +// view.translatesAutoresizingMaskIntoConstraints = false +// return view +// }() +// lazy var stackView: UIStackView = { +// let stackView = UIStackView() +// stackView.axis = .vertical +// stackView.distribution = .fill +// stackView.alignment = .fill +// stackView.spacing = 10 +// stackView.translatesAutoresizingMaskIntoConstraints = false +// return stackView +// }() +// lazy var debugStackView: UIStackView = { +// let stackView = UIStackView() +// stackView.axis = .vertical +// stackView.distribution = .fill +// stackView.alignment = .fill +// stackView.spacing = 10 +// stackView.translatesAutoresizingMaskIntoConstraints = false +// return stackView +// }() +// lazy var walletStackView: UIStackView = { +// let stackView = UIStackView() +// stackView.axis = .vertical +// stackView.distribution = .fill +// stackView.alignment = .fill +// stackView.spacing = 10 +// stackView.translatesAutoresizingMaskIntoConstraints = false +// return stackView +// }() +// lazy var infoStackView: UIStackView = { +// let stackView = UIStackView() +// stackView.axis = .vertical +// stackView.distribution = .fill +// stackView.alignment = .fill +// stackView.spacing = 10 +// stackView.translatesAutoresizingMaskIntoConstraints = false +// return stackView +// }() +// lazy var channelStackView: UIStackView = { +// let stackView = UIStackView() +// stackView.axis = .vertical +// stackView.distribution = .fill +// stackView.alignment = .fill +// stackView.spacing = 10 +// stackView.translatesAutoresizingMaskIntoConstraints = false +// return stackView +// }() +// lazy var paymentStackView: UIStackView = { +// let stackView = UIStackView() +// stackView.axis = .vertical +// stackView.distribution = .fill +// stackView.alignment = .fill +// stackView.spacing = 10 +// stackView.translatesAutoresizingMaskIntoConstraints = false +// return stackView +// }() +// lazy var sendStackView: UIStackView = { +// let stackView = UIStackView() +// stackView.axis = .horizontal +// stackView.distribution = .fillEqually +// stackView.alignment = .fill +// stackView.spacing = 10 +// stackView.translatesAutoresizingMaskIntoConstraints = false +// return stackView +// }() +// let textView: UITextField = { +// let textView = UITextField() +// textView.textAlignment = .left +// textView.layer.cornerRadius = 5.0 +// textView.layer.borderWidth = 0.2 +// textView.layer.borderColor = UIColor.gray.cgColor +// textView.layer.masksToBounds = true +// textView.tintColor = .black +// textView.translatesAutoresizingMaskIntoConstraints = false //enable autolayout +// textView.heightAnchor.constraint(equalToConstant: 100).isActive = true +// textView.isHidden = true +// textView.placeholder = "Enter Invoice..." +//// textView.text = "lntb2500n1p30mapmpp53jy8q39upxn0acs5a2e0hzducxn25f2r9xrp3y7kyje2ug68t4lqdqgf4jhycmfcqzpgxqrrsssp5qe7unjq3j2lw7f8etvlhsgpac8ec7q7pd3ydx6mmaa33vcjcl5as9qyyssq2w3e8d074cz72tmmne9z7c3j9f9u8n3elc2sgzdm7j760847c5az2ca6900tdg7hx8wnaethzqkq60ym4ug7zrr4mlxyzcc5lrvgwycqmyzteq" +// return textView +// }() +// lazy var tableView: UITableView = { +// let tableView: UITableView = UITableView() +// tableView.backgroundColor = .white +// tableView.translatesAutoresizingMaskIntoConstraints = false +// tableView.heightAnchor.constraint(equalToConstant: 200).isActive = true +// tableView.delegate = self +// tableView.dataSource = self +// return tableView +// }() +// +// +// override func viewDidLoad() { +// super.viewDidLoad() +// title = "LND test" +// view.backgroundColor = .white +// view.addSubview(scrollView) +// scrollView.topAnchor.constraint(equalTo: view.topAnchor).isActive = true +// scrollView.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true +// scrollView.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true +// scrollView.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true +// setup() +// scrollView.addSubview(stackView) +// +// stackView.translatesAutoresizingMaskIntoConstraints = false +// stackView.widthAnchor.constraint(equalTo: scrollView.widthAnchor, constant: -40).isActive = true +// stackView.topAnchor.constraint(equalTo: scrollView.topAnchor, constant: 10).isActive = true +// stackView.leadingAnchor.constraint(equalTo: scrollView.leadingAnchor, constant: 20).isActive = true +// stackView.trailingAnchor.constraint(equalTo: scrollView.trailingAnchor, constant: 20).isActive = true +// stackView.bottomAnchor.constraint(equalTo: scrollView.bottomAnchor, constant: 10).isActive = true +// updateStatus() +// } +// +// override func viewDidAppear(_ animated: Bool) { +// super.viewDidAppear(animated) +// subscribe() +// } +// +// private func subscribe() { +// EventBus.onMainThread(self, eventType: .lndStateChange) { [weak self] (_) in +// self?.updateStatus() +// } +// EventBus.onMainThread(self, eventType: .lndWalletUnlocked) { [weak self] (_) in +// self?.setupInfo() +// self?.setupChannel() +// self?.walletStackView.isHidden = true +// self?.viewModel.getWalletBalance() +// } +// } +// +// private func updateStatus() { +// if LightningStateMonitor.shared.state.lndRunning { +// setupWallet() +// } +// +// debugStatus.text = LightningStateMonitor.shared.state.debuggingStatus.joined(separator: "\n") +// } +// +// private func createButton(_ title: String, action: @escaping () -> Void) -> UIButton { +// let button = CustomButton(action: action) +// button.title = title +// button.translatesAutoresizingMaskIntoConstraints = false +// button.heightAnchor.constraint(equalToConstant: CGFloat(50)).isActive = true +// return button +// } +// +// private func setup() { +// let tap = UITapGestureRecognizer(target: self, action: #selector(handleTap)) +// view.addGestureRecognizer(tap) // Add gesture recognizer to background view +// showLNDStatus() +// +// textView.delegate = self +// +// } +// +// // This will get called when the ViewModel for this ViewController is ready to use +// // This gives us a simple place to observe all changes to the datasources +// // and can update the views accordingly as they change in real time +// override func viewModelDidLoad() { +// +// viewModel.isLoading.observe = { [weak self] isLoading in +// if (isLoading) { +// self?.showLoadingView() +// } +// } +// +// viewModel.randomInt.observe = { [weak self] randomInt in +// self?.showContentView() +// } +// +// viewModel.error.observe = { [weak self] error in +// self?.showErrorView() +// } +// +// viewModel.resultMessage.observe = { [weak self] message in +// self?.resultMessage.text = message +// self?.showContentView() +// } +// +// viewModel.newAddress.observe = { [weak self] address in +// self?.resultMessage.text = address +// UIPasteboard.general.string = address +// self?.showContentView() +// } +// +// viewModel.walletWipe.observe = { _ in +// UIControl().sendAction(#selector(NSXPCConnection.suspend), to: UIApplication.shared, for: nil) +// DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { +// exit(0) +// } +// } +// viewModel.payments.observe = { [weak self] payments in +// self?.tableView.reloadData() +// } +// viewModel.channels.observe = { [weak self] payments in +// self?.tableView.reloadData() +// } +// viewModel.balance.observe = { [weak self] balance in +// self?.balance.text = balance +// } +// viewModel.invoice.observe = { [weak self] invoice in +// self?.invoiceLbl.text = invoice +// } +// viewModel.load() +// +// } +// +//} +//extension HomeViewController: UITextFieldDelegate{ +// @objc func handleTap() { +// textView.resignFirstResponder() // dismiss keyoard +// } +// +// func textFieldDidBeginEditing(_ textField: UITextField) { +// scrollView.setContentOffset(CGPoint(x: 0, y: textField.frame.height), animated: true) +// } +// func textFieldDidEndEditing(_ textField: UITextField) { +// +// if textField.hasText{ +// payInvoice.isHidden = false +// } +// scrollView.setContentOffset(CGPoint(x: 0, y: 0), animated: true) +// } +// func textFieldShouldReturn(_ textField: UITextField) -> Bool { +// textField.resignFirstResponder() // dismiss keyboard +// return true +// } +//} +//extension HomeViewController: UITextPasteDelegate { +// func textPasteConfigurationSupporting(_ textPasteConfigurationSupporting: UITextPasteConfigurationSupporting, shouldAnimatePasteOf attributedString: NSAttributedString, to textRange: UITextRange) -> Bool { +// return false +// } +//} +////MARK: - Wallet Management +//extension HomeViewController{ +// private func setupWallet(){ +// +// // let createButton = addDebugButton("Create wallet", action: { +// // self.viewModel.createWallet(password: self.password) +// // }) +// // let newAddressButton = addDebugButton("New address (copies to clipboard)", action: { +// // self.viewModel.getNewAddress() +// // }) +// // let wipeButton = addDebugButton("Wipe (and close) wallet", action: { +// // self.viewModel.wipeWallet() +// // }) +// unlockWallet = createButton("Unlock wallet", action: { +// self.viewModel.unlockWallet(password: self.password) +// self.balance = UILabel() +// self.balance.text = "..." +// self.balance.textColor = .blue +// self.balance.translatesAutoresizingMaskIntoConstraints = false +// self.balance.textAlignment = .center +// self.balance.numberOfLines = 0 +// self.stackView.addArrangedSubview(self.balance) +// }) +// walletStackView.addArrangedSubview(unlockWallet) +// +// stackView.addArrangedSubview(walletStackView) +// +// } +//} +////MARK: - Info +//extension HomeViewController{ +// private func showLNDStatus(){ +// +// resultMessage = UILabel() +// resultMessage.text = "..." +// resultMessage.translatesAutoresizingMaskIntoConstraints = false +// resultMessage.textColor = Theme.inverseBackgroundColor +// resultMessage.textAlignment = .center +// resultMessage.numberOfLines = 0 +// +// debugStatus = UILabel() +// debugStatus.translatesAutoresizingMaskIntoConstraints = false +// debugStatus.textColor = Theme.inverseBackgroundColor +// debugStatus.textAlignment = .center +// debugStatus.numberOfLines = 0 +// debugStatus.text = "Debug status" +// debugStackView.addArrangedSubview(resultMessage) +// debugStackView.addArrangedSubview(debugStatus) +// stackView.addArrangedSubview(debugStackView) +// } +// private func setupInfo(){ +// getInfo = createButton("Show info", action: { +// self.viewModel.getInfo() +// self.viewModel.getWalletBalance() +// }) +// infoStackView.addArrangedSubview(getInfo) +// stackView.addArrangedSubview(infoStackView) +// +// } +//} +// +////MARK: - Channel +//extension HomeViewController{ +// +// private func setupChannel(){ +// openChannel = createButton("Open channel", action: { +// self.viewModel.openChannel() +// }) +// listChannels = createButton("List channels", action: { +// self.isShowPayments = false +// self.showHideViews(showChannels: false, showPayments: true) +// self.viewModel.listChannels() +// +// }) +// channelStackView.addArrangedSubview(openChannel) +// channelStackView.addArrangedSubview(listChannels) +// stackView.addArrangedSubview(channelStackView) +// +// +// if viewModel.infoResponse.value?.numActiveChannels == 0 { +// listChannels.isHidden = false +// }else{ +// openChannel.isHidden = true +// } +// setupPayments() +// } +// +//} +// +////MARK: - Payments Management +//extension HomeViewController: UITableViewDelegate, UITableViewDataSource{ +// func showHideViews(showChannels: Bool, showPayments: Bool){ +// let isListShowing = (showChannels == showPayments) && showChannels +// let isOneMissing = (showChannels && !showPayments) || (!showChannels && showPayments) +// self.showPayments.isHidden = !showPayments +// self.listChannels.isHidden = !showChannels +// self.hideButton.isHidden = !isOneMissing +// self.tableView.isHidden = !isOneMissing +// self.debugStackView.isHidden = !isListShowing +// self.infoStackView.isHidden = !isListShowing +// self.sendStackView.isHidden = !isListShowing +// } +// func showHideViews(showPay: Bool, showReceive: Bool){ +// let hideOthers = !(showPay || showReceive) +// self.showHideViews(showChannels: hideOthers, showPayments: hideOthers) +// self.sendPayment.isHidden = showPay || showReceive +// self.receivePayment.isHidden = showPay || showReceive +// self.cancel.isHidden = showPay && showReceive +// self.payInvoice.isHidden = true +// self.generateInvoice.isHidden = true +// self.invoiceLbl.isHidden = true +// self.textView.isHidden = !showPay +// self.sendStackView.isHidden = false +// +// } +// private func setupPayments(){ +// +// showInvoices = createButton("Show invoices", action: { +// self.viewModel.listInvoices() +// }) +// hideButton = createButton("Hide", action: { +// self.showHideViews(showChannels: true, showPayments: true) +// }) +// showPayments = createButton("Show Payments History", action: { +// self.isShowPayments = true +// self.showHideViews(showChannels: true, showPayments: false) +// self.viewModel.listPayments() +// }) +// +// +// sendPayment = createButton("Send", action: { +// self.showHideViews(showPay: true, showReceive: false) +// }) +// receivePayment = createButton("Receive", action: { +// self.showHideViews(showPay: false, showReceive: true) +// self.generateInvoice.isHidden = false +// self.invoiceLbl.isHidden = false +// }) +// cancel = createButton("Cancel", action: { +// self.showHideViews(showChannels: true, showPayments: true) +// self.showHideViews(showPay: false, showReceive: false) +// self.cancel.isHidden = true +// }) +// generateInvoice = createButton("Generate Invoice", action: { +// self.showHideViews(showChannels: true, showPayments: true) +// self.showHideViews(showPay: false, showReceive: false) +// self.viewModel.createInvoice(amount: 200, comment: self.textView.text ?? "Test") +// self.viewModel.getWalletBalance() +// }) +// invoiceLbl = UILabel() +// invoiceLbl.text = "..." +// invoiceLbl.translatesAutoresizingMaskIntoConstraints = false +// invoiceLbl.numberOfLines = 0 +// +// payInvoice = createButton("Pay Invoice", action: { +// if let text = self.textView.text{ +// debugPrint("Invoice ", text) +// self.viewModel.payInvoice(invoice: text) +// +// }else{ +// +// } +// +// self.viewModel.getWalletBalance() +// self.showHideViews(showChannels: true, showPayments: true) +// self.showHideViews(showPay: false, showReceive: false) +// +// }) +// +// payInvoice.isHidden = true +// generateInvoice.isHidden = true +// invoiceLbl.isHidden = true +// tableView.isHidden = true +// hideButton.isHidden = true +// cancel.isHidden = true +// paymentStackView.addArrangedSubview(showInvoices) +// paymentStackView.addArrangedSubview(showPayments) +// paymentStackView.addArrangedSubview(hideButton) +// +// +// sendStackView.addArrangedSubview(sendPayment) +// sendStackView.addArrangedSubview(receivePayment) +// sendStackView.addArrangedSubview(cancel) +// sendStackView.addArrangedSubview(generateInvoice) +// sendStackView.addArrangedSubview(payInvoice) +// +// paymentStackView.addArrangedSubview(sendStackView) +// paymentStackView.addArrangedSubview(textView) +// paymentStackView.addArrangedSubview(invoiceLbl) +// +// paymentStackView.addArrangedSubview(tableView) +// stackView.addArrangedSubview(paymentStackView) +// } +// +// func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { +// if isShowPayments{ +// if let noOfPayments = viewModel.payments.value?.count{ +// return noOfPayments +// }else{ +// let emptyLabel = UILabel(frame: CGRect(x: 0, y: 0, width: self.view.bounds.size.width, height: self.view.bounds.size.height)) +// emptyLabel.text = "No Payments" +// emptyLabel.textAlignment = NSTextAlignment.center +// self.tableView.backgroundView = emptyLabel +// self.tableView.separatorStyle = UITableViewCell.SeparatorStyle.none +// return 0 +// } +// }else{ +// if let noOfChannels = viewModel.channels.value?.count{ +// return noOfChannels +// }else{ +// let emptyLabel = UILabel(frame: CGRect(x: 0, y: 0, width: self.view.bounds.size.width, height: self.view.bounds.size.height)) +// emptyLabel.text = "No Channels" +// emptyLabel.textAlignment = NSTextAlignment.center +// self.tableView.backgroundView = emptyLabel +// self.tableView.separatorStyle = UITableViewCell.SeparatorStyle.none +// return 0 +// } +// } +// +// +// +// } +// +// func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { +// let reuseCellIdentifier = "cellIdentifier" +// var cell = tableView.dequeueReusableCell(withIdentifier: reuseCellIdentifier) +// if (!(cell != nil)) { +// +// cell = UITableViewCell(style: .subtitle, reuseIdentifier: reuseCellIdentifier) +// } +// cell?.textLabel?.numberOfLines = 0 +// cell?.detailTextLabel?.numberOfLines = 0 +// if isShowPayments{ +// if let payment = viewModel.payments.value?[indexPath.row]{ +// cell?.textLabel?.text = "Status: \(payment.status) \nAmount: \(payment.value) sat" +// cell?.detailTextLabel?.text = "\nDate: \(Date(timeIntervalSince1970: TimeInterval(payment.creationDate))) \nPayment hash:\n\(payment.paymentRequest.description)" +// } +// }else{ +// if let channel = viewModel.channels.value?[indexPath.row]{ +// cell?.textLabel?.text = "Active: \(channel.active) \nLocal Balance: \(channel.localBalance) sat \nRemote Balance: \(channel.remoteBalance) sat" +// let pendingTransactions = channel.pendingHtlcs.count == 0 ? "" : "\nPending transactions: \(channel.pendingHtlcs)" +// cell?.detailTextLabel?.text = "\nPub key: \(channel.remotePubkey) \(pendingTransactions)" +// } +// } +// +// +// return cell! +// } + +} +public extension String { + func setColor(_ color: UIColor, ofSubstring substring: String) -> NSMutableAttributedString { + let range = (self as NSString).range(of: substring) + let attributedString = NSMutableAttributedString(string: self) + attributedString.addAttribute(NSAttributedString.Key.foregroundColor, value: color, range: range) + return attributedString + } +} diff --git a/wallet/ViewControllers/PaymentsVC.swift b/wallet/ViewControllers/PaymentsVC.swift new file mode 100644 index 0000000..686c0eb --- /dev/null +++ b/wallet/ViewControllers/PaymentsVC.swift @@ -0,0 +1,403 @@ +// +// PaymentsVC.swift +// wallet +// +// Created by Adriana Epure on 22.08.2022. +// Copyright © 2022 Jason. All rights reserved. +// + +import UIKit +import QRCodeScanner + +class PaymentsVC: CustomViewController { + + @IBOutlet weak var paymentElements: UIStackView! + @IBOutlet weak var selectedListControl: UISegmentedControl! + @IBOutlet weak var tableView: UITableView! + @IBOutlet weak var paymentButtonsStack: UIStackView! + @IBOutlet weak var localBalanceValue: UILabel! + @IBOutlet weak var remoteBalanceValue: UILabel! + @IBOutlet weak var walletBalanceValue: UILabel! + @IBOutlet weak var estimateFeeValue: UILabel! + + @IBOutlet weak var feeStackView: UIStackView! + //Send + @IBOutlet weak var sendStackView: UIStackView! + @IBOutlet weak var sendPaymentAddress: UITextView! + @IBOutlet weak var payBtn: UIButton! + @IBOutlet weak var paymentInfoStack: UIStackView! + @IBOutlet weak var paymentInfoLbl: UILabel! + @IBOutlet weak var memoLbl: UILabel! + @IBOutlet weak var paymentInfoCreated: UILabel! + @IBOutlet weak var paymentInfoExpiry: UILabel! + @IBOutlet weak var cancelPayBtn: UIButton! + + + //Receive + @IBOutlet weak var receiveStackView: UIStackView! + @IBOutlet weak var invoiceAmount: UITextField! + @IBOutlet weak var invoiceComment: UITextField! + @IBOutlet weak var amountStepper: UIStepper! + @IBOutlet weak var receivePaymentAddress: UITextView! + @IBOutlet weak var generateInvoiceBtn: UIButton! + @IBOutlet weak var cancelReceiveBtn: UIButton! + + + + + override func viewDidLoad() { + super.viewDidLoad() + viewModel.getInfo() + title = "Payments" + tableView.delegate = self + tableView.dataSource = self + selectedListControl.selectedSegmentIndex == 0 ? viewModel.listPayments() : viewModel.listInvoices() + } + override func viewModelDidLoad() { + viewModel.invoices.observe = { [weak self] invoices in + self?.tableView.reloadData() + } + viewModel.payments.observe = { [weak self] payments in + self?.tableView.reloadData() + } + viewModel.channelBalance.observe = { [weak self] balance in + self?.localBalanceValue.text = String(balance) + } + viewModel.walletBalance.observe = { [weak self] walletBalance in + self?.walletBalanceValue.text = String(walletBalance.total) + } + viewModel.isLoading.observe = { [weak self] isLoading in + self?.viewModel.updateBalance() + } + viewModel.paymentInfo.observe = { [weak self] paymentInfo in + if let paymentInfo = paymentInfo{ + self?.paymentInfoStack.isHidden = false + self?.payBtn.isHidden = false + self?.paymentInfoLbl.text = String(paymentInfo.numSatoshis) + self?.paymentInfoCreated.text = paymentInfo.timestamp.getAsDate().format(style: .medium) + self?.paymentInfoExpiry.text = String(paymentInfo.timestamp.getAsDate().adding(seconds: Int(paymentInfo.expiry)).format(style: .medium)) + self?.memoLbl.text = String(paymentInfo.description_p) + }else{ + self?.paymentInfoStack.isHidden = true + self?.payBtn.isHidden = true + self?.paymentInfoCreated.text = "" + self?.paymentInfoLbl.text = "" + self?.paymentInfoExpiry.text = "" + self?.memoLbl.text = "" + } + } + viewModel.load() + + } + +//MARK: - Selection + @IBAction func didChangeSelection(_ sender: Any) { + selectedListControl.selectedSegmentIndex == 0 ? viewModel.listPayments() : viewModel.listInvoices() + tableView.reloadData() + } + + @IBAction func didPressCancel(_ sender: Any) { + showHideViews(isSending: !sendStackView.isHidden, isFinished: true) + } + +//MARK: - Send + @IBAction func didPressSend(_ sender: Any) { + sendPaymentAddress.text = "Input Address ..." + sendPaymentAddress.textColor = UIColor.lightGray + sendPaymentAddress.delegate = self + sendPaymentAddress.layer.borderColor = UIColor.lightGray.cgColor + sendPaymentAddress.layer.borderWidth = 1 + showHideViews(isSending: true, isFinished: false) + } + + @IBAction func didPressScan(_ sender: Any) { + + // Create an instance of QRCodeScanViewController + let viewController = QRCodeScanViewController.create() + + // Set itself as delegate + viewController.delegate = self + + // Present the view controller + self.present(viewController, animated: true) + } + @IBAction func didPressPay(_ sender: Any) { + + self.selectedListControl.selectedSegmentIndex = 0 + self.selectedListControl.sendActions(for: .valueChanged) + if let paymentAddress = sendPaymentAddress.text{ + debugPrint("Invoice ", paymentAddress) + self.viewModel.payInvoice(invoice: paymentAddress) { response in + self.showAlert(title: "Payment", errorMsg: "Payment Request Sent") + } onFailure: { error in + self.showAlert(title: "Payment", errorMsg: error.debugDescription) + } + + self.showAlert(title: "Payment", errorMsg: "Payment Request Sent") + }else{ + self.showAlert(title: "Payment", errorMsg: "Payment Request Failed") + } + showHideViews(isSending: true, isFinished: true) + } + + +//MARK: - Receive + @IBAction func didPressReceive(_ sender: Any) { + invoiceComment.delegate = self + invoiceAmount.delegate = self + showHideViews(isSending: false, isFinished: false) + + } + + @IBAction func didUpdateStepper(_ sender: UIStepper) { + invoiceAmount.text = String(String(format: "%.f", sender.value)) + estimateFeeValue.text = String(String(format: "%.2f", sender.value/1000)) + generateInvoiceBtn.isHidden = false + } + @IBAction func didPressGenerateBtn(_ sender: Any) { + + self.selectedListControl.selectedSegmentIndex = 1 + self.selectedListControl.sendActions(for: .valueChanged) + guard let amountText = invoiceAmount.text else{ + self.showAlert(title: "Invoice", errorMsg: "Empty Amount") + return + } + + debugPrint("✅", amountText) + guard let amount:Int = Int(amountText) else{ + self.showAlert(title: "Invoice", errorMsg: "Invalid Amount") + return + } + guard let balance:Int = viewModel.walletBalance.value?.total else { + self.showAlert(title: "Invoice", errorMsg: "Invalid wallet balance") + return + } + + if(amount > balance){ + self.showAlert(title: "Invoice", errorMsg: "Insufficient funds") + }else if amount == 0{ + self.showAlert(title: "Invoice", errorMsg: "No amount selected") + }else{ + createInvoice(amount: amount, comment: invoiceComment.text ?? "") + } + showHideViews(isSending: false, isFinished: true) + + } + func showHideViews(isSending: Bool, isFinished: Bool){ + sendStackView.isHidden = isFinished || (!isFinished && !isSending) + receiveStackView.isHidden = isFinished || (!isFinished && isSending) + feeStackView.isHidden = isFinished || (!isFinished && isSending) + paymentButtonsStack.isHidden = !isFinished + tableView.isHidden = !isFinished + selectedListControl.isHidden = !isFinished + generateInvoiceBtn.isHidden = true + payBtn.isHidden = true + if isFinished{ + invoiceComment.text = "" + invoiceAmount.text = "0" + estimateFeeValue.text = "0" + sendPaymentAddress.text = "" + } + } + + +} +//MARK: - Create Invoice +extension PaymentsVC{ + func createInvoice(amount: Int, comment: String){ + self.showLoadingView() + viewModel.createInvoice(amount: amount, comment: comment) { paymentRequest in + self.showContentView() + self.showAlert(title: "Invoice", address: paymentRequest) + } onFailure: { error in + self.showContentView() + self.showAlert(title: "Invoice", errorMsg: error.debugDescription) + } + + } + +} +extension PaymentsVC: UITableViewDelegate, UITableViewDataSource{ + + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + let emptyLabel = UILabel(frame: CGRect(x: 0, y: 0, width: self.view.bounds.size.width, height: self.view.bounds.size.height)) + emptyLabel.text = "" + emptyLabel.textAlignment = NSTextAlignment.center + self.tableView.backgroundView = emptyLabel + if selectedListControl.selectedSegmentIndex == 0{ + if let noOfPayments = viewModel.payments.value?.count{ + return noOfPayments + }else{ + emptyLabel.text = "No Payments" + self.tableView.separatorStyle = UITableViewCell.SeparatorStyle.none + return 0 + } + }else{ + if let noOfInvoices = viewModel.invoices.value?.count{ + return noOfInvoices + }else{ + emptyLabel.text = "No Invoices" + self.tableView.separatorStyle = UITableViewCell.SeparatorStyle.none + return 0 + } + } + + + + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let reuseCellIdentifier = "cellIdentifier" + var cell = tableView.dequeueReusableCell(withIdentifier: reuseCellIdentifier) + if (!(cell != nil)) { + + cell = UITableViewCell(style: .subtitle, reuseIdentifier: reuseCellIdentifier) + } + cell?.textLabel?.numberOfLines = 0 + cell?.detailTextLabel?.numberOfLines = 0 + if selectedListControl.selectedSegmentIndex == 0{ + if let payment = viewModel.payments.value?[indexPath.row]{ + cell?.textLabel?.text = "Status: \(payment.status) \nAmount: \(payment.value) sat" + cell?.detailTextLabel?.text = "\nDate: \(payment.creationDate.getAsDate()) \nFee:\(payment.feeSat) \nPayment hash:\n\(payment.paymentRequest.description)" + } + }else{ + if let invoice = viewModel.invoices.value?[indexPath.row]{ + cell?.textLabel?.text = "Status: \(invoice.state) \nAmount: \(invoice.value) sat" + cell?.detailTextLabel?.text = "\nDate Created: \(invoice.creationDate.getAsDate()) \nMemo:\(invoice.memo) \nPayment request: \(invoice.paymentRequest)" + } + } + + + return cell! + } + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + if selectedListControl.selectedSegmentIndex == 0{ + if let payment = viewModel.payments.value?[indexPath.row]{ + UIPasteboard.general.string = payment.paymentRequest.description + } + }else{ + if let invoice = viewModel.invoices.value?[indexPath.row]{ + self.showAlert(title: "Invoice", address: invoice.paymentRequest) + } + } + } + +} + +extension PaymentsVC: UITextFieldDelegate{ + /** + * Called when 'return' key pressed. return NO to ignore. + */ + func textFieldShouldReturn(_ textField: UITextField) -> Bool { + if !(invoiceAmount.text?.isEmpty ?? true){ + generateInvoiceBtn.isHidden = false + } + textField.resignFirstResponder() + return true + } + + func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { + if textField == invoiceAmount{ + let allowedCharacters = CharacterSet.decimalDigits + let characterSet = CharacterSet(charactersIn: string) + return allowedCharacters.isSuperset(of: characterSet) + } + return true + } + /** + * Called when the user click on the view (outside the UITextField). + */ + func touchesBegan(touches: Set, withEvent event: UIEvent?) { + self.view.endEditing(true) + } + +} +extension PaymentsVC: UITextPasteDelegate { + func textPasteConfigurationSupporting(_ textPasteConfigurationSupporting: UITextPasteConfigurationSupporting, shouldAnimatePasteOf attributedString: NSAttributedString, to textRange: UITextRange) -> Bool { + return false + } +} + +extension PaymentsVC: UITextViewDelegate{ + func textViewDidBeginEditing(_ textView: UITextView) { + if textView.textColor == UIColor.lightGray { + textView.text = nil + textView.textColor = UIColor.black + } + } + func textViewDidEndEditing(_ textView: UITextView) { + if textView.text.isEmpty { + textView.text = "Input Address ..." + textView.textColor = UIColor.lightGray + } + } + func textViewDidChange(_ textView: UITextView) { + + if(textView.text == UIPasteboard.general.string){ + } + } + func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool { + + // Combine the textView text and the replacement text to + // create the updated text string + let currentText:String = textView.text + let updatedText = (currentText as NSString).replacingCharacters(in: range, with: text) + + // If updated text view will be empty, add the placeholder + // and set the cursor to the beginning of the text view + if updatedText.isEmpty { + + textView.text = "Input Address ..." + textView.textColor = UIColor.lightGray + + textView.selectedTextRange = textView.textRange(from: textView.beginningOfDocument, to: textView.beginningOfDocument) + } + + // Else if the text view's placeholder is showing and the + // length of the replacement string is greater than 0, set + // the text color to black then set its text to the + // replacement string + else if textView.textColor == UIColor.lightGray && !text.isEmpty { + textView.textColor = UIColor.black + textView.text = text + }else if text == "\n" { + textView.resignFirstResponder() + self.viewModel.getPaymentDetail(invoice: textView.text) + return false + } + + // For every other case, the text should change with the usual + // behavior... + else { + return true + } + + // ...otherwise return false since the updates have already + // been made + return false + } + func textViewDidChangeSelection(_ textView: UITextView) { + if self.view.window != nil { + if textView.textColor == UIColor.lightGray { + textView.selectedTextRange = textView.textRange(from: textView.beginningOfDocument, to: textView.beginningOfDocument) + } + } + } +} +extension PaymentsVC: QRCodeScanViewControllerDelegate{ + // MARK: QRCodeScanViewControllerDelegate + + /// Called when the camera scans a QR code + /// - Parameters: + /// - viewController: View controller that scanned the QR code + /// - value: String encoded in the QR code + func qrCodeScanViewController(_ viewController: QRCodeScanViewController, didScanQRCode value: String) { + + // Dismiss the view controller + viewController.dismiss(animated: true) { + self.sendPaymentAddress.text = value + self.sendPaymentAddress.tintColor = UIColor.black + self.viewModel.getPaymentDetail(invoice: value) + } + } +} diff --git a/wallet/ViewControllers/PaymentsVC.xib b/wallet/ViewControllers/PaymentsVC.xib new file mode 100644 index 0000000..d2ee00b --- /dev/null +++ b/wallet/ViewControllers/PaymentsVC.xib @@ -0,0 +1,504 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wallet/ViewModels/ChannelsViewModel.swift b/wallet/ViewModels/ChannelsViewModel.swift new file mode 100644 index 0000000..38ddf40 --- /dev/null +++ b/wallet/ViewModels/ChannelsViewModel.swift @@ -0,0 +1,33 @@ +// +// ChannelsViewModel.swift +// wallet +// +// Created by Adriana Epure on 23.08.2022. +// Copyright © 2022 Jason. All rights reserved. +// + +import Foundation + + +class ChannelsViewModel: ViewModel { + + private let exampleRepo = ExampleRepository() + let randomInt = Observable() + let error = Observable() + let resultMessage = Observable() + + + + //TODO: Hardcoded values. Change these later.mailto:0245fc5e867abb5b83ead35b50dc5013dd358b9f3eb48c02f5e1cc9fc675039359@uld2jqbrrwsowhxobvxlrl6j7qc2rmccsmnnf6ba4jepkugxqkyohvad.onion:9735 + private var nodePubKey = try! NodePublicKey("0245fc5e867abb5b83ead35b50dc5013dd358b9f3eb48c02f5e1cc9fc675039359") + private var hostAddress = "bmadesign.go.ro" + private var hostPort: UInt = 9735 + +// private let closeAddress = "tb1qylxttvn7wm7vsc2j36cjvmpl7nykcrzqkz6avl" + // private let invoice = "lnbcrt1u1p04e4cypp5qyxj3u8dm2pjsdang94lj6c0d9p33l05999945atjrfyw0nle0ssdqqcqzpgsp5dqlzsd63a0akx9wgv8v9scryj3gn7fe3s8ca9l26s9tjlwkvtv4q9qy9qsq4kv825h86yummfcerkvctfh8c4aw6vc0r986dsyjtp6dun5ysurq2zh0nj6qd4cuf5qskpn9pwre5u26ncce4qy3ataw88p6j08y0xcqy4uxa7" + + + + + +} diff --git a/wallet/ViewModels/HomeViewModel.swift b/wallet/ViewModels/HomeViewModel.swift new file mode 100644 index 0000000..7cfe872 --- /dev/null +++ b/wallet/ViewModels/HomeViewModel.swift @@ -0,0 +1,14 @@ + // + // HomeViewModel.swift + // wallet + // + // Created by Jason on 8/23/20. + // Copyright © 2020 Jason. All rights reserved. + // + +import Foundation + +class HomeViewModel: ViewModel { + + +} diff --git a/wallet/ViewModels/PaymentsViewModel.swift b/wallet/ViewModels/PaymentsViewModel.swift new file mode 100644 index 0000000..74ad85e --- /dev/null +++ b/wallet/ViewModels/PaymentsViewModel.swift @@ -0,0 +1,40 @@ +// +// PaymentsViewModel.swift +// wallet +// +// Created by Adriana Epure on 22.08.2022. +// Copyright © 2022 Jason. All rights reserved. +// + + +class PaymentsViewModel: ViewModel { + + let paymentInfo = Observable() + + + func updateBalance(){ + self.getWalletBalance() + self.getChannelBalance() + } + func getPaymentDetail(invoice: String){ + self.getPaymentInfo(invoice: invoice) { payment in + self.paymentInfo.value = payment + } onFailure: { error in + self.paymentInfo.value = nil + } + + } + func sendPayment(invoice: String, completion: @escaping (String) -> Void) { + self.payInvoice(invoice: invoice) { response in + self.listPayments() + self.updateBalance() + + debugPrint(response.paymentRoute.totalAmt, response.paymentRoute.totalFees, response.paymentError.debugDescription) + } onFailure: { error in + + } + + } + + +} diff --git a/wallet/ViewModels/RequestViewModel.swift b/wallet/ViewModels/RequestViewModel.swift new file mode 100644 index 0000000..0db3576 --- /dev/null +++ b/wallet/ViewModels/RequestViewModel.swift @@ -0,0 +1,26 @@ +// +// RequestViewModel.swift +// wallet +// +// Created by Jason on 8/30/20. +// Copyright © 2020 Jason. All rights reserved. +// + +import Foundation + +class RequestViewModel: ViewModel { + + let amount = Observable() + let note = Observable() + let invoice = Observable() + + // TODO: Add the proper repo or values in here to handle creating the lnd invoice + func createInvoice() { + + let example = "lightning:lnbcrt5u1pdam80cpp5hrx4jp3hwe0vrl3jyft95fnfvgsvc327xw5j63mfchc6nazl87csdphf35kw6r5wahhy6eqx43xgepev3jkxctyxumrjdrxxqmn2ctrve3njvscqzys9htkyg7r5kesumuhkntta8syzc2uclqj2lrq5spwppa2r4d2dm49pkhpjemjp3rrm0se4cmakcqgrakpk9hlnv2mgj3dus3yujfzhqsqa7satk" + + invoice.value = example + + } + +} diff --git a/wallet/ViewModels/ViewModel.swift b/wallet/ViewModels/ViewModel.swift new file mode 100644 index 0000000..2c7164b --- /dev/null +++ b/wallet/ViewModels/ViewModel.swift @@ -0,0 +1,318 @@ + // + // ViewModel.swift + // wallet + // + // Created by Jason on 8/23/20. + // Copyright © 2020 Jason. All rights reserved. + // + +import Foundation +struct WalletBalance{ + let total: Int + let confirmed: Int + let unconfirmed: Int +} +class ViewModel { + //TODO: Hardcoded values. Change these later.mailto:0245fc5e867abb5b83ead35b50dc5013dd358b9f3eb48c02f5e1cc9fc675039359@uld2jqbrrwsowhxobvxlrl6j7qc2rmccsmnnf6ba4jepkugxqkyohvad.onion:9735 + private var nodePubKey = try! NodePublicKey("0245fc5e867abb5b83ead35b50dc5013dd358b9f3eb48c02f5e1cc9fc675039359") + private var hostAddress = "bmadesign.go.ro" + private var hostPort: UInt = 9735 + private let closeAddress = "tb1qylxttvn7wm7vsc2j36cjvmpl7nykcrzqkz6avl" + let newAddress = Observable() + private let exampleRepo = ExampleRepository() + let isLoading = Observable() + let lightningRepo = LightningRepository() + let walletWipe = Observable() + let walletBalance = Observable() + let channelBalance = Observable() + let lndInfo = Observable() + let channels = Observable<[Lnrpc_Channel]>() + let closedChannels = Observable<[Lnrpc_ChannelCloseSummary]>() + let pendingChannels = Observable() + let peers = Observable<[Lnrpc_Peer]>() + let invoices = Observable<[Lnrpc_Invoice]>() + let payments = Observable<[Lnrpc_Payment]>() + required init() { + // Empty + } + //MARK: - LND + func load() { + + isLoading.value = true + + // This is an example of a fetch to some data provider (i.e. an http api or something else) + // and where you can place the observed response + exampleRepo.getRandomInt( + onSuccess: { [weak self] someInt in + self?.isLoading.value = false + }, + onFailure: { [weak self] error in + self?.isLoading.value = false + }) + + } + func getInfo() { + + self.isLoading.value = true + + lightningRepo.getInfo { [weak self] (res) in + self?.isLoading.value = false + self?.lndInfo.value = res + debugPrint("Response get Info", res) + } onFailure: { [weak self] (error) in + self?.isLoading.value = false + } + } + func getNewAddress() { + self.isLoading.value = true + + lightningRepo.getNewAddress( + onSuccess: { [weak self] address in + self?.isLoading.value = false + self?.newAddress.value = address + debugPrint("Address :", address) + }, + onFailure: { [weak self] error in + self?.isLoading.value = false + debugPrint(error?.localizedDescription as Any) + }) + } + //MARK: - Wallet + func createWallet(password: String) { + + self.isLoading.value = true + + lightningRepo.createWallet( + password: password, + onSuccess: { [weak self] seed in + self?.isLoading.value = false + }, + onFailure: { [weak self] error in + self?.isLoading.value = false + }) + + } + + func unlockWallet(password: String) { + + self.isLoading.value = true + + lightningRepo.unlockWallet( + password: password, + onSuccess: { [weak self] in + self?.isLoading.value = false + self?.getInfo() + self?.getWalletBalance() + }, + onFailure: { [weak self] error in + self?.isLoading.value = false + debugPrint(error?.localizedDescription as Any) + }) + } + func getWalletBalance() { + lightningRepo.getWalletBalance( + onSuccess: { [weak self] (total, confirmed, unconfirmed) in + self?.walletBalance.value = WalletBalance(total: Int(total), confirmed: Int(confirmed), unconfirmed: Int(unconfirmed)) + }, + onFailure: { error in + debugPrint("Wallet balance error", error?.localizedDescription as Any) // TODO: Change to error + }) + } + func wipeWallet() { + + self.isLoading.value = true + + lightningRepo.wipeWallet( + onSuccess: { [weak self] in + self?.isLoading.value = false + self?.walletWipe.value = () + }, + onFailure: { [weak self] error in + self?.isLoading.value = false + debugPrint(error?.localizedDescription as Any) + }) + } + //MARK: - Channels + func openChannel(nodePubKey: String, hostAddress: String, port: UInt, pushSat: Int, localFunding: Int, onSuccess: @escaping (String) -> Void, onFailure: @escaping (Error?) -> Void) { + + debugPrint("Node pub key", nodePubKey, hostAddress, port, pushSat, localFunding) + lightningRepo.openChannel( + localFunding: Int64(localFunding), + pushSat: Int64(pushSat), + host: hostAddress, + port: port, + nodePubKey: try! NodePublicKey(nodePubKey), + closeAddress: nil, + onSuccess: { message in + onSuccess(message) + }, + onFailure: { error in + onFailure(error) + }) + } + func closeChannel(channel:Lnrpc_Channel, onSuccess: @escaping (String) -> Void, onFailure: @escaping (Error?) -> Void) { + + lightningRepo.closeChannel(channel: channel) { response in + self.listChannels() + debugPrint("Response", response) + } onFailure: { error in + debugPrint("Error", error) + } + + } + + func listChannels() { + + self.isLoading.value = true + + lightningRepo.listChannels(onSuccess: { [weak self] (response) in + self?.isLoading.value = false + self?.channels.value = response.channels.sorted{$0.uptime > $1.uptime} + debugPrint("Channels response ", response) + + }) { [weak self] (error) in + self?.isLoading.value = false + } + } + func listClosedChannels() { + + self.isLoading.value = true + + lightningRepo.listClosedChannels(onSuccess: { [weak self] (response) in + self?.isLoading.value = false + self?.closedChannels.value = response.channels + debugPrint("Channels response ", response) + + }) { [weak self] (error) in + self?.isLoading.value = false + } + } + func listPendingChannels() { + + self.isLoading.value = true + + lightningRepo.listPendingChannels(onSuccess: { [weak self] (response) in + self?.isLoading.value = false + self?.pendingChannels.value = response + debugPrint("Channels response ", response) + + }) { [weak self] (error) in + self?.isLoading.value = false + } + } + func getChannelBalance(){ + lightningRepo.getLightningChannelBalance { balance in + self.channelBalance.value = Int(balance.balance) + debugPrint("Channel balance", balance) + } onFailure: { error in + debugPrint("Channel balance error", error.debugDescription) + } + + } + func getChannelInfo(id: UInt64, onSuccess: @escaping (Lnrpc_ChannelEdge) -> Void, onFailure: @escaping (Error?) -> Void) { + lightningRepo.getChannelInfo(id: id) { (channel) in + onSuccess(channel) + } onFailure: { (error) in + onFailure(error) + } + + } + + + //MARK: - Peers + func listPeers(){ + lightningRepo.listPeers { res in + debugPrint("Listing peers response", res.peers) + self.peers.value = res.peers + if res.peers.count > 0 { + if let pubKey = res.peers.first?.pubKey { + self.nodePubKey = try! NodePublicKey(pubKey) + if let address = res.peers.first?.address{ + let addressArray = address.split(separator: ":") + self.hostAddress = addressArray[0].description + self.hostPort = UInt(addressArray[1].description) ?? 9735 + } + } + } + } onFailure: { error in + debugPrint("Listing peers error", error ?? "") + } + } + //MARK: - Payments + func listPayments(){ + + self.isLoading.value = true + lightningRepo.listPayments { [weak self] (response) in + self?.isLoading.value = false + debugPrint("Response", response.payments) + self?.payments.value = response.payments.sorted{$0.creationDate > $1.creationDate} + + } onFailure: { error in + debugPrint("Listing payments error", error ?? "") + self.isLoading.value = false + debugPrint(error?.localizedDescription as Any) + } + + } + func getPaymentInfo(invoice: String, onSuccess: @escaping (Lnrpc_PayReq) -> Void, onFailure: @escaping (Error?) -> Void) { + lightningRepo.getPaymentInfo(paymentRequest: invoice, onSuccess: {onSuccess($0)}, onFailure: {onFailure($0)}) + } + + //MARK: - Invoices + func estimateFee(address: String, amount: Int, onSuccess: @escaping (String) -> Void, onFailure: @escaping (Error?) -> Void) { + lightningRepo.estimateFee(address: address, amount: Int64(amount)) { response in + debugPrint("Fee estimator response", response) + } onFailure: { error in + debugPrint("Fee estimator error", error.debugDescription) + } + + } + func feeReport(onSuccess: @escaping (String) -> Void, onFailure: @escaping (Error?) -> Void) { + lightningRepo.feeReport() { response in + debugPrint("Fee report response", response) + } onFailure: { error in + debugPrint("Fee report error", error.debugDescription) + } + + } + func createInvoice(amount: Int, comment: String, onSuccess: @escaping (String) -> Void, onFailure: @escaping (Error?) -> Void) { + self.isLoading.value = true + + lightningRepo.createInvoice(amount: amount, memo: comment, onSuccess: { (response) in + self.isLoading.value = false + onSuccess(response.paymentRequest) + },onFailure: { error in + self.isLoading.value = false + onFailure(error) + }) + } + func payInvoice(invoice: String, onSuccess: @escaping (Lnrpc_SendResponse) -> Void, onFailure: @escaping (Error?) -> Void) { + + self.isLoading.value = true + + lightningRepo.pay(paymentRequest: invoice, onSuccess: { [weak self] (response) in + + self?.isLoading.value = false + + onSuccess(response) + },onFailure: { [weak self] error in + self?.isLoading.value = false + debugPrint(error?.localizedDescription as Any) + onFailure(error) + }) + } + + func listInvoices(){ + + self.isLoading.value = true + + lightningRepo.listInvoices(onSuccess: { [weak self] (response) in + self?.isLoading.value = false + debugPrint("Response", response.invoices) + self?.invoices.value = response.invoices.sorted{$0.creationDate > $1.creationDate} + }) { [weak self] (error) in + self?.isLoading.value = false + debugPrint(error?.localizedDescription as Any) + } + } +} diff --git a/wallet/Views/CustomButton.swift b/wallet/Views/CustomButton.swift new file mode 100644 index 0000000..fb8b222 --- /dev/null +++ b/wallet/Views/CustomButton.swift @@ -0,0 +1,59 @@ + +import UIKit + +class CustomButton: UIButton { + + @objc private var action: () -> Void + private var didSetCorners = false + private let label = UILabel() + var title: String? { + get { + return label.text + } + set(newTitle) { + label.text = newTitle?.uppercased() + } + } + + init(action: @escaping () -> Void) { + self.action = action + super.init(frame: .zero) + setup() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + private func setup() { + backgroundColor = Theme.primaryColor + clipsToBounds = true + addLabel() + addTapRecognizer() + } + + private func addTapRecognizer() { + let tap = UITapGestureRecognizer(target: self, action: #selector(tap(_:))) + addGestureRecognizer(tap) + } + + @objc private func tap(_ sender: UITapGestureRecognizer) { + self.action() + } + + private func addLabel() { + label.textColor = .gray900 + label.textAlignment = .center + label.font = Fonts.sofiaPro(weight: .regular, Dimens.normalText) + self.addSubviewAndFill(label, top: 2.0, leading: CGFloat(Dimens.mediumMargin), trailing: -CGFloat(Dimens.mediumMargin)) + } + + override func layoutSublayers(of layer: CALayer) { + super.layoutSublayers(of: layer) + if (!didSetCorners) { + didSetCorners = true + layer.cornerRadius = frame.height / 2 + } + } + +} diff --git a/wallet/Views/ErrorView.swift b/wallet/Views/ErrorView.swift new file mode 100644 index 0000000..d493e50 --- /dev/null +++ b/wallet/Views/ErrorView.swift @@ -0,0 +1,39 @@ +// +// ErrorView.swift +// wallet +// +// Created by Jason on 8/23/20. +// Copyright © 2020 Jason. All rights reserved. +// + +import UIKit + +class ErrorView: UIView { + + var title: String? { + get { + return label.text + } + set(newTitle) { + label.text = newTitle + } + } + + private lazy var label: UILabel = { + let label = UILabel() + label.textColor = Theme.inverseBackgroundColor + label.textAlignment = .center + return UILabel() + }() + + init() { + super.init(frame: .zero) + backgroundColor = Theme.backgroundColor + addSubviewAndFill(label) + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + +} diff --git a/wallet/Views/LoadingView.swift b/wallet/Views/LoadingView.swift new file mode 100644 index 0000000..5d70779 --- /dev/null +++ b/wallet/Views/LoadingView.swift @@ -0,0 +1,29 @@ +// +// LoadingView.swift +// wallet +// +// Created by Jason on 8/23/20. +// Copyright © 2020 Jason. All rights reserved. +// + +import UIKit + +class LoadingView: UIView { + + init() { + super.init(frame: .zero) + backgroundColor = Theme.backgroundColor + addLoadingIndicator() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + private func addLoadingIndicator() { + let loadingIndicator = UIActivityIndicatorView(style: .large) + self.addSubviewAndFill(loadingIndicator) + loadingIndicator.startAnimating() + } + +} diff --git a/wallet/Views/NumberPad.swift b/wallet/Views/NumberPad.swift new file mode 100644 index 0000000..1e65e56 --- /dev/null +++ b/wallet/Views/NumberPad.swift @@ -0,0 +1,40 @@ +// +// NumberPad.swift +// wallet +// +// Created by Jason on 8/30/20. +// Copyright © 2020 Jason. All rights reserved. +// + +import UIKit + +class CheddarNumberPad: UIView { + + @objc private var onItemClicked: (String) -> Void + @objc private var onBackspaceClicked: () -> Void + + init(onItemClicked: @escaping (String) -> Void, onBackspaceClicked: @escaping () -> Void) { + self.onItemClicked = onItemClicked + self.onBackspaceClicked = onBackspaceClicked + super.init(frame: .zero) + setup() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + private func setup() { + backgroundColor = Theme.shadowColor + } + + private func createButtons() { + + // Create 1 to 9 + for i in 1...10 { + print(i) + } + + } + +} diff --git a/wallet/en.lproj/Localizable.strings b/wallet/en.lproj/Localizable.strings new file mode 100644 index 0000000..bd19efc --- /dev/null +++ b/wallet/en.lproj/Localizable.strings @@ -0,0 +1,23 @@ +/* + Localizable.strings + wallet + + Created by Jason on 8/23/20. + Copyright © 2020 Jason. All rights reserved. +*/ + +"REQUEST" = "Request"; +"NOTE" = "Note"; +"NEXT" = "Next"; +"FOR" = "For"; +"NOTE_PLACEHOLDER" = "Write a message"; +"CREATE_QR" = "Create QR Code"; +"DEFAULT_ERROR" = "An error occured"; + + +//LND errors +"LND_ERROR_UNKNOWN" = "An error unknown occured"; +"LND_ERROR_MAPPING" = "An error unknown occured"; +"LND_ERROR_INVALID_PASSWORD" = "Invalid wallet password"; +"LND_ERROR_PAYMENT" = "Payment error (%@)"; + diff --git a/wallet/wallet-Bridging-Header.h b/wallet/wallet-Bridging-Header.h new file mode 100644 index 0000000..7952f66 --- /dev/null +++ b/wallet/wallet-Bridging-Header.h @@ -0,0 +1,6 @@ +// +// Use this file to import your target's public headers that you would like to expose to Swift. +// + +#import "../Lndmobile.framework/Headers/Lndmobile.h" + diff --git a/wallet/walletTests-Bridging-Header.h b/wallet/walletTests-Bridging-Header.h new file mode 100644 index 0000000..7952f66 --- /dev/null +++ b/wallet/walletTests-Bridging-Header.h @@ -0,0 +1,6 @@ +// +// Use this file to import your target's public headers that you would like to expose to Swift. +// + +#import "../Lndmobile.framework/Headers/Lndmobile.h" + diff --git a/walletTests/Info.plist b/walletTests/Info.plist new file mode 100644 index 0000000..64d65ca --- /dev/null +++ b/walletTests/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/walletTests/LightningTests.swift b/walletTests/LightningTests.swift new file mode 100644 index 0000000..503c0e2 --- /dev/null +++ b/walletTests/LightningTests.swift @@ -0,0 +1,52 @@ +// +// walletTests.swift +// walletTests +// +// Created by Jason on 8/12/20. +// Copyright © 2020 Jason. All rights reserved. +// + +import XCTest +@testable import wallet + +class walletTests: XCTestCase { + + override func setUp() { + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDown() { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testPublicKey() { + XCTAssertNoThrow(_ = try NodePublicKey("03236a685d30096b26692dce0cf0fa7c8528bdf61dbf5363a3ef6d5c92733a3016")) + XCTAssertNoThrow(_ = try NodePublicKey("02346504c3bf5891949a3ff350585042557486c1fdb227639d7bb999e940c62c3a")) + + XCTAssertThrowsError(_ = try NodePublicKey("13236a685d30096b26692dce0cf0fa7c8528bdf61dbf5363a3ef6d5c92733a3016")) + XCTAssertThrowsError(_ = try NodePublicKey("03236a685d30096b26692dce0cf0fa7c8528bdf61dbf5363a3ef6d5c92733a301")) + XCTAssertThrowsError(_ = try NodePublicKey("lol")) + } + + func testLND() { + return //TODO figure out why LND can't be started from tests + Lightning.shared.purge() + + let startExpectation = expectation(description: "LND started") + let rpcExpectation = expectation(description: "LND RPC became ready") + + Lightning.shared.start({ (error) in + XCTAssertNil(error, "Start LND error") + startExpectation.fulfill() + }) { (error) in + XCTAssertNil(error, "Start RPC error") + rpcExpectation.fulfill() + } + + waitForExpectations(timeout: 10) { error in + if let error = error { + XCTFail(error.localizedDescription) + } + } + } +} diff --git a/walletUITests/Info.plist b/walletUITests/Info.plist new file mode 100644 index 0000000..64d65ca --- /dev/null +++ b/walletUITests/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/walletUITests/walletUITests.swift b/walletUITests/walletUITests.swift new file mode 100644 index 0000000..c4f1544 --- /dev/null +++ b/walletUITests/walletUITests.swift @@ -0,0 +1,43 @@ +// +// walletUITests.swift +// walletUITests +// +// Created by Jason on 8/12/20. +// Copyright © 2020 Jason. All rights reserved. +// + +import XCTest + +class walletUITests: XCTestCase { + + override func setUp() { + // Put setup code here. This method is called before the invocation of each test method in the class. + + // In UI tests it is usually best to stop immediately when a failure occurs. + continueAfterFailure = false + + // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. + } + + override func tearDown() { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testExample() { + // UI tests must launch the application that they test. + let app = XCUIApplication() + app.launch() + + // Use recording to get started writing UI tests. + // Use XCTAssert and related functions to verify your tests produce the correct results. + } + + func testLaunchPerformance() { + if #available(macOS 10.15, iOS 13.0, tvOS 13.0, *) { + // This measures how long it takes to launch your application. + measure(metrics: [XCTOSSignpostMetric.applicationLaunch]) { + XCUIApplication().launch() + } + } + } +}