Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
gandlafbtc committed May 16, 2023
1 parent 8c2f4c5 commit ad235e1
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 65 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/typedoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ jobs:
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs
publish_dir: ./docs
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"lint": "eslint --ext .js,.ts . --fix",
"format": "prettier --write .",
"typedoc": "typedoc src/index.ts"

},
"keywords": [
"cashu"
Expand Down
64 changes: 32 additions & 32 deletions src/CashuMint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ import {
import { checkResponse, checkResponseError, isObj } from './utils.js';

/**
* Class represents Cashu Mint API. This class contains Lower level functions that are implemented by CashuWallet.
* Class represents Cashu Mint API. This class contains Lower level functions that are implemented by CashuWallet.
*/
class CashuMint {
/**
* @param _mintUrl requires mint URL to create this object
*/
constructor(private _mintUrl: string) {}

get mintUrl() {
return this._mintUrl;
}
/**
* fetches mints info at the /info endpoint
* @param mintUrl
* @param mintUrl
*/
public static async getInfo(mintUrl: string): Promise<GetInfoResponse> {
const { data } = await axios.get<GetInfoResponse>(`${mintUrl}/info`);
Expand All @@ -43,8 +43,8 @@ class CashuMint {
}
/**
* Starts a minting process by requesting an invoice from the mint
* @param mintUrl
* @param amount Amount requesting for mint.
* @param mintUrl
* @param amount Amount requesting for mint.
* @returns the mint will create and return a Lightning invoice for the specified amount
*/
public static async requestMint(mintUrl: string, amount: number): Promise<RequestMintResponse> {
Expand All @@ -56,16 +56,16 @@ class CashuMint {

/**
* Starts a minting process by requesting an invoice from the mint
* @param amount Amount requesting for mint.
* @param amount Amount requesting for mint.
* @returns the mint will create and return a Lightning invoice for the specified amount
*/
async requestMint(amount: number): Promise<RequestMintResponse> {
return CashuMint.requestMint(this._mintUrl, amount);
}
/**
* Requests the mint to perform token minting after the LN invoice has been paid
* @param mintUrl
* @param payloads outputs (Blinded messages) that can be written
* @param mintUrl
* @param payloads outputs (Blinded messages) that can be written
* @param hash hash (id) used for by the mint to keep track of wether the invoice has been paid yet
* @returns serialized blinded signatures
*/
Expand Down Expand Up @@ -98,7 +98,7 @@ class CashuMint {
}
/**
* Requests the mint to perform token minting after the LN invoice has been paid
* @param payloads outputs (Blinded messages) that can be written
* @param payloads outputs (Blinded messages) that can be written
* @param hash hash (id) used for by the mint to keep track of wether the invoice has been paid yet
* @returns serialized blinded signatures
*/
Expand All @@ -107,9 +107,9 @@ class CashuMint {
}
/**
* Get the mints public keys
* @param mintUrl
* @param keysetId optional param to get the keys for a specific keyset. If not specified, the keys from the active keyset are fetched
* @returns
* @param mintUrl
* @param keysetId optional param to get the keys for a specific keyset. If not specified, the keys from the active keyset are fetched
* @returns
*/
public static async getKeys(mintUrl: string, keysetId?: string): Promise<MintKeys> {
if (keysetId) {
Expand All @@ -121,16 +121,16 @@ class CashuMint {
}
/**
* Get the mints public keys
* @param keysetId optional param to get the keys for a specific keyset. If not specified, the keys from the active keyset are fetched
* @returns the mints public keys
* @param keysetId optional param to get the keys for a specific keyset. If not specified, the keys from the active keyset are fetched
* @returns the mints public keys
*/
async getKeys(keysetId?: string): Promise<MintKeys> {
return CashuMint.getKeys(this._mintUrl, keysetId);
}
/**
* Get the mints keysets in no specific order
* @param mintUrl
* @returns all the mints past and current keysets.
* @param mintUrl
* @returns all the mints past and current keysets.
*/
public static async getKeySets(mintUrl: string): Promise<{ keysets: Array<string> }> {
const { data } = await axios.get<{ keysets: Array<string> }>(`${mintUrl}/keysets`);
Expand All @@ -139,16 +139,16 @@ class CashuMint {

/**
* Get the mints keysets in no specific order
* @returns all the mints past and current keysets.
* @returns all the mints past and current keysets.
*/
async getKeySets(): Promise<{ keysets: Array<string> }> {
return CashuMint.getKeySets(this._mintUrl);
}

/**
* Ask mint to perform a split operation
* @param mintUrl
* @param splitPayload data needed for performing a token split
* @param mintUrl
* @param splitPayload data needed for performing a token split
* @returns split tokens
*/
public static async split(mintUrl: string, splitPayload: SplitPayload): Promise<SplitResponse> {
Expand All @@ -166,17 +166,17 @@ class CashuMint {
}
/**
* Ask mint to perform a split operation
* @param splitPayload data needed for performing a token split
* @param splitPayload data needed for performing a token split
* @returns split tokens
*/
async split(splitPayload: SplitPayload): Promise<SplitResponse> {
return CashuMint.split(this._mintUrl, splitPayload);
}
/**
* Ask mint to perform a melt operation. This pays a lightning invoice and destroys tokens matching its amount + fees
* @param mintUrl
* @param meltPayload
* @returns
* Ask mint to perform a melt operation. This pays a lightning invoice and destroys tokens matching its amount + fees
* @param mintUrl
* @param meltPayload
* @returns
*/
public static async melt(mintUrl: string, meltPayload: MeltPayload): Promise<MeltResponse> {
try {
Expand All @@ -196,16 +196,16 @@ class CashuMint {
}
}
/**
* Ask mint to perform a melt operation. This pays a lightning invoice and destroys tokens matching its amount + fees
* @param meltPayload
* @returns
* Ask mint to perform a melt operation. This pays a lightning invoice and destroys tokens matching its amount + fees
* @param meltPayload
* @returns
*/
async melt(meltPayload: MeltPayload): Promise<MeltResponse> {
return CashuMint.melt(this._mintUrl, meltPayload);
}
/**
* Estimate fees for a given LN invoice
* @param mintUrl
* @param mintUrl
* @param checkfeesPayload Payload containing LN invoice that needs to get a fee estimate
* @returns estimated Fee
*/
Expand All @@ -230,7 +230,7 @@ class CashuMint {
}
/**
* Estimate fees for a given LN invoice
* @param mintUrl
* @param mintUrl
* @param checkfeesPayload Payload containing LN invoice that needs to get a fee estimate
* @returns estimated Fee
*/
Expand All @@ -239,8 +239,8 @@ class CashuMint {
}
/**
* Checks if specific proofs have already been redeemed
* @param mintUrl
* @param checkPayload
* @param mintUrl
* @param checkPayload
* @returns redeemed and unredeemed ordered list of booleans
*/
public static async check(
Expand All @@ -261,7 +261,7 @@ class CashuMint {
}
/**
* Checks if specific proofs have already been redeemed
* @param checkPayload
* @param checkPayload
* @returns redeemed and unredeemed ordered list of booleans
*/
async check(checkPayload: CheckSpendablePayload): Promise<CheckSpendableResponse> {
Expand Down
5 changes: 4 additions & 1 deletion src/CashuWallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class CashuWallet {
}
/**
* Starts a minting process by requesting an invoice from the mint
* @param amount Amount requesting for mint.
* @param amount Amount requesting for mint.
* @returns the mint will create and return a Lightning invoice for the specified amount
*/
requestMint(amount: number) {
Expand Down Expand Up @@ -275,6 +275,7 @@ class CashuWallet {
newKeys: await this.changedKeys(promises)
};
}
<<<<<<< HEAD
<<<<<<< HEAD

async receiveTokenEntry(tokenEntry: TokenEntry): Promise<ReceiveTokenEntryResponse> {
Expand Down Expand Up @@ -319,6 +320,8 @@ class CashuWallet {
=======

>>>>>>> ts docs
=======
>>>>>>> format

private async initKeys() {
if (!this.keysetId || !Object.keys(this.keys).length) {
Expand Down
Loading

0 comments on commit ad235e1

Please sign in to comment.