Skip to content

Commit

Permalink
Merge pull request #26 from lightninglabs/2023-08-update-to-lnc-core-…
Browse files Browse the repository at this point in the history
…v0.2.6-alpha

Update to lnc-core v0.2.6-alpha
  • Loading branch information
ViktorTigerstrom authored Aug 22, 2023
2 parents 0698f63 + 579401b commit 1367fe0
Show file tree
Hide file tree
Showing 28 changed files with 467 additions and 41 deletions.
2 changes: 2 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ After specifying the latest versions, run the following commands in the root
dir of the project.

```sh
# install package dependencies
yarn
# download new proto files
yarn run update-protos
# generate Typescript definitions from the updated protos
Expand Down
30 changes: 30 additions & 0 deletions lib/types/proto/loop/client.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
/* eslint-disable */
import type { RouteHint } from './swapserverrpc/common';

/**
* `AddressType` has to be one of:
*
* - `unknown`: Unknown address type
* - `p2tr`: Pay to taproot pubkey (`TAPROOT_PUBKEY` = 1)
*/
export enum AddressType {
ADDRESS_TYPE_UNKNOWN = 'ADDRESS_TYPE_UNKNOWN',
TAPROOT_PUBKEY = 'TAPROOT_PUBKEY',
UNRECOGNIZED = 'UNRECOGNIZED'
}

export enum SwapType {
/** LOOP_OUT - LOOP_OUT indicates an loop out swap (off-chain to on-chain) */
LOOP_OUT = 'LOOP_OUT',
Expand Down Expand Up @@ -247,6 +259,14 @@ export interface LoopOutRequest {
* triggering the swap (loop CLI, autolooper, LiT UI, other 3rd party UI).
*/
initiator: string;
/**
* An alternative destination address source for the swap. This field
* represents the name of the account in the backing lnd instance.
* Refer to lnd's wallet import functions for reference.
*/
account: string;
/** The address type of the account specified in the account field. */
accountAddrType: AddressType;
}

export interface LoopInRequest {
Expand Down Expand Up @@ -557,6 +577,8 @@ export interface LsatToken {
* file name of the token where it's stored on the file system.
*/
storageName: string;
/** The l402 ID of the token. */
id: string;
}

export interface LoopStats {
Expand Down Expand Up @@ -715,6 +737,14 @@ export interface LiquidityParameters {
* autoloop to determine how much liquidity should be maintained in channels.
*/
easyAutoloopLocalTargetSat: string;
/**
* An alternative destination address source for the swap. This field
* represents the name of the account in the backing lnd instance.
* Refer to lnd's wallet import functions for reference.
*/
account: string;
/** The address type of the account specified in the account field. */
accountAddrType: AddressType;
}

export interface LiquidityRule {
Expand Down
11 changes: 8 additions & 3 deletions lib/types/proto/tapd/mintrpc/mint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,15 @@ export interface CancelBatchResponse {

export interface ListBatchRequest {
/**
* The optional batch key of the batch to list. When using REST this field
* must be encoded as base64url.
* The optional batch key of the batch to list, specified as raw bytes
* (gRPC only).
*/
batchKey: Uint8Array | string;
batchKey: Uint8Array | string | undefined;
/**
* The optional batch key of the batch to list, specified as a hex
* encoded string (use this for REST).
*/
batchKeyStr: string | undefined;
}

export interface ListBatchResponse {
Expand Down
95 changes: 90 additions & 5 deletions lib/types/proto/tapd/taprootassets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ export enum AssetType {

export enum AssetMetaType {
/**
* MTEA_TYPE_OPAQUE - Opaque is used for asset meta blobs that have no true structure and instead
* META_TYPE_OPAQUE - Opaque is used for asset meta blobs that have no true structure and instead
* should be interpreted as opaque blobs.
*/
MTEA_TYPE_OPAQUE = 'MTEA_TYPE_OPAQUE',
META_TYPE_OPAQUE = 'META_TYPE_OPAQUE',
UNRECOGNIZED = 'UNRECOGNIZED'
}

Expand Down Expand Up @@ -92,7 +92,7 @@ export interface AnchorInfo {
/** The txid of the above transaction. */
anchorTxid: string;
/** The block hash the contains the anchor transaction above. */
anchorBlockHash: Uint8Array | string;
anchorBlockHash: string;
/** The outpoint (txid:vout) that stores the Taproot Asset commitment. */
anchorOutpoint: string;
/** The raw internal key that was used to create the anchor Taproot output key. */
Expand All @@ -109,6 +109,8 @@ export interface AnchorInfo {
* anchor output.
*/
tapscriptSibling: Uint8Array | string;
/** The height of the block which contains the anchor transaction. */
blockHeight: number;
}

export interface GenesisInfo {
Expand Down Expand Up @@ -497,8 +499,70 @@ export interface ProofFile {
genesisPoint: string;
}

export interface ProofVerifyResponse {
export interface DecodedProof {
/** The index depth of the decoded proof, with 0 being the latest proof. */
proofAtDepth: number;
/** The total number of proofs contained in the raw proof. */
numberOfProofs: number;
/** The asset referenced in the proof. */
asset: Asset | undefined;
/** The reveal meta data associated with the proof, if available. */
metaReveal: AssetMeta | undefined;
/**
* The merkle proof for AnchorTx used to prove its
* inclusion within BlockHeader.
*/
txMerkleProof: Uint8Array | string;
/**
* The TaprootProof proving the new inclusion of the
* resulting asset within AnchorTx.
*/
inclusionProof: Uint8Array | string;
/**
* The set of TaprootProofs proving the exclusion of
* the resulting asset from all other Taproot outputs within AnchorTx.
*/
exclusionProofs: Uint8Array | string[];
/**
* An optional TaprootProof needed if this asset is
* the result of a split. SplitRootProof proves inclusion of the root
* asset of the split.
*/
splitRootProof: Uint8Array | string;
/**
* The number of additional nested full proofs for any inputs found within
* the resulting asset.
*/
numAdditionalInputs: number;
/**
* ChallengeWitness is an optional virtual transaction witness that serves
* as an ownership proof for the asset. If this is non-nil, then it is a
* valid transfer witness for a 1-input, 1-output virtual transaction that
* spends the asset in this proof and sends it to the NUMS key, to prove
* that the creator of the proof is able to produce a valid signature to
* spend the asset.
*/
challengeWitness: Uint8Array | string[];
}

export interface VerifyProofResponse {
valid: boolean;
decodedProof: DecodedProof | undefined;
}

export interface DecodeProofRequest {
/** The raw proof in bytes to decode, which may contain multiple proofs. */
rawProof: Uint8Array | string;
/** The index depth of the decoded proof, with 0 being the latest proof. */
proofAtDepth: number;
/** An option to include previous witnesses in decoding. */
withPrevWitnesses: boolean;
/** An option to attempt to retrieve the meta data associated with the proof. */
withMetaReveal: boolean;
}

export interface DecodeProofResponse {
decodedProof: DecodedProof | undefined;
}

export interface ExportProofRequest {
Expand Down Expand Up @@ -569,6 +633,14 @@ export interface SendAssetResponse {
transfer: AssetTransfer | undefined;
}

export interface GetInfoRequest {}

export interface GetInfoResponse {
version: string;
lndVersion: string;
network: string;
}

export interface SubscribeSendAssetEventNtfnsRequest {}

export interface SendAssetEvent {
Expand Down Expand Up @@ -694,7 +766,15 @@ export interface TaprootAssets {
* VerifyProof attempts to verify a given proof file that claims to be anchored
* at the specified genesis point.
*/
verifyProof(request?: DeepPartial<ProofFile>): Promise<ProofVerifyResponse>;
verifyProof(request?: DeepPartial<ProofFile>): Promise<VerifyProofResponse>;
/**
* tarocli: `proofs decode`
* DecodeProof attempts to decode a given proof file into human readable
* format.
*/
decodeProof(
request?: DeepPartial<DecodeProofRequest>
): Promise<DecodeProofResponse>;
/**
* tapcli: `proofs export`
* ExportProof exports the latest raw proof file anchored at the specified
Expand All @@ -720,6 +800,11 @@ export interface TaprootAssets {
sendAsset(
request?: DeepPartial<SendAssetRequest>
): Promise<SendAssetResponse>;
/**
* tapcli: `getinfo`
* GetInfo returns the information for the node.
*/
getInfo(request?: DeepPartial<GetInfoRequest>): Promise<GetInfoResponse>;
/**
* SubscribeSendAssetEventNtfns registers a subscription to the event
* notification stream which relates to the asset sending process.
Expand Down
76 changes: 71 additions & 5 deletions lib/types/proto/tapd/universerpc/universe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ export enum AssetQuerySort {
SORT_BY_ASSET_NAME = 'SORT_BY_ASSET_NAME',
SORT_BY_ASSET_ID = 'SORT_BY_ASSET_ID',
SORT_BY_ASSET_TYPE = 'SORT_BY_ASSET_TYPE',
SORT_BY_TOTAL_SYNCS = 'SORT_BY_TOTAL_SYNCS',
SORT_BY_TOTAL_PROOFS = 'SORT_BY_TOTAL_PROOFS',
SORT_BY_GENESIS_HEIGHT = 'SORT_BY_GENESIS_HEIGHT',
UNRECOGNIZED = 'UNRECOGNIZED'
}

Expand All @@ -45,13 +48,16 @@ export interface MerkleSumNode {
}

export interface ID {
/** The 32-byte asset ID. */
/** The 32-byte asset ID specified as raw bytes (gRPC only). */
assetId: Uint8Array | string | undefined;
/** The 32-byte asset ID encoded as a hex string. */
/** The 32-byte asset ID encoded as a hex string (use this for REST). */
assetIdStr: string | undefined;
/** The 32-byte asset group key. */
/** The 32-byte asset group key specified as raw bytes (gRPC only). */
groupKey: Uint8Array | string | undefined;
/** The 32-byte asset group key encoded as hex string. */
/**
* The 32-byte asset group key encoded as hex string (use this for
* REST).
*/
groupKeyStr: string | undefined;
}

Expand Down Expand Up @@ -89,6 +95,13 @@ export interface QueryRootResponse {
assetRoot: UniverseRoot | undefined;
}

export interface DeleteRootQuery {
/** An ID value to uniquely identify a Universe root. */
id: ID | undefined;
}

export interface DeleteRootResponse {}

export interface Outpoint {
/** The output as a hex encoded (and reversed!) string. */
hashStr: string;
Expand Down Expand Up @@ -151,6 +164,19 @@ export interface AssetProof {
assetLeaf: AssetLeaf | undefined;
}

export interface InfoRequest {}

export interface InfoResponse {
/**
* A pseudo-random runtime ID for the current instance of the Universe
* server, changes with each restart. Mainly used to identify identical
* servers when they are exposed under different hostnames/ports.
*/
runtimeId: string;
/** The number of assets known to this Universe server. */
numAssets: string;
}

export interface SyncTarget {
id: ID | undefined;
}
Expand Down Expand Up @@ -226,10 +252,13 @@ export interface AssetStatsQuery {

export interface AssetStatsSnapshot {
assetId: Uint8Array | string;
groupKey: Uint8Array | string;
genesisPoint: string;
totalSupply: string;
assetName: string;
assetType: AssetType;
genesisHeight: number;
genesisTimestamp: string;
totalSyncs: string;
totalProofs: string;
}
Expand All @@ -238,6 +267,22 @@ export interface UniverseAssetStats {
assetStats: AssetStatsSnapshot[];
}

export interface QueryEventsRequest {
startTimestamp: string;
endTimestamp: string;
}

export interface QueryEventsResponse {
events: GroupedUniverseEvents[];
}

export interface GroupedUniverseEvents {
/** The date the events occurred on, formatted as YYYY-MM-DD. */
date: string;
syncEvents: string;
newProofEvents: string;
}

export interface Universe {
/**
* tapcli: `universe roots`
Expand All @@ -255,6 +300,14 @@ export interface Universe {
queryAssetRoots(
request?: DeepPartial<AssetRootQuery>
): Promise<QueryRootResponse>;
/**
* tapcli: `universe delete`
* DeleteAssetRoot deletes the Universe root for a specific asset, including
* all asoociated universe keys, leaves, and events.
*/
deleteAssetRoot(
request?: DeepPartial<DeleteRootQuery>
): Promise<DeleteRootResponse>;
/**
* tapcli: `universe keys`
* AssetLeafKeys queries for the set of Universe keys associated with a given
Expand Down Expand Up @@ -292,6 +345,11 @@ export interface Universe {
* updated asset_id/group_key.
*/
insertProof(request?: DeepPartial<AssetProof>): Promise<AssetProofResponse>;
/**
* tapcli: `universe info`
* Info returns a set of information about the current state of the Universe.
*/
info(request?: DeepPartial<InfoRequest>): Promise<InfoResponse>;
/**
* tapcli: `universe sync`
* SyncUniverse takes host information for a remote Universe server, then
Expand Down Expand Up @@ -329,7 +387,7 @@ export interface Universe {
): Promise<DeleteFederationServerResponse>;
/**
* tapcli: `universe stats`
* UniverseStats returns a set of aggregrate statistics for the current state
* UniverseStats returns a set of aggregate statistics for the current state
* of the Universe. Stats returned include: total number of syncs, total
* number of proofs, and total number of known assets.
*/
Expand All @@ -344,6 +402,14 @@ export interface Universe {
queryAssetStats(
request?: DeepPartial<AssetStatsQuery>
): Promise<UniverseAssetStats>;
/**
* tapcli `universe stats events`
* QueryEvents returns the number of sync and proof events for a given time
* period, grouped by day.
*/
queryEvents(
request?: DeepPartial<QueryEventsRequest>
): Promise<QueryEventsResponse>;
}

type Builtin =
Expand Down
Loading

0 comments on commit 1367fe0

Please sign in to comment.