diff --git a/.github/workflows/docs-generator-trigger.yml b/.github/workflows/docs-generator-trigger.yml new file mode 100644 index 000000000..d011463fe --- /dev/null +++ b/.github/workflows/docs-generator-trigger.yml @@ -0,0 +1,49 @@ +name: Docs Generator trigger +env: + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_DOCS_PROJECT_ID }} + +on: + push: + branches: + - main + +concurrency: + group: "docs" + cancel-in-progress: true + +jobs: + trigger-generator: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 18.12.1 + cache: 'yarn' + + - name: Install Vercel CLI + run: npm install --global vercel@canary + + - name: Install Yarn Globally + run: npm install -g yarn + + - name: Installing Dependencies + run: yarn + + - name: Pull vercel setup + run: vercel pull --yes --token=${{ secrets.VERCEL_TOKEN }} + + - name: Build Project Artifacts + run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} + + - name: Deploy Project Artifacts to Vercel + run: > + vercel + deploy + --prebuilt + --prod + --token=${{ secrets.VERCEL_TOKEN }} diff --git a/packages/sdk/.gitignore b/packages/sdk/.gitignore index 3292ee3d6..d82d52135 100644 --- a/packages/sdk/.gitignore +++ b/packages/sdk/.gitignore @@ -26,3 +26,5 @@ temp verifier.wasm circuit.zkey env.json +docs +.vercel diff --git a/packages/sdk/README.MD b/packages/sdk/README.MD new file mode 100644 index 000000000..298289fb5 --- /dev/null +++ b/packages/sdk/README.MD @@ -0,0 +1,29 @@ +# Hideyour.cash + +Hideyour.cash is a compliant anonymous transactions tool, that utilizes ZK (Zero-knowledge proof) technology. + +The main feature is allowing the mixing of transactions using NEAR or any NEP-141 token only for well inteded users. The system integrates with data providors to block wallets suspicious of money laundering and smart contract hacking. + +This works by leveaging [hapi.one protocol] as a data partner which is responsible for allowlisting and denylisting accounts. + +## SDK + +This SDK is designed to assist developers when interacting with the main functions of the hideyour-cash protocol. + +### Installation + +Hideyour.cash SDK requires [Node.js] and [yarn]. + +After installing all the tools, you can run the command: + +```sh +yarn +``` +And install all the dependencies + +### Build + +To compile SDK run the command: +```sh +yarn build +``` diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 8953edaf7..8707901f1 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -14,6 +14,7 @@ }, "scripts": { "build": "tsup", + "docs": "npx typedoc", "add_zk_assets": "yarn add_verifier_wasm && yarn add_circuit", "add_verifier_wasm": "cp ../circuits/out/withdraw_js/withdraw.wasm ./test/verifier.wasm", "add_circuit": "cp ../circuits/out/withdraw_0000.zkey ./test/circuit.zkey", @@ -43,6 +44,7 @@ "rollup-plugin-esbuild": "^5.0.0", "ts-jest": "^29.0.5", "ts-node": "^10.9.1", + "typedoc": "^0.23.28", "typescript": "^4.9.4", "yarn": "^1.22.19" }, diff --git a/packages/sdk/src/actions/compliance.ts b/packages/sdk/src/actions/compliance.ts index 0ab02a22f..0cffb8085 100644 --- a/packages/sdk/src/actions/compliance.ts +++ b/packages/sdk/src/actions/compliance.ts @@ -2,8 +2,17 @@ import { getTransaction } from "../helpers"; import type { ConnectionType } from "../interfaces"; import { sendTransactionsCallback } from "./connection"; +/** + * Send an account to allowlist + * + * This method sends a new accountId to be added to the Allowlist of the HYC Registry contract. + * + * @param contract The accountId of registry contract + * @param accountId The accountId to be send to allowlist + * @param connection the near connection that will to sign the transactions (Near Account or Wallet Selector) + * @returns {Promise} + */ export const sendAllowlist = async ( - nodeUrl: string, contract: string, accountId: string, connection: ConnectionType diff --git a/packages/sdk/src/actions/connection.ts b/packages/sdk/src/actions/connection.ts index dcd9b55ab..404eae6d2 100644 --- a/packages/sdk/src/actions/connection.ts +++ b/packages/sdk/src/actions/connection.ts @@ -2,6 +2,15 @@ import { AttachedGas } from "../constants"; import type { Transaction } from "../helpers"; import type { ConnectionType } from "../interfaces"; +/** + * Send transactions callback + * + * This method is an abstraction that makes it possible to send transactions to Near Blockchain using a WalletSelector object or a Near Account. + * + * @param transactions the array of transactions to be send + * @param connection the near connection that will to sign the transactions (Near Account or Wallet Selector) + * @returns {Promise} + */ export const sendTransactionsCallback = async ( connection: ConnectionType, transactions: Transaction[] diff --git a/packages/sdk/src/actions/merkle-tree.ts b/packages/sdk/src/actions/merkle-tree.ts index 6c643c5cc..dd6d7dea3 100644 --- a/packages/sdk/src/actions/merkle-tree.ts +++ b/packages/sdk/src/actions/merkle-tree.ts @@ -2,6 +2,19 @@ import { MerkleTreeService } from "../services"; import type { MerkleTreeCacheInterface } from "../interfaces"; import type MerkleTree from "fixed-merkle-tree"; +/** + * Prepare Merkle Tree + * + * This method is responsible for creating and starting a new merkle tree using the Merkle Tree service. + * + * @param contract The accountId of registry contract + * @param name The name of to be created merkle tree + * @param branchesQuery The graphql query to get all branches + * @param lastBranchesQuery The graphql query to get only the last branch + * @param graphqlUrl The graphql url + * @param cache The saved array of branches + * @returns {Promise} + */ export const prepareMerkleTree = async ( contract: string, name: string, diff --git a/packages/sdk/src/actions/relayer.ts b/packages/sdk/src/actions/relayer.ts index 66186d4ab..2fc6c29dc 100644 --- a/packages/sdk/src/actions/relayer.ts +++ b/packages/sdk/src/actions/relayer.ts @@ -1,4 +1,4 @@ -import axios from "axios"; +import axios, { AxiosResponse } from "axios"; import { getTokenStorage } from "./ticket"; import { getTransaction } from "../helpers"; import { sendTransactionsCallback } from "./connection"; @@ -9,6 +9,16 @@ import type { } from "../interfaces"; import { OneNear } from "../constants"; +/** + * Relayer Get Relayer Fee + * + * This method is responsible for sending a fee request to the relayer. + * + * @param relayer The data of relayer with the url to be requested fee + * @param accountId The near accountId to be calculate fee + * @param instanceId The instance accountId to be sended withdraw + * @returns {Promise} + */ export const getRelayerFee = async ( relayer: RelayerDataInterface, accountId: string, @@ -28,6 +38,15 @@ export const getRelayerFee = async ( }); }; +/** + * Relayer Send Withdraw + * + * This method is responsible for sending a withdraw request to the relayer. + * + * @param relayer The data of relayer with the url to be requested fee + * @param payload The generated withdraw payload to be sended to withdraw + * @returns {Promise} + */ export const sendWithdraw = async ( relayer: RelayerDataInterface, payload: { publicArgs: PublicArgsInterface; token: string } @@ -43,6 +62,19 @@ export const sendWithdraw = async ( }); }; +/** + * Relayer Send Contract Withdraw + * + * This method is responsible for sending a withdraw transaction to the blockchain. Without using a relayer. + * + * @param nodeUrl The Near RPC to send the transaction + * @param contract The instance accountId to be send on transaction + * @param signerId The signer accountId of the transaction + * @param receiverId The receiver accountId of ticket amount + * @param publicArgs The generated withdraw payload + * @param connection the near connection that will to sign the transactions (Near Account or Wallet Selector) + * @returns {Promise} + */ export const sendContractWithdraw = async ( nodeUrl: string, contract: string, @@ -67,6 +99,19 @@ export const sendContractWithdraw = async ( return sendTransactionsCallback(connection, transactions); }; +/** + * Relayer check withdraw storages + * + * This method is responsible for verifying and calculating the storage of Relayer, Sender and Receiver on contract. + * + * @param nodeUrl The Near RPC to send the transaction + * @param contract The contract accountId to be send on transaction + * @param signerId The signer accountId of the transaction + * @param receiverId The receiver accountId of ticket amount + * @param relayerId The relayer accountId to be send the transaction + * @param connection the near connection that will to sign the transactions (Near Account or Wallet Selector) + * @returns {Promise} + */ export const checkWithdrawStorages = async ( nodeUrl: string, contract: string, diff --git a/packages/sdk/src/actions/snark-proof.ts b/packages/sdk/src/actions/snark-proof.ts index 1a8f559ef..e621dd7f7 100644 --- a/packages/sdk/src/actions/snark-proof.ts +++ b/packages/sdk/src/actions/snark-proof.ts @@ -11,6 +11,17 @@ import type { WithdrawInputInterface, } from "../interfaces/snark-proof"; +/** + * Create snark proof + * + * This method is responsible for creating a new Snark Proof. + * + * @param payload The withdraw input to be send to plonk to calculate the proof + * @param verifierUrl The Url of verifier.wasm + * @param circuitUrl The Url of circuit.zkey + * @param logger The logger instance + * @returns {Promise<{ proof: any; publicSignals: string[] }>} + */ export const createSnarkProof = async ( payload: WithdrawInputInterface, verifierUrl = "./verifier.wasm", @@ -43,6 +54,24 @@ export const createSnarkProof = async ( } }; +/** + * SnarkProof - Prepare Withdraw + * + * This method is responsible for preparing a withdraw action, generating all account hashes, creating a withdraw input and generating a new proof. + * + * @param nodeUrl The Current Near RPC Url + * @param contract The instance accountId + * @param fee The relayer fee generated of relayer + * @param note The note to withdraw + * @param relayer The data of relayer to be create the proof + * @param recipient The receiver accountId of ticket amount + * @param logger The logger instance + * @param allowlistTree The allowlist merkle tree + * @param commitmentsTree the commitments merkle tree + * @param verifierUrl the url of verifier.wasm + * @param circuitUrl the url of circuit.zkey + * @returns {Promise<{ publicArgs: PublicArgsInterface }>} + */ export const prepareWithdraw = async ( nodeUrl: string, contract: string, @@ -71,10 +100,7 @@ export const prepareWithdraw = async ( const pathWL = allowlistTree.proof(commitment.account_hash); const input = await getWithdrawInput( - { - ...relayer, - hash: relayerHash, - }, + relayerHash, fee, recipientHash, path, @@ -97,6 +123,14 @@ export const prepareWithdraw = async ( }; }; +/** + * SnarkProof get commitment by ticket + * + * This method is responsible for generating a new commitment of a ticket. + * + * @param note The note to withdraw + * @returns {Promise} + */ export const getCommitmentByTicket = async (note: string): Promise => { const { hash } = await mimcService.initMimc(); @@ -107,8 +141,22 @@ export const getCommitmentByTicket = async (note: string): Promise => { return hash(secretsHash, parsedNote.account_hash); } +/** + * SnarkProof get withdraw input + * + * This method is responsible for generating a withdraw input to create a new proof. + * + * @param hash The hash of relayer accountId + * @param fee The relayer fee + * @param recipientHash The receiver accountId of ticket amount + * @param path The commitments merkle tree proof + * @param pathAL The allowlist merkle tree proof + * @param commitment the parsed note + * @param single_hash The function to create a hash of nullifier of commitment + * @returns {Promise} + */ export const getWithdrawInput = async ( - { hash }: { hash: string }, + hash: string, fee: string, recipientHash: string, path: any, @@ -134,6 +182,17 @@ export const getWithdrawInput = async ( }; }; +/** + * SnarkProof get public args + * + * This method is responsible for returning a valid payload for a withdraw action. + * + * @param proof The proof generated by plonk + * @param relayer The data of relayer to be send to withdraw + * @param publicSignals The public signals generated by plonk + * @param receiver The receiver accountId of ticket amount + * @returns {Promise} + */ export const getPublicArgs = ( proof: any, relayer: RelayerDataInterface, diff --git a/packages/sdk/src/actions/ticket.ts b/packages/sdk/src/actions/ticket.ts index b7e1c9efc..89946198d 100644 --- a/packages/sdk/src/actions/ticket.ts +++ b/packages/sdk/src/actions/ticket.ts @@ -4,6 +4,17 @@ import { sendTransactionsCallback } from "./connection"; import type { ConnectionType, Currency } from "../interfaces"; import { getTransaction, randomBN, viewFunction } from "../helpers"; +/** + * Create Ticket + * + * This method is responsible for generating a new ticket for deposit. + * + * @param nodeRpcUrl The proof generated by plonk + * @param contract The HYC registry accountId + * @param accountId The user accountId + * @param currencyId The instance accountId to be send deposit + * @returns {Promise<{ note: string, hash: string}>} + */ export const createTicket = async ( nodeRpcUrl: string, contract: string, @@ -35,8 +46,20 @@ export const createTicket = async ( }; }; +/** + * Send deposit + * + * This method is responsible for sending a new deposit with a unique commitment hash to the instance. + * + * @param hash The generated deposit hash + * @param amount The amount to be deposited + * @param depositContract The instance accountId to be receive deposit + * @param accountId The signer accountId of the transaction + * @param currency The data of currency with token accountId + * @param connection the near connection that will to sign the transactions (Near Account or Wallet Selector) + * @returns {Promise} + */ export const sendDeposit = async ( - nodeUrl: string, hash: string, amount: string, depositContract: string, @@ -77,6 +100,16 @@ export const sendDeposit = async ( return await sendTransactionsCallback(connection, transactions); }; +/** + * Get Token Storage + * + * This method serves to fetch the storage of an accountId in a token contract. + * + * @param contract The contract accountId + * @param accountId The user accountId to check storage + * @param nodeUrl The Near RPC to send the transaction + * @returns {Promise} + */ export const getTokenStorage = async ( contract: string, accountId: string, diff --git a/packages/sdk/src/constants/index.ts b/packages/sdk/src/constants/index.ts index 0f601aba0..ee373c87c 100644 --- a/packages/sdk/src/constants/index.ts +++ b/packages/sdk/src/constants/index.ts @@ -1,2 +1 @@ export * from "./near"; -export * from "./merkle-tree"; diff --git a/packages/sdk/src/constants/merkle-tree.ts b/packages/sdk/src/constants/merkle-tree.ts deleted file mode 100644 index bec19cc78..000000000 --- a/packages/sdk/src/constants/merkle-tree.ts +++ /dev/null @@ -1,19 +0,0 @@ -export const merkleTreeOptions = { - zeroElement: - "21663839004416932945382355908790599225266501822907911457504978515578255421292", -}; - -export const graphqlUrl = ""; - -export const merkleTreeMethods = { - deposit: "hyc-deposits", - allowlist: "hyc-allowlists", -}; - -export const merkleTreeBaseRequest = { - method: "POST", - headers: { - "Content-Type": "application/json", - "Access-Control-Allow-Origin": "*", - }, -}; diff --git a/packages/sdk/src/constants/near.ts b/packages/sdk/src/constants/near.ts index 41510d7a1..23750eaac 100644 --- a/packages/sdk/src/constants/near.ts +++ b/packages/sdk/src/constants/near.ts @@ -1,6 +1,18 @@ /** * Near constants */ + +/** + * @constant AttachedGas The Near max gas value + */ export const AttachedGas = "300000000000000"; + +/** + * @constant OneNear One near with all zeros + */ export const OneNear = "1000000000000000000000000"; + +/** + * @constant nearNominationExp The amount of decimals of Near + */ export const nearNominationExp = 24; diff --git a/packages/sdk/src/constants/relayer.ts b/packages/sdk/src/constants/relayer.ts deleted file mode 100644 index 61a5483f4..000000000 --- a/packages/sdk/src/constants/relayer.ts +++ /dev/null @@ -1,7 +0,0 @@ -export const relayerBaseRequest = { - method: "POST", - headers: { - "Content-Type": "application/json", - "Access-Control-Allow-Origin": "*", - }, -}; diff --git a/packages/sdk/src/graphql/merkle-tree.ts b/packages/sdk/src/graphql/merkle-tree.ts index e413b7eba..ab21d88e1 100644 --- a/packages/sdk/src/graphql/merkle-tree.ts +++ b/packages/sdk/src/graphql/merkle-tree.ts @@ -1,6 +1,8 @@ import { gql } from "graphql-request"; -// hyc registry +/** + * @constant allowListUpdatesQuery The query to get all allowlist branches to make the merkle tree + */ export const allowListUpdatesQuery = { name: "allowlistMerkleTreeUpdates", query: gql` @@ -22,6 +24,9 @@ export const allowListUpdatesQuery = { `, }; +/** + * @constant depositUpdatesQuery The query to get all deposit branches to make the merkle tree + */ export const depositUpdatesQuery = { name: "depositMerkleTreeUpdates", query: gql` @@ -43,7 +48,9 @@ export const depositUpdatesQuery = { `, }; -// hyc registry +/** + * @constant allowListUpdatesQuery The query to get the last allowlist branch to make the merkle tree + */ export const lastAllowListQuery = { name: "allowlistMerkleTreeUpdates", query: gql` @@ -60,6 +67,9 @@ export const lastAllowListQuery = { `, }; +/** + * @constant allowListUpdatesQuery The query to get the last deposit branch to make the merkle tree + */ export const lastDepositQuery = { name: "depositMerkleTreeUpdates", query: gql` diff --git a/packages/sdk/src/helpers/date.ts b/packages/sdk/src/helpers/date.ts index 764093bda..ba202306d 100644 --- a/packages/sdk/src/helpers/date.ts +++ b/packages/sdk/src/helpers/date.ts @@ -1,3 +1,11 @@ +/** + * Helpers: Get UTC Date + * + * This method is responsible for returning a new UTC date. + * + * @param timestamp the valid date in miliseconds + * @returns {Promise} + */ export const getUTCDate = (timestamp: number = Date.now()): Date => { const date = new Date(timestamp); diff --git a/packages/sdk/src/helpers/merkle-tree.ts b/packages/sdk/src/helpers/merkle-tree.ts index ee58824d7..851228fd6 100644 --- a/packages/sdk/src/helpers/merkle-tree.ts +++ b/packages/sdk/src/helpers/merkle-tree.ts @@ -1,5 +1,13 @@ import type { ParseNoteInterface } from "../interfaces"; +/** + * Helpers: Parse Note + * + * This method is responsible for parsing a ticket. + * + * @param note The note to withdraw + * @returns {Promise} + */ export const parseNote = (note: string): ParseNoteInterface => { const splitString = note.split("-"); diff --git a/packages/sdk/src/helpers/near.ts b/packages/sdk/src/helpers/near.ts index e9b666f0d..85cf64262 100644 --- a/packages/sdk/src/helpers/near.ts +++ b/packages/sdk/src/helpers/near.ts @@ -21,6 +21,19 @@ export interface Params { deposit: string; } +/** + * Helpers: Get Transaction + * + * This method is responsible for returning a valid Transaction object. + * + * @param signerId The user accountId to sign the transaction + * @param receiverId The contract accountId to receive the transaction + * @param method The method to be called on contract + * @param args The args to be sent to contract method + * @param amount The human amount to be attached on transaction + * @param skipParser The boolean to skip amount parser + * @returns {Promise} + */ export const getTransaction = ( signerId: string, receiverId: string, @@ -48,6 +61,17 @@ export const getTransaction = ( }; }; +/** + * Helpers: View function + * + * This method is responsible for making a View Function on the Near Blockchain. + * + * @param nodeUrl The Current Near RPC Url + * @param contractId The contract accountId to call view function + * @param methodName The view method to be called on contract + * @param args The args to be sent to contract view function + * @returns {Promise} + */ export const viewFunction = async ( nodeUrl: string, contractId: string, @@ -73,6 +97,16 @@ export const viewFunction = async ( return JSON.parse(Buffer.from(result.result).toString()); }; +/** + * Helpers: Get Transaction State + * + * This method is responsible for returning the current state of a Near Blockchain transaction. + * + * @param nodeUrl The Current Near RPC Url + * @param txHash The transaction hash + * @param accountId The accountId of signer of transaction + * @returns {Promise} + */ export const getTransactionState = async ({ nodeUrl, txHash, @@ -90,6 +124,15 @@ export const getTransactionState = async ({ return result; } +/** + * Helpers: Get Account Balance + * + * This method is responsible for obtaining the balance of a Near accountId. + * + * @param nodeUrl The Current Near RPC Url + * @param accountId The Near accountId to get balance + * @returns {Promise} + */ export const getAccountBalance = async ({ nodeUrl, accountId, @@ -110,6 +153,16 @@ export const getAccountBalance = async ({ return result; } +/** + * Helpers: Send JSON RPC + * + * This method is responsible for sending all view functions to the Near JSON RPC. + * + * @param nodeUrl The Current Near RPC Url + * @param params The RPC request params + * @param method The RPC request method + * @returns {Promise} + */ export const sendJsonRpc = async ( nodeUrl: string, method: string, @@ -132,6 +185,15 @@ export const sendJsonRpc = async ( return await rpcService.post("/", body); }; +/** + * Helpers: Get Amount + * + * This method is responsible for transforming human readable amount to raw amount. + * + * @param amount The Near amount in Human Format + * @param skip The flag to skip the amount parser + * @returns {Promise} + */ export const getAmount = (amount: string | undefined, skip = false) => { if (!amount) { return "1"; @@ -145,11 +207,12 @@ export const getAmount = (amount: string | undefined, skip = false) => { }; /** - * Convert human readable NEAR amount to internal indivisible units. - * Effectively this multiplies given amount. + * Helpers: Parse Near Amount + * + * This method is responsible for transforming human readable amount to raw amount. * - * @param rawAmount decimal string (potentially fractional) denominated in NEAR. - * @returns The parsed yoctoⓃ amount or null if no amount was passed in + * @param rawAmount The Near amount in Human Format + * @returns {Promise} */ export const parseNearAmount = (rawAmount?: string) => { if (!rawAmount) { @@ -174,10 +237,26 @@ export const parseNearAmount = (rawAmount?: string) => { return trimLeadingZeroes(wholePart + fracPart.padEnd(nearNominationExp, "0")); }; +/** + * Helpers: Cleanup raw amount + * + * This method is responsible for removing all invalid characters from a Amount. + * + * @param amount The Near amount in Human Format + * @returns {string} + */ export const cleanupRawAmount = (amount: string) => { return amount.replace(/,/g, "").trim(); }; +/** + * Helpers: Trim leading Zeroes + * + * This method is responsible for trim leading zeroes of an amount. + * + * @param value The amount to trim leading zeroes + * @returns {Promise} + */ export const trimLeadingZeroes = (value: string) => { const replacedValue = value.replace(/^0+/, ""); diff --git a/packages/sdk/src/helpers/number.ts b/packages/sdk/src/helpers/number.ts index 1243edfd9..466db7c9c 100644 --- a/packages/sdk/src/helpers/number.ts +++ b/packages/sdk/src/helpers/number.ts @@ -1,9 +1,26 @@ import Big from "big.js"; +/** + * Helpers: Get Decimals + * + * This method is responsible for returning the decimals of a fungible token in BN. + * + * @param decimals The number of decimals + * @returns {Promise} + */ export function getDecimals(decimals: number | undefined) { return Big(10).pow(decimals || 1); } +/** + * Helpers: Format Big Number with Decimals + * + * This method is responsible for formatting the amount with your decimals and return a human readable amount. + * + * @param value The raw value with decimals + * @param decimals The number of decimals + * @returns {Promise} + */ export const formatBigNumberWithDecimals = ( value: string | number | Big, decimals: Big diff --git a/packages/sdk/src/helpers/web3.ts b/packages/sdk/src/helpers/web3.ts index e8e29678a..0370605fe 100644 --- a/packages/sdk/src/helpers/web3.ts +++ b/packages/sdk/src/helpers/web3.ts @@ -2,10 +2,26 @@ import BN from "bn.js"; import { toBN } from "web3-utils"; import randomBytes from "randombytes"; +/** + * Helpers: Left Int to Buff + * + * This method is responsible for formatting a BN number. + * + * @param value the base value to create new BN + * @returns {Promise} + */ export function leInt2Buff(value: any) { return new BN(value, 16, "le"); } +/** + * Helpers: Random BN + * + * This method is responsible for creating and return a random BN. + * + * @param nbytes the number of bytes to radom BN + * @returns {Promise} + */ export function randomBN(nbytes = 31) { return toBN(leInt2Buff(randomBytes(nbytes)).toString()); } diff --git a/packages/sdk/src/services/hideyourcash/actions.ts b/packages/sdk/src/services/hideyourcash/actions.ts index 1930afeae..3386795e0 100644 --- a/packages/sdk/src/services/hideyourcash/actions.ts +++ b/packages/sdk/src/services/hideyourcash/actions.ts @@ -24,6 +24,9 @@ import type { } from "../../interfaces"; import { Views } from "./views"; +/** + * This class provides common contract, graphql, node url, virifier url and circuit url for all actions + */ export class Actions extends Views { readonly nodeUrl: string; readonly contract: string; @@ -47,10 +50,28 @@ export class Actions extends Views { this.circuitUrl = circuitUrl; } + /** + * Send Allowlist + * + * This method sends a new accountId to be added to the Allowlist of the HYC Registry contract. + * + * @param accountId The accountId to be send to allowlist + * @param connection the near connection that will to sign the transactions (Near Account or Wallet Selector) + * @returns {Promise} + */ async sendAllowlist(accountId: string, connection: ConnectionType) { - return sendAllowlist(this.nodeUrl, this.contract, accountId, connection); + return sendAllowlist(this.contract, accountId, connection); } + /** + * Create Ticket + * + * This method is responsible for generating a new ticket for deposit. + * + * @param accountId The user accountId + * @param currencyId The instance accountId to be send deposit + * @returns {Promise} + */ async createTicket(accountId: string, currencieContract: string, skip = false) { return createTicket( this.nodeUrl, @@ -61,6 +82,19 @@ export class Actions extends Views { ); } + /** + * Send Deposit + * + * This method is responsible for sending a new deposit with a unique commitment hash to the instance. + * + * @param hash The generated deposit hash + * @param amount The amount to be deposited + * @param contract The instance accountId to be receive deposit + * @param accountId The signer accountId of the transaction + * @param currency The data of currency with token accountId + * @param connection the near connection that will to sign the t + * @returns {Promise} + */ async sendDeposit( hash: string, amount: string, @@ -70,7 +104,6 @@ export class Actions extends Views { connection: ConnectionType ) { return sendDeposit( - this.nodeUrl, hash, amount, contract, @@ -80,6 +113,18 @@ export class Actions extends Views { ); } + /** + * Send Contract Withdraw + * + * This method is responsible for sending a withdraw transaction to the blockchain. Without using a relayer. + * + * @param contract The instance accountId to be send on transaction + * @param signerId The signer accountId of the transaction + * @param receiverId The receiver accountId of ticket amount + * @param publicArgs The generated withdraw payload + * @param connection the near connection that will to sign the transactions (Near Account or Wallet Selector) + * @returns {Promise} + */ async sendContractWithdraw( contract: string, signerId: string, @@ -97,6 +142,16 @@ export class Actions extends Views { ); } + /** + * Get Relayer Fee + * + * This method is responsible for sending a fee request to the relayer. + * + * @param relayer The data of relayer with the url to be requested fee + * @param accountId The near accountId to be calculate fee + * @param instanceId The instance accountId to be sended withdraw + * @returns {Promise} + */ async getRelayerFee( relayer: RelayerDataInterface, accountId: string, @@ -105,6 +160,15 @@ export class Actions extends Views { return getRelayerFee(relayer, accountId, instanceId); } + /** + * Send Withdraw + * + * This method is responsible for sending a withdraw request to the relayer. + * + * @param relayer The data of relayer with the url to be requested fee + * @param payload The generated withdraw payload to be sended to withdraw + * @returns {Promise} + */ async sendWithdraw( relayer: RelayerDataInterface, payload: { publicArgs: PublicArgsInterface; token: string } @@ -112,6 +176,21 @@ export class Actions extends Views { return sendWithdraw(relayer, payload); } + /** + * Prepare Withdraw + * + * This method is responsible for preparing a withdraw action, generating all account hashes, creating a withdraw input and generating a new proof. + * + * @param fee The relayer fee generated of relayer + * @param note The note to withdraw + * @param relayer The data of relayer to be create the proof + * @param recipient The receiver accountId of ticket amount + * @param currencyContract The instance accountId + * @param logger The logger instance + * @param allowlistTreeCache The saved array of alowlist branches + * @param commitmentsTreeCache The saved array of commitments branches + * @returns {Promise} + */ async prepareWithdraw( fee: string, note: string, diff --git a/packages/sdk/src/services/hideyourcash/service.ts b/packages/sdk/src/services/hideyourcash/service.ts index 9db93ddcf..13b1bffeb 100644 --- a/packages/sdk/src/services/hideyourcash/service.ts +++ b/packages/sdk/src/services/hideyourcash/service.ts @@ -1,11 +1,23 @@ import { Actions } from "./actions"; +/** + * This class provides a common service with all actions and views methods + */ export class HideyourCash extends Actions { readonly network: string; readonly nodeUrl: string; readonly contract: string; readonly graphqlUrl?: string; + /** + * Service constructor + * @param network The near network + * @param nodeUrl The Near RPC Url + * @param contract The hideyour-cash registry contract + * @param graphqlUrl The graphql url to get merkle tree branchs + * @param verifierUrl The Url of verifier.wasm + * @param circuitUrl The Url of circuit.zkey + */ constructor( network: string, nodeUrl: string, diff --git a/packages/sdk/src/services/hideyourcash/views.ts b/packages/sdk/src/services/hideyourcash/views.ts index fa849e8ab..69971bc87 100644 --- a/packages/sdk/src/services/hideyourcash/views.ts +++ b/packages/sdk/src/services/hideyourcash/views.ts @@ -24,6 +24,9 @@ const baseRelayers = { local: "http://localhost:8787", }; +/** + * This class provides common contract and node url for all view methods + */ export class Views { readonly contract: string; readonly nodeUrl: string; @@ -33,46 +36,134 @@ export class Views { this.contract = contract; } + /** + * View Is In Allowlist + * + * This View Function returns if accountId included on registry allowlist + * + * @param accountId The user accountId to check if is on allowlist + * @returns {Promise} + */ viewIsInAllowlist(accountId: string) { return viewIsInAllowlist(this.nodeUrl, this.contract, accountId); } + /** + * View Account Hash + * + * This View Function returns a hash of an accountId. + * + * @param accountId The user accountId to be sent to get hash + * @returns {Promise} + */ viewAccountHash(accountId: string) { return viewAccountHash(this.nodeUrl, this.contract, accountId); } + /** + * View All Currencies + * + * This View Function returns all currencies included on registry contract + * + * @returns {Promise} + */ viewAllCurrencies() { return viewAllCurrencies(this.nodeUrl, this.contract); } + /** + * View Currency Contracts + * + * This View Function returns all instances of an currency + * + * @param currency The currency accountId to get instances + * @returns {Promise} + */ viewCurrencyContracts(currency: Currency) { return viewCurrencyContracts(this.nodeUrl, this.contract, currency); } + /** + * View Is Contract Allowed + * + * This View Function returns if instanceId is allowed on HYC registry. + * + * @param contract The instance accountId to check if is allowed + * @returns {Promise} + */ viewIsContractAllowed(contract: string) { return viewIsContractAllowed(this.nodeUrl, this.contract, contract); } + /** + * View Is Allowlist Root Valid + * + * This View Function returns if allowlist root is valid. + * + * @param root The allowlist root + * @returns {Promise} + */ viewIsAllowlistRootValid(root: string) { return viewIsAllowlistRootValid(this.nodeUrl, this.contract, root); } + /** + * View Relayer Hash + * + * This View Function return the hash of relayer accountId. + * + * @param relayer The data of relayer with Near accountId + * @returns {Promise} + */ async viewRelayerHash(relayer: RelayerDataInterface) { return viewRelayerHash(this.nodeUrl, this.contract, relayer); } + /** + * View Is Withdraw Valid + * + * This View Function return if withdraw payload is valid. + * + * @param contract The instance accountId to check if withdraw is valid + * @param payload The public args generated by plonk + * @returns {Promise} + */ async viewIsWithdrawValid(payload: PublicArgsInterface, contract: string) { return viewIsWithdrawValid(this.nodeUrl, this.contract, contract, payload); } + /** + * View Was Nullifier Spent + * + * This View Function return if nullifier already spent + * + * @param ticket The note to withdraw + * @returns {Promise} + */ async viewWasNullifierSpent(ticket: string) { return viewWasNullifierSpent(this.nodeUrl, ticket); } + /** + * View Account Balance + * + * This View Function returns the "Near" balance of an account. + * + * @param accountId The user accountId to check if is on allowlist + * @returns {Promise} + */ async viewAccountBalance(contract: string, accountId: string) { return viewAccountBalance(this.nodeUrl, contract, accountId); } + /** + * Get Random Relayer + * + * This method return a valid relayer. + * + * @param network Get relayer by network + * @returns {Promise} + */ async getRandomRelayer( network: "test" | "prod" | "local" = "test" ): Promise { diff --git a/packages/sdk/src/services/merkle-tree.ts b/packages/sdk/src/services/merkle-tree.ts index 7795aba59..15038b141 100644 --- a/packages/sdk/src/services/merkle-tree.ts +++ b/packages/sdk/src/services/merkle-tree.ts @@ -6,6 +6,9 @@ import type { } from "../interfaces"; import { mimc as mimcService } from "./mimc"; +/** + * This class provides a base Merkle Tree service, fetching all branches of an graphql url and making a merkle tree. + */ export class MerkleTreeService { readonly name: string; readonly contract: string; @@ -29,6 +32,11 @@ export class MerkleTreeService { this.lastBranchesQuery = lastBranchesQuery; } + /** + * Merkle Tree - Init Merkle Tree + * @param cache The saved array of branches + * @returns {Promise} + */ async initMerkleTree(cache?: MerkleTreeCacheInterface): Promise { const { hash } = await mimcService.initMimc(); @@ -57,6 +65,11 @@ export class MerkleTreeService { return tree; } + /** + * Merkle Tree - Get Branches + * @param cache The saved array of branches + * @returns {Promise} + */ async getBranches(cache?: MerkleTreeCacheInterface) { const { lastIndex = 0, branches: defaultBranches = [] } = cache || {}; @@ -80,6 +93,10 @@ export class MerkleTreeService { return [...defaultBranches]; } + /** + * Merkle Tree - Get Branches + * @returns {Promise} + */ async getLastBranchIndex(): Promise { const data = await this.getMerkleTreeBranchesWithQuery( this.lastBranchesQuery, @@ -93,6 +110,10 @@ export class MerkleTreeService { return lastBranch?.counter || "0"; } + /** + * Merkle Tree - Get Branches + * @returns {Promise} + */ async getMerkleTreeBranchesWithQuery( { query }: any, variables: any = {} @@ -100,6 +121,10 @@ export class MerkleTreeService { return request(this.graphqlUrl, query, variables as any) as any; } + /** + * Merkle Tree - Get Branches + * @returns {Promise} + */ async getMerkleTreeBranchesWithPaginatedQuery( { query }: any, variables: any = {} diff --git a/packages/sdk/src/services/mimc.ts b/packages/sdk/src/services/mimc.ts index f1747011c..5eb869735 100644 --- a/packages/sdk/src/services/mimc.ts +++ b/packages/sdk/src/services/mimc.ts @@ -1,9 +1,12 @@ -import type BN from "bn.js"; +// import type BN from "bn.js"; // @ts-ignore import { buildMimcSponge } from "circomlibjs"; -type IntoBigInt = string | number | bigint | boolean | BN; +// type IntoBigInt = string | number | bigint | boolean | BN; +/** + * This class provides a Circom Mimc Sponge services. + */ export class MimcSponge { sponge: any; initialized = false; @@ -12,12 +15,12 @@ export class MimcSponge { const sponge = await buildMimcSponge(); return { - hash: (left: IntoBigInt, right: IntoBigInt): string => { + hash: (left: any, right: any): string => { return sponge.F.toString( sponge.multiHash([BigInt(left as any), BigInt(right as any)]) ); }, - singleHash: (single: IntoBigInt): string => { + singleHash: (single: any): string => { return sponge.F.toString(sponge.multiHash([BigInt(single as any)])); }, }; diff --git a/packages/sdk/src/views/account.ts b/packages/sdk/src/views/account.ts index e25da3bdd..e1f947476 100644 --- a/packages/sdk/src/views/account.ts +++ b/packages/sdk/src/views/account.ts @@ -1,5 +1,15 @@ import { viewFunction } from "../helpers"; +/** + * View is in allowlist + * + * This View Function returns if accountId included on registry allowlist + * + * @param rpcUrl The Current Near RPC Url + * @param contract The contract accountId to be sent on view function + * @param accountId The user accountId to check if is on allowlist + * @returns {Promise} + */ export const viewIsInAllowlist = async ( rpcUrl: string, contract: string, @@ -10,6 +20,16 @@ export const viewIsInAllowlist = async ( }); }; +/** + * View account hash + * + * This View Function returns a hash of an accountId. + * + * @param rpcUrl The Current Near RPC Url + * @param contract The contract accountId to be sent on view function + * @param accountId The user accountId to be sent to get hash + * @returns {Promise} + */ export const viewAccountHash = async ( rpcUrl: string, contract: string, @@ -20,6 +40,16 @@ export const viewAccountHash = async ( }); }; +/** + * View Account Balance + * + * This View Function returns the "Near" balance of an account. + * + * @param rpcUrl The Current Near RPC Url + * @param contract The contract accountId to be check balance + * @param accountId The user accountId to get balance + * @returns {Promise} + */ export const viewAccountBalance = async ( rpcUrl: string, contract: string, diff --git a/packages/sdk/src/views/currencies.ts b/packages/sdk/src/views/currencies.ts index 709f3537e..6f02a572b 100644 --- a/packages/sdk/src/views/currencies.ts +++ b/packages/sdk/src/views/currencies.ts @@ -2,6 +2,15 @@ import { viewFunction } from "../helpers"; import { viewFungibleTokenMetadata } from "./fungible-token"; import type { Currency, ViewCurrenciesResponseInterface } from "../interfaces"; +/** + * View All Currencies + * + * This View Function returns all currencies included on registry contract + * + * @param rpcUrl The Current Near RPC Url + * @param contract The HYC registry contract accountId + * @returns {Promise} + */ export const viewAllCurrencies = async ( rpcUrl: string, contract: string @@ -31,6 +40,16 @@ export const viewAllCurrencies = async ( ); }; +/** + * View Currency Contracts + * + * This View Function returns all instances of an currency + * + * @param rpcUrl The Current Near RPC Url + * @param contract The contract accountId to be sent on view function + * @param currency The currency accountId to get instances + * @returns {Promise} + */ export const viewCurrencyContracts = async ( rpcUrl: string, contract: string, @@ -42,6 +61,16 @@ export const viewCurrencyContracts = async ( }); }; +/** + * View Is Contract Allowed + * + * This View Function returns if instanceId is allowed on HYC registry. + * + * @param rpcUrl The Current Near RPC Url + * @param contract The contract accountId to be sent on view function + * @param accountId The instance accountId to check if is allowed + * @returns {Promise} + */ export const viewIsContractAllowed = async ( rpcUrl: string, contract: string, @@ -52,6 +81,16 @@ export const viewIsContractAllowed = async ( }); }; +/** + * View is Allowlist Root Valid + * + * This View Function returns if allowlist root is valid. + * + * @param rpcUrl The Current Near RPC Url + * @param contract The contract accountId to be sent on view function + * @param root The allowlist root + * @returns {Promise} + */ export const viewIsAllowlistRootValid = async ( rpcUrl: string, contract: string, diff --git a/packages/sdk/src/views/fungible-token.ts b/packages/sdk/src/views/fungible-token.ts index 0c742ad98..49cf53dc2 100644 --- a/packages/sdk/src/views/fungible-token.ts +++ b/packages/sdk/src/views/fungible-token.ts @@ -1,5 +1,14 @@ import { viewFunction } from "../helpers"; +/** + * View Fungible Token metadata + * + * This View Function return the metadata of an fungible token. + * + * @param rpcUrl The Current Near RPC Url + * @param contract The token accountId to get metadata + * @returns {Promise} + */ export const viewFungibleTokenMetadata = async ( rpcUrl: string, contract: string diff --git a/packages/sdk/src/views/relayer.ts b/packages/sdk/src/views/relayer.ts index 8f2d3fb7a..7f93654ef 100644 --- a/packages/sdk/src/views/relayer.ts +++ b/packages/sdk/src/views/relayer.ts @@ -1,6 +1,16 @@ import { viewFunction } from "../helpers"; import type { RelayerDataInterface } from "../interfaces"; +/** + * View Relayer Hash + * + * This View Function return the hash of relayer accountId. + * + * @param rpcUrl The Current Near RPC Url + * @param contract The HYC registry accountId + * @param relayer The data of relayer with Near accountId + * @returns {Promise} + */ export const viewRelayerHash = async ( rpcUrl: string, contract: string, diff --git a/packages/sdk/src/views/snark-proof.ts b/packages/sdk/src/views/snark-proof.ts index 6d09ea176..5a3fb65d7 100644 --- a/packages/sdk/src/views/snark-proof.ts +++ b/packages/sdk/src/views/snark-proof.ts @@ -1,6 +1,17 @@ import { viewFunction } from "../helpers"; import type { PublicArgsInterface } from "../interfaces"; +/** + * View Is Withdraw Valid + * + * This View Function return if withdraw payload is valid. + * + * @param rpcUrl The Current Near RPC Url + * @param contract The HYC registry accountId + * @param currencyContract The instance accountId to check if withdraw is valid + * @param payload The public args generated by plonk + * @returns {Promise} + */ export const viewIsWithdrawValid = async ( rpcUrl: string, contract: string, diff --git a/packages/sdk/src/views/ticket.ts b/packages/sdk/src/views/ticket.ts index 316b3d57a..9ca994608 100644 --- a/packages/sdk/src/views/ticket.ts +++ b/packages/sdk/src/views/ticket.ts @@ -1,6 +1,15 @@ import { mimc } from "../services"; import { viewFunction } from "../helpers"; +/** + * View Was Nullifier Spent + * + * This View Function return if nullifier already spent. + * + * @param nodeUrl The Current Near RPC Url + * @param ticket The note to withdraw + * @returns {Promise} + */ export const viewWasNullifierSpent = async ( nodeUrl: string, ticket: string diff --git a/packages/sdk/typedoc.json b/packages/sdk/typedoc.json new file mode 100644 index 000000000..2c43ad959 --- /dev/null +++ b/packages/sdk/typedoc.json @@ -0,0 +1,4 @@ +{ + "entryPoints": ["src/index.ts"], + "out": "docs" +} diff --git a/yarn.lock b/yarn.lock index c5066d6ff..cea859233 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4366,6 +4366,11 @@ ansi-regex@^6.0.1: resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-6.0.1.tgz#3183e38fae9a65d7cb5e53945cd5897d0260a06a" integrity sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA== +ansi-sequence-parser@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/ansi-sequence-parser/-/ansi-sequence-parser-1.1.0.tgz#4d790f31236ac20366b23b3916b789e1bde39aed" + integrity sha512-lEm8mt52to2fT8GhciPCGeCXACSz2UwIN4X2e2LJSnZ5uAbn2/dsYdOmUXq0AtWS5cpAupysIneExOgH0Vd2TQ== + ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" @@ -12923,6 +12928,11 @@ ltgt@^2.1.2: resolved "https://registry.yarnpkg.com/ltgt/-/ltgt-2.2.1.tgz#f35ca91c493f7b73da0e07495304f17b31f87ee5" integrity sha512-AI2r85+4MquTw9ZYqabu4nMwy9Oftlfa/e/52t9IjtfG+mGBbTNdAoZ3RQKLHR6r0wQnwZnPIEh/Ya6XTWAKNA== +lunr@^2.3.9: + version "2.3.9" + resolved "https://registry.yarnpkg.com/lunr/-/lunr-2.3.9.tgz#18b123142832337dd6e964df1a5a7707b25d35e1" + integrity sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow== + mafmt@^6.0.2: version "6.0.10" resolved "https://registry.yarnpkg.com/mafmt/-/mafmt-6.0.10.tgz#3ad251c78f14f8164e66f70fd3265662da41113a" @@ -12997,6 +13007,11 @@ markdown-extensions@^1.0.0: resolved "https://registry.yarnpkg.com/markdown-extensions/-/markdown-extensions-1.1.1.tgz#fea03b539faeaee9b4ef02a3769b455b189f7fc3" integrity sha512-WWC0ZuMzCyDHYCasEGs4IPvLyTGftYwh6wIEOULOF0HXcqZlhwRzrK0w2VUlxWA98xnvb/jszw4ZSkJ6ADpM6Q== +marked@^4.2.12: + version "4.3.0" + resolved "https://registry.yarnpkg.com/marked/-/marked-4.3.0.tgz#796362821b019f734054582038b116481b456cf3" + integrity sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A== + matchstick-as@^0.5.0: version "0.5.2" resolved "https://registry.yarnpkg.com/matchstick-as/-/matchstick-as-0.5.2.tgz#6a6dde02d1d939c32458bd67bac688891a07a34c" @@ -13680,6 +13695,13 @@ minimatch@^5.0.1: dependencies: brace-expansion "^2.0.1" +minimatch@^7.1.3: + version "7.4.3" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-7.4.3.tgz#012cbf110a65134bb354ae9773b55256cdb045a2" + integrity sha512-5UB4yYusDtkRPbRiy1cqZ1IpGNcJCGlEMG17RKzPddpyiPKoCdwohbED8g4QXT0ewCt8LTkQXuljsUfQ3FKM4A== + dependencies: + brace-expansion "^2.0.1" + minimist-options@4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/minimist-options/-/minimist-options-4.1.0.tgz#c0655713c53a8a2ebd77ffa247d342c40f010619" @@ -16895,6 +16917,16 @@ shellwords@^0.1.1: resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b" integrity sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww== +shiki@^0.14.1: + version "0.14.1" + resolved "https://registry.yarnpkg.com/shiki/-/shiki-0.14.1.tgz#9fbe082d0a8aa2ad63df4fbf2ee11ec924aa7ee1" + integrity sha512-+Jz4nBkCBe0mEDqo1eKRcCdjRtrCjozmcbTUjbPTX7OOJfEbTZzlUWlZtGe3Gb5oV1/jnojhG//YZc3rs9zSEw== + dependencies: + ansi-sequence-parser "^1.1.0" + jsonc-parser "^3.2.0" + vscode-oniguruma "^1.7.0" + vscode-textmate "^8.0.0" + side-channel@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf" @@ -18254,6 +18286,16 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA== +typedoc@^0.23.28: + version "0.23.28" + resolved "https://registry.yarnpkg.com/typedoc/-/typedoc-0.23.28.tgz#3ce9c36ef1c273fa849d2dea18651855100d3ccd" + integrity sha512-9x1+hZWTHEQcGoP7qFmlo4unUoVJLB0H/8vfO/7wqTnZxg4kPuji9y3uRzEu0ZKez63OJAUmiGhUrtukC6Uj3w== + dependencies: + lunr "^2.3.9" + marked "^4.2.12" + minimatch "^7.1.3" + shiki "^0.14.1" + typescript@4.3.4: version "4.3.4" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.4.tgz#3f85b986945bcf31071decdd96cf8bfa65f9dcbc" @@ -18805,6 +18847,16 @@ vm2@^3.9.8: acorn "^8.7.0" acorn-walk "^8.2.0" +vscode-oniguruma@^1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz#439bfad8fe71abd7798338d1cd3dc53a8beea94b" + integrity sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA== + +vscode-textmate@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-8.0.0.tgz#2c7a3b1163ef0441097e0b5d6389cd5504b59e5d" + integrity sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg== + w3c-hr-time@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz#0a89cdf5cc15822df9c360543676963e0cc308cd"