diff --git a/.gitignore b/.gitignore index d2c12f28..351fce1d 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ examples/*/Cargo.lock examples/**/Cargo.lock .DS_Store docs/yarn.lock +ts/docs/ diff --git a/README.md b/README.md index f0e33bfa..0fa295b1 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ If you're familiar with developing in Ethereum's [Solidity](https://docs.solidit ## Getting Started For a quickstart guide and in depth tutorials, see the guided [documentation](https://project-serum.github.io/anchor/getting-started/introduction.html). -To jump straight to examples, go [here](https://github.com/project-serum/anchor/tree/master/examples). For the latest Rust API documentation, see [docs.rs](https://docs.rs/anchor-lang). +To jump straight to examples, go [here](https://github.com/project-serum/anchor/tree/master/examples). For the latest Rust and TypeScript API documentation, see [docs.rs](https://docs.rs/anchor-lang) and the [typedoc](https://project-serum.github.io/anchor/ts/index.html). ## Packages @@ -26,7 +26,8 @@ To jump straight to examples, go [here](https://github.com/project-serum/anchor/ | `anchor-lang` | Rust primitives for writing programs on Solana | [![Crates.io](https://img.shields.io/crates/v/anchor-lang?color=blue)](https://crates.io/crates/anchor-lang) | [![Docs.rs](https://docs.rs/anchor-lang/badge.svg)](https://docs.rs/anchor-lang) | | `anchor-spl` | CPI clients for SPL programs on Solana | ![crates](https://img.shields.io/crates/v/anchor-spl?color=blue) | [![Docs.rs](https://docs.rs/anchor-spl/badge.svg)](https://docs.rs/anchor-spl) | | `anchor-client` | Rust client for Anchor programs | ![crates](https://img.shields.io/crates/v/anchor-client?color=blue) | [![Docs.rs](https://docs.rs/anchor-client/badge.svg)](https://docs.rs/anchor-client) | -| `@project-serum/anchor` | TypeScript client for Anchor programs | [![npm](https://img.shields.io/npm/v/@project-serum/anchor.svg?color=blue)](https://www.npmjs.com/package/@project-serum/anchor) | [![Docs](https://img.shields.io/badge/docs-tutorials-blue)](https://project-serum.github.io/anchor/) | +| `@project-serum/anchor` | TypeScript client for Anchor programs | [![npm](https://img.shields.io/npm/v/@project-serum/anchor.svg?color=blue)](https://www.npmjs.com/package/@project-serum/anchor) | [![Docs](https://img.shields.io/badge/docs-typedoc-blue)](https://project-serum.github.io/anchor/ts/index.html) | + ## Note * **Anchor is in active development, so all APIs are subject to change.** diff --git a/docs/package.json b/docs/package.json index 23f9cac2..46f36b04 100755 --- a/docs/package.json +++ b/docs/package.json @@ -9,7 +9,7 @@ }, "repository": "/anchor", "scripts": { - "deploy": "yarn build && gh-pages -d src/.vuepress/dist", + "deploy": "gh-pages -d src/.vuepress/dist", "dev": "vuepress dev src", "build": "vuepress build src" }, diff --git a/ts/package.json b/ts/package.json index 1bd314c4..3d1e824c 100644 --- a/ts/package.json +++ b/ts/package.json @@ -17,7 +17,8 @@ "build:node": "tsc && tsc -p tsconfig.cjs.json", "lint:fix": "prettier src/** -w", "watch": "tsc -p tsconfig.cjs.json --watch", - "prepublishOnly": "yarn build" + "prepublishOnly": "yarn build", + "docs": "typedoc --excludePrivate --out ../docs/src/.vuepress/dist/ts/ src/index.ts" }, "dependencies": { "@project-serum/borsh": "^0.2.1", @@ -53,6 +54,7 @@ "prettier": "^2.1.2", "ts-jest": "^26.4.3", "ts-node": "^9.0.0", + "typedoc": "^0.20.36", "typescript": "^4.0.5" } } diff --git a/ts/src/coder.ts b/ts/src/coder.ts index f13d012c..578bfa44 100644 --- a/ts/src/coder.ts +++ b/ts/src/coder.ts @@ -98,7 +98,7 @@ class InstructionCoder { return this._encode(SIGHASH_STATE_NAMESPACE, ixName, ix); } - public _encode(nameSpace: string, ixName: string, ix: any): Buffer { + private _encode(nameSpace: string, ixName: string, ix: any): Buffer { const buffer = Buffer.alloc(1000); // TODO: use a tighter buffer. const methodName = camelCase(ixName); const len = this.ixLayout.get(methodName).encode(ix, buffer); diff --git a/ts/src/index.ts b/ts/src/index.ts index e42ba782..3385c920 100644 --- a/ts/src/index.ts +++ b/ts/src/index.ts @@ -7,6 +7,7 @@ import workspace from "./workspace"; import utils from "./utils"; import { Program } from "./program"; import { ProgramAccount } from "./program/namespace"; +import { Context, Accounts } from "./program/context"; let _provider: Provider | null = null; @@ -25,6 +26,8 @@ export { workspace, Program, ProgramAccount, + Context, + Accounts, Coder, setProvider, getProvider, diff --git a/ts/src/program/common.ts b/ts/src/program/common.ts index 38cf3a95..312134fb 100644 --- a/ts/src/program/common.ts +++ b/ts/src/program/common.ts @@ -1,7 +1,7 @@ import EventEmitter from "eventemitter3"; import { Idl, IdlInstruction, IdlAccountItem, IdlStateMethod } from "../idl"; import { ProgramError } from "../error"; -import { RpcAccounts } from "./context"; +import { Accounts } from "./context"; export type Subscription = { listener: number; @@ -40,7 +40,7 @@ export function toInstruction( // Throws error if any account required for the `ix` is not given. export function validateAccounts( ixAccounts: IdlAccountItem[], - accounts: RpcAccounts + accounts: Accounts ) { ixAccounts.forEach((acc) => { // @ts-ignore diff --git a/ts/src/program/context.ts b/ts/src/program/context.ts index 6fdd3883..992399ce 100644 --- a/ts/src/program/context.ts +++ b/ts/src/program/context.ts @@ -8,41 +8,61 @@ import { import { IdlInstruction } from "../idl"; /** - * RpcContext provides all arguments for an RPC/IX invocation that are not - * covered by the instruction enum. + * Context provides all non-argument inputs for generating Anchor transactions. */ -type RpcContext = { - // Accounts the instruction will use. - accounts?: RpcAccounts; - // All accounts to pass into an instruction *after* the main `accounts`. +export type Context = { + /** + * Accounts used in the instruction context. + */ + accounts?: Accounts; + + /** + * All accounts to pass into an instruction *after* the main `accounts`. + * This can be used for optional or otherwise unknown accounts. + */ remainingAccounts?: AccountMeta[]; - // Accounts that must sign the transaction. + + /** + * Accounts that must sign a given transaction. + */ signers?: Array; - // Instructions to run *before* the specified rpc instruction. + + /** + * Instructions to run *before* a given method. Often this is used, for + * example to create accounts prior to executing a method. + */ instructions?: TransactionInstruction[]; - // RpcOptions. - options?: RpcOptions; - // Private namespace for dev. + + /** + * Commitment parameters to use for a transaction. + */ + options?: ConfirmOptions; + + /** + * @hidden + * + * Private namespace for development. + */ __private?: { logAccounts: boolean }; }; /** - * Dynamic object representing a set of accounts given to an rpc/ix invocation. - * The name of each key should match the name for that account in the IDL. + * A set of accounts mapping one-to-one to the program's accounts struct, i.e., + * the type deriving `#[derive(Accounts)]`. + * + * The name of each field should match the name for that account in the IDL. + * + * If multiple accounts are nested in the rust program, then they should be + * nested here. */ -export type RpcAccounts = { - [key: string]: PublicKey | RpcAccounts; +export type Accounts = { + [key: string]: PublicKey | Accounts; }; -/** - * Options for an RPC invocation. - */ -export type RpcOptions = ConfirmOptions; - export function splitArgsAndCtx( idlIx: IdlInstruction, args: any[] -): [any[], RpcContext] { +): [any[], Context] { let options = {}; const inputLen = idlIx.args ? idlIx.args.length : 0; diff --git a/ts/src/program/index.ts b/ts/src/program/index.ts index 70b9a0d5..401afd54 100644 --- a/ts/src/program/index.ts +++ b/ts/src/program/index.ts @@ -4,97 +4,267 @@ import Provider from "../provider"; import { Idl, idlAddress, decodeIdlAccount } from "../idl"; import Coder from "../coder"; import NamespaceFactory, { - Rpcs, - Ixs, - Txs, - Accounts, - State, - Simulate, + RpcNamespace, + InstructionNamespace, + TransactionNamespace, + AccountNamespace, + StateNamespace, + SimulateNamespace, } from "./namespace"; import { getProvider } from "../"; import { decodeUtf8 } from "../utils"; import { EventParser } from "./event"; /** - * Program is the IDL deserialized representation of a Solana program. + * ## Program + * + * Program provides the IDL deserialized client representation of an Anchor + * program. + * + * This API is the one stop shop for all things related to communicating with + * on-chain programs. Among other things, one can send transactions, fetch + * deserialized accounts, decode instruction data, subscribe to account + * changes, and listen to events. + * + * In addition to field accessors and methods, the object provides a set of + * dynamically generated properties (internally referred to as namespaces) that + * map one-to-one to program instructions and accounts. These namespaces + * generally can be used as follows: + * + * ```javascript + * program.. + * ``` + * + * API specifics are namespace dependent. The examples used in the documentation + * below will refer to the two counter examples found + * [here](https://project-serum.github.io/anchor/ts/#examples). */ export class Program { /** - * Address of the program. + * Async methods to send signed transactions invoking *non*-state methods + * on an Anchor program. + * + * ## rpc + * + * ```javascript + * program.rpc.(...args, ctx); + * ``` + * + * ## Parameters + * + * 1. `args` - The positional arguments for the program. The type and number + * of these arguments depend on the program being used. + * 2. `ctx` - [[Context]] non-argument parameters to pass to the method. + * Always the last parameter in the method call. + * + * ## Example + * + * To send a transaction invoking the `increment` method above, + * + * ```javascript + * const txSignature = await program.rpc.increment({ + * accounts: { + * counter, + * authority, + * }, + * }); + * ``` */ - readonly programId: PublicKey; - - /** - * IDL describing this program's interface. - */ - readonly idl: Idl; - - /** - * Async functions to invoke instructions against an Anchor program. - */ - readonly rpc: Rpcs; + readonly rpc: RpcNamespace; /** * Async functions to fetch deserialized program accounts from a cluster. + * + * ## account + * + * ```javascript + * program.account.(publicKey); + * ``` + * + * ## Parameters + * + * 1. `publicKey` - The [[PublicKey]] of the account. + * + * ## Example + * + * To fetch a `Counter` object from the above example, + * + * ```javascript + * const counter = await program.account.counter(publicKey); + * ``` */ - readonly account: Accounts; + readonly account: AccountNamespace; /** - * Functions to build `TransactionInstruction` objects. + * Functions to build [[TransactionInstruction]] objects for program methods. + * + * ## instruction + * + * ```javascript + * program.instruction.(...args, ctx); + * ``` + * + * ## Parameters + * + * 1. `args` - The positional arguments for the program. The type and number + * of these arguments depend on the program being used. + * 2. `ctx` - [[Context]] non-argument parameters to pass to the method. + * Always the last parameter in the method call. + * + * ## Example + * + * To create an instruction for the `increment` method above, + * + * ```javascript + * const tx = await program.instruction.increment({ + * accounts: { + * counter, + * }, + * }); + * ``` */ - readonly instruction: Ixs; + readonly instruction: InstructionNamespace; /** - * Functions to build `Transaction` objects. + * Functions to build [[Transaction]] objects. + * + * ## transaction + * + * ```javascript + * program.transaction.(...args, ctx); + * ``` + * + * ## Parameters + * + * 1. `args` - The positional arguments for the program. The type and number + * of these arguments depend on the program being used. + * 2. `ctx` - [[Context]] non-argument parameters to pass to the method. + * Always the last parameter in the method call. + * + * ## Example + * + * To create an instruction for the `increment` method above, + * + * ```javascript + * const tx = await program.transaction.increment({ + * accounts: { + * counter, + * }, + * }); + * ``` */ - readonly transaction: Txs; + readonly transaction: TransactionNamespace; /** - * Async functions to simulate instructions against an Anchor program. + * Async functions to simulate instructions against an Anchor program, + * returning a list of deserialized events *and* raw program logs. + * + * One can use this to read data calculated from a program on chain, by + * emitting an event in the program and reading the emitted event client side + * via the `simulate` namespace. + * + * ## simulate + * + * ```javascript + * program.simulate.(...args, ctx); + * ``` + * + * ## Parameters + * + * 1. `args` - The positional arguments for the program. The type and number + * of these arguments depend on the program being used. + * 2. `ctx` - [[Context]] non-argument parameters to pass to the method. + * Always the last parameter in the method call. + * + * ## Example + * + * To simulate the `increment` method above, + * + * ```javascript + * const tx = await program.simulate.increment({ + * accounts: { + * counter, + * }, + * }); + * ``` */ - readonly simulate: Simulate; - - /** - * Coder for serializing rpc requests. - */ - readonly coder: Coder; + readonly simulate: SimulateNamespace; /** * Object with state account accessors and rpcs. */ - readonly state: State; + readonly state: StateNamespace; + + /** + * Address of the program. + */ + public get programId(): PublicKey { + return this._programId; + } + private _programId: PublicKey; + + /** + * IDL defining the program's interface. + */ + public get idl(): Idl { + return this._idl; + } + private _idl: Idl; + + /** + * Coder for serializing requests. + */ + public get coder(): Coder { + return this._coder; + } + private _coder: Coder; /** * Wallet and network provider. */ - readonly provider: Provider; + public get provider(): Provider { + return this._provider; + } + private _provider: Provider; + /** + * @param idl The interface definition. + * @param programId The on-chain address of the program. + * @param provider The network and wallet context to use. If not provided + * then uses [[getProvider]]. + */ public constructor(idl: Idl, programId: PublicKey, provider?: Provider) { - this.idl = idl; - this.programId = programId; - this.provider = provider ?? getProvider(); + // Fields. + this._idl = idl; + this._programId = programId; + this._provider = provider ?? getProvider(); + this._coder = new Coder(idl); - // Build the serializer. - const coder = new Coder(idl); - - // Build the dynamic namespaces. - const [rpcs, ixs, txs, accounts, state, simulate] = NamespaceFactory.build( - idl, - coder, - programId, - this.provider - ); - this.rpc = rpcs; - this.instruction = ixs; - this.transaction = txs; - this.account = accounts; - this.coder = coder; + // Dynamic namespaces. + const [ + rpc, + instruction, + transaction, + account, + state, + simulate, + ] = NamespaceFactory.build(idl, this._coder, programId, this._provider); + this.rpc = rpc; + this.instruction = instruction; + this.transaction = transaction; + this.account = account; this.state = state; this.simulate = simulate; } /** - * Generates a Program client by fetching the IDL from chain. + * Generates a Program client by fetching the IDL from the network. + * + * In order to use this method, an IDL must have been previously initialized + * via the anchor CLI's `anchor idl init` command. + * + * @param programId The on-chain address of the program. + * @param provider The network and wallet context. */ public static async at(programId: PublicKey, provider?: Provider) { const idl = await Program.fetchIdl(programId, provider); @@ -103,6 +273,12 @@ export class Program { /** * Fetches an idl from the blockchain. + * + * In order to use this method, an IDL must have been previously initialized + * via the anchor CLI's `anchor idl init` command. + * + * @param programId The on-chain address of the program. + * @param provider The network and wallet context. */ public static async fetchIdl(programId: PublicKey, provider?: Provider) { provider = provider ?? getProvider(); @@ -116,13 +292,21 @@ export class Program { /** * Invokes the given callback everytime the given event is emitted. + * + * @param eventName The PascalCase name of the event, provided by the IDL. + * @param callback The function to invoke whenever the event is emitted from + * program logs. */ public addEventListener( eventName: string, callback: (event: any, slot: number) => void ): number { - const eventParser = new EventParser(this.coder, this.programId, this.idl); - return this.provider.connection.onLogs(this.programId, (logs, ctx) => { + const eventParser = new EventParser( + this._coder, + this._programId, + this._idl + ); + return this._provider.connection.onLogs(this._programId, (logs, ctx) => { if (logs.err) { console.error(logs); return; @@ -135,7 +319,10 @@ export class Program { }); } + /** + * Unsubscribes from the given event listener. + */ public async removeEventListener(listener: number): Promise { - return this.provider.connection.removeOnLogsListener(listener); + return this._provider.connection.removeOnLogsListener(listener); } } diff --git a/ts/src/program/namespace/account.ts b/ts/src/program/namespace/account.ts index 671f2db6..e84b9821 100644 --- a/ts/src/program/namespace/account.ts +++ b/ts/src/program/namespace/account.ts @@ -21,7 +21,7 @@ import { Subscription } from "../common"; * Accounts is a dynamically generated object to fetch any given account * of a program. */ -export interface Accounts { +export interface AccountNamespace { [key: string]: AccountFn; } @@ -44,6 +44,8 @@ type AccountProps = { }; /** + * @hidden + * * Deserialized account owned by a program. */ export type ProgramAccount = { @@ -54,15 +56,15 @@ export type ProgramAccount = { // Tracks all subscriptions. const subscriptions: Map = new Map(); -export default class AccountNamespace { +export default class AccountFactory { // Returns the generated accounts namespace. public static build( idl: Idl, coder: Coder, programId: PublicKey, provider: Provider - ): Accounts { - const accountFns: Accounts = {}; + ): AccountNamespace { + const accountFns: AccountNamespace = {}; idl.accounts.forEach((idlAccount) => { const name = camelCase(idlAccount.name); diff --git a/ts/src/program/namespace/index.ts b/ts/src/program/namespace/index.ts index e9df79ef..4aa5f08f 100644 --- a/ts/src/program/namespace/index.ts +++ b/ts/src/program/namespace/index.ts @@ -4,20 +4,20 @@ import Coder from "../../coder"; import Provider from "../../provider"; import { Idl } from "../../idl"; import { parseIdlErrors } from "../common"; -import StateNamespace, { State } from "./state"; -import InstructionNamespace, { Ixs } from "./instruction"; -import TransactionNamespace, { Txs } from "./transaction"; -import RpcNamespace, { Rpcs } from "./rpc"; -import AccountNamespace, { Accounts } from "./account"; -import SimulateNamespace, { Simulate } from "./simulate"; +import StateFactory, { StateNamespace } from "./state"; +import InstructionFactory, { InstructionNamespace } from "./instruction"; +import TransactionFactory, { TransactionNamespace } from "./transaction"; +import RpcFactory, { RpcNamespace } from "./rpc"; +import AccountFactory, { AccountNamespace } from "./account"; +import SimulateFactory, { SimulateNamespace } from "./simulate"; // Re-exports. -export { State } from "./state"; -export { Ixs } from "./instruction"; -export { Txs, TxFn } from "./transaction"; -export { Rpcs, RpcFn } from "./rpc"; -export { Accounts, AccountFn, ProgramAccount } from "./account"; -export { Simulate } from "./simulate"; +export { StateNamespace } from "./state"; +export { InstructionNamespace } from "./instruction"; +export { TransactionNamespace, TxFn } from "./transaction"; +export { RpcNamespace, RpcFn } from "./rpc"; +export { AccountNamespace, AccountFn, ProgramAccount } from "./account"; +export { SimulateNamespace } from "./simulate"; export default class NamespaceFactory { /** @@ -30,15 +30,22 @@ export default class NamespaceFactory { coder: Coder, programId: PublicKey, provider: Provider - ): [Rpcs, Ixs, Txs, Accounts, State, Simulate] { + ): [ + RpcNamespace, + InstructionNamespace, + TransactionNamespace, + AccountNamespace, + StateNamespace, + SimulateNamespace + ] { const idlErrors = parseIdlErrors(idl); - const rpcs: Rpcs = {}; - const ixFns: Ixs = {}; - const txFns: Txs = {}; - const simulateFns: Simulate = {}; + const rpc: RpcNamespace = {}; + const instruction: InstructionNamespace = {}; + const transaction: TransactionNamespace = {}; + const simulate: SimulateNamespace = {}; - const state = StateNamespace.build( + const state = StateFactory.build( idl, coder, programId, @@ -47,10 +54,10 @@ export default class NamespaceFactory { ); idl.instructions.forEach((idlIx) => { - const ix = InstructionNamespace.build(idlIx, coder, programId); - const tx = TransactionNamespace.build(idlIx, ix); - const rpc = RpcNamespace.build(idlIx, tx, idlErrors, provider); - const simulate = SimulateNamespace.build( + const ix = InstructionFactory.build(idlIx, coder, programId); + const tx = TransactionFactory.build(idlIx, ix); + const rpc = RpcFactory.build(idlIx, tx, idlErrors, provider); + const simulate = SimulateFactory.build( idlIx, tx, idlErrors, @@ -62,16 +69,16 @@ export default class NamespaceFactory { const name = camelCase(idlIx.name); - ixFns[name] = ix; - txFns[name] = tx; - rpcs[name] = rpc; - simulateFns[name] = simulate; + instruction[name] = ix; + transaction[name] = tx; + rpc[name] = rpc; + simulate[name] = simulate; }); const accountFns = idl.accounts - ? AccountNamespace.build(idl, coder, programId, provider) + ? AccountFactory.build(idl, coder, programId, provider) : {}; - return [rpcs, ixFns, txFns, accountFns, state, simulateFns]; + return [rpc, instruction, transaction, accountFns, state, simulate]; } } diff --git a/ts/src/program/namespace/instruction.ts b/ts/src/program/namespace/instruction.ts index 9cd49269..06543adc 100644 --- a/ts/src/program/namespace/instruction.ts +++ b/ts/src/program/namespace/instruction.ts @@ -3,12 +3,12 @@ import { IdlAccount, IdlInstruction, IdlAccountItem } from "../../idl"; import { IdlError } from "../../error"; import Coder from "../../coder"; import { toInstruction, validateAccounts } from "../common"; -import { RpcAccounts, splitArgsAndCtx } from "../context"; +import { Accounts, splitArgsAndCtx } from "../context"; /** * Dynamically generated instruction namespace. */ -export interface Ixs { +export interface InstructionNamespace { [key: string]: IxFn; } @@ -17,10 +17,10 @@ export interface Ixs { */ export type IxFn = IxProps & ((...args: any[]) => any); type IxProps = { - accounts: (ctx: RpcAccounts) => any; + accounts: (ctx: Accounts) => any; }; -export default class InstructionNamespace { +export default class InstructionNamespaceFactory { // Builds the instuction namespace. public static build( idlIx: IdlInstruction, @@ -36,7 +36,7 @@ export default class InstructionNamespace { validateAccounts(idlIx.accounts, ctx.accounts); validateInstruction(idlIx, ...args); - const keys = InstructionNamespace.accountsArray( + const keys = InstructionNamespaceFactory.accountsArray( ctx.accounts, idlIx.accounts ); @@ -59,25 +59,22 @@ export default class InstructionNamespace { }; // Utility fn for ordering the accounts for this instruction. - ix["accounts"] = (accs: RpcAccounts) => { - return InstructionNamespace.accountsArray(accs, idlIx.accounts); + ix["accounts"] = (accs: Accounts) => { + return InstructionNamespaceFactory.accountsArray(accs, idlIx.accounts); }; return ix; } - public static accountsArray( - ctx: RpcAccounts, - accounts: IdlAccountItem[] - ): any { + public static accountsArray(ctx: Accounts, accounts: IdlAccountItem[]): any { return accounts .map((acc: IdlAccountItem) => { // Nested accounts. // @ts-ignore const nestedAccounts: IdlAccountItem[] | undefined = acc.accounts; if (nestedAccounts !== undefined) { - const rpcAccs = ctx[acc.name] as RpcAccounts; - return InstructionNamespace.accountsArray( + const rpcAccs = ctx[acc.name] as Accounts; + return InstructionNamespaceFactory.accountsArray( rpcAccs, nestedAccounts ).flat(); diff --git a/ts/src/program/namespace/rpc.ts b/ts/src/program/namespace/rpc.ts index f12b3c7b..bd82381e 100644 --- a/ts/src/program/namespace/rpc.ts +++ b/ts/src/program/namespace/rpc.ts @@ -8,7 +8,7 @@ import { TxFn } from "./transaction"; /** * Dynamically generated rpc namespace. */ -export interface Rpcs { +export interface RpcNamespace { [key: string]: RpcFn; } @@ -17,7 +17,7 @@ export interface Rpcs { */ export type RpcFn = (...args: any[]) => Promise; -export default class RpcNamespace { +export default class RpcFactory { // Builds the rpc namespace. public static build( idlIx: IdlInstruction, diff --git a/ts/src/program/namespace/simulate.ts b/ts/src/program/namespace/simulate.ts index eaaf8e9b..20312da3 100644 --- a/ts/src/program/namespace/simulate.ts +++ b/ts/src/program/namespace/simulate.ts @@ -11,7 +11,7 @@ import { Idl } from "../../idl"; /** * Dynamically generated simualte namespace. */ -export interface Simulate { +export interface SimulateNamespace { [key: string]: SimulateFn; } @@ -25,7 +25,7 @@ type SimulateResponse = { raw: string[]; }; -export default class SimulateNamespace { +export default class SimulateFactory { // Builds the rpc namespace. public static build( idlIx: IdlInstruction, diff --git a/ts/src/program/namespace/state.ts b/ts/src/program/namespace/state.ts index a1e0926f..61a68b32 100644 --- a/ts/src/program/namespace/state.ts +++ b/ts/src/program/namespace/state.ts @@ -11,27 +11,27 @@ import { import Provider from "../../provider"; import { Idl, IdlStateMethod } from "../../idl"; import Coder, { stateDiscriminator } from "../../coder"; -import { Rpcs, Ixs } from "./"; +import { RpcNamespace, InstructionNamespace } from "./"; import { Subscription, translateError, toInstruction, validateAccounts, } from "../common"; -import { RpcAccounts, splitArgsAndCtx } from "../context"; -import InstructionNamespace from "./instruction"; +import { Accounts, splitArgsAndCtx } from "../context"; +import InstructionNamespaceFactory from "./instruction"; -export type State = () => +export type StateNamespace = () => | Promise | { address: () => Promise; - rpc: Rpcs; - instruction: Ixs; + rpc: RpcNamespace; + instruction: InstructionNamespace; subscribe: (address: PublicKey, commitment?: Commitment) => EventEmitter; unsubscribe: (address: PublicKey) => void; }; -export default class StateNamespace { +export default class StateFactory { // Builds the state namespace. public static build( idl: Idl, @@ -39,7 +39,7 @@ export default class StateNamespace { programId: PublicKey, idlErrors: Map, provider: Provider - ): State | undefined { + ): StateNamespace | undefined { if (idl.state === undefined) { return undefined; } @@ -62,11 +62,11 @@ export default class StateNamespace { }; // Namespace with all rpc functions. - const rpc: Rpcs = {}; - const ix: Ixs = {}; + const rpc: RpcNamespace = {}; + const ix: InstructionNamespace = {}; idl.state.methods.forEach((m: IdlStateMethod) => { - const accounts = async (accounts: RpcAccounts): Promise => { + const accounts = async (accounts: Accounts): Promise => { const keys = await stateInstructionKeys( programId, provider, @@ -74,7 +74,7 @@ export default class StateNamespace { accounts ); return keys.concat( - InstructionNamespace.accountsArray(accounts, m.accounts) + InstructionNamespaceFactory.accountsArray(accounts, m.accounts) ); }; const ixFn = async (...args: any[]): Promise => { @@ -177,7 +177,7 @@ async function stateInstructionKeys( programId: PublicKey, provider: Provider, m: IdlStateMethod, - accounts: RpcAccounts + accounts: Accounts ) { if (m.name === "new") { // Ctor `new` method. diff --git a/ts/src/program/namespace/transaction.ts b/ts/src/program/namespace/transaction.ts index 1c9bda9c..30cabf83 100644 --- a/ts/src/program/namespace/transaction.ts +++ b/ts/src/program/namespace/transaction.ts @@ -6,7 +6,7 @@ import { IxFn } from "./instruction"; /** * Dynamically generated transaction namespace. */ -export interface Txs { +export interface TransactionNamespace { [key: string]: TxFn; } @@ -15,7 +15,7 @@ export interface Txs { */ export type TxFn = (...args: any[]) => Transaction; -export default class TransactionNamespace { +export default class TransactionFactory { // Builds the transaction namespace. public static build(idlIx: IdlInstruction, ixFn: IxFn): TxFn { const txFn = (...args: any[]): Transaction => { diff --git a/ts/src/provider.ts b/ts/src/provider.ts index 842e471a..a878baf0 100644 --- a/ts/src/provider.ts +++ b/ts/src/provider.ts @@ -11,7 +11,16 @@ import { Commitment, } from "@solana/web3.js"; +/** + * The network and wallet context used to send transactions paid for and signed + * by the provider. + */ export default class Provider { + /** + * @param connection The cluster connection where the program is deployed. + * @param wallet The wallet used to pay for and sign all transactions. + * @param opts Transaction confirmation options to use by default. + */ constructor( readonly connection: Connection, readonly wallet: Wallet, @@ -25,7 +34,14 @@ export default class Provider { }; } - // Node only api. + /** + * Returns a `Provider` with a wallet read from the local filesystem. + * + * @param url The network cluster url. + * @param opts The default transaction confirmation options. + * + * (This api is for Node only.) + */ static local(url?: string, opts?: ConfirmOptions): Provider { opts = opts || Provider.defaultOptions(); const connection = new Connection( @@ -36,7 +52,12 @@ export default class Provider { return new Provider(connection, wallet, opts); } - // Node only api. + /** + * Returns a `Provider` read from the `ANCHOR_PROVIDER_URL` envirnment + * variable + * + * (This api is for Node only.) + */ static env(): Provider { const process = require("process"); const url = process.env.ANCHOR_PROVIDER_URL; @@ -50,6 +71,14 @@ export default class Provider { return new Provider(connection, wallet, options); } + /** + * Sends the given transaction, ppaid for and signed by the provider's wallet. + * + * @param tx The transaction to send. + * @param signers The set of signers in addition to the provdier wallet that + * will sign the transaction. + * @param opts Transaction confirmation options. + */ async send( tx: Transaction, signers?: Array, @@ -88,6 +117,9 @@ export default class Provider { return txId; } + /** + * Similar to `send`, but for an array of transactions and signers. + */ async sendAll( reqs: Array, opts?: ConfirmOptions @@ -138,6 +170,14 @@ export default class Provider { return sigs; } + /** + * Simulates the given transaction, returning emitted logs from execution. + * + * @param tx The transaction to send. + * @param signers The set of signers in addition to the provdier wallet that + * will sign the transaction. + * @param opts Transaction confirmation options. + */ async simulate( tx: Transaction, signers?: Array, @@ -173,12 +213,18 @@ export type SendTxRequest = { signers: Array; }; +/** + * Wallet interface for objects that can be used to sign provider transactions. + */ export interface Wallet { signTransaction(tx: Transaction): Promise; signAllTransactions(txs: Transaction[]): Promise; publicKey: PublicKey; } +/** + * Node only wallet. + */ export class NodeWallet implements Wallet { constructor(readonly payer: Account) {} diff --git a/ts/src/workspace.ts b/ts/src/workspace.ts index 1723144b..b7b9d785 100644 --- a/ts/src/workspace.ts +++ b/ts/src/workspace.ts @@ -4,8 +4,14 @@ import { Program } from "./program"; let _populatedWorkspace = false; -// Workspace program discovery only works for node environments. -export default new Proxy({} as any, { +/** + * The `workspace` namespace provides a convenience API to automatically + * search for and deserialize [[Program]] objects defined by compiled IDLs + * in an Anchor workspace. + * + * This API is for Node only. + */ +const workspace = new Proxy({} as any, { get(workspaceCache: { [key: string]: Program }, programName: string) { const find = require("find"); const fs = require("fs"); @@ -51,3 +57,5 @@ export default new Proxy({} as any, { return workspaceCache[programName]; }, }); + +export default workspace; diff --git a/ts/yarn.lock b/ts/yarn.lock index c4bf48b8..601e91b8 100644 --- a/ts/yarn.lock +++ b/ts/yarn.lock @@ -1522,6 +1522,11 @@ color-name@~1.1.4: resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== +colors@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/colors/-/colors-1.4.0.tgz#c50491479d4c1bdaed2c9ced32cf7c7dc2360f78" + integrity sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA== + combined-stream@^1.0.6, combined-stream@~1.0.6: version "1.0.8" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" @@ -2297,7 +2302,7 @@ fragment-cache@^0.2.1: dependencies: map-cache "^0.2.2" -fs-extra@^9.0.0: +fs-extra@^9.0.0, fs-extra@^9.1.0: version "9.1.0" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d" integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ== @@ -2406,6 +2411,18 @@ glob-parent@^5.0.0, glob-parent@^5.1.0: dependencies: is-glob "^4.0.1" +glob@^7.0.0: + version "7.1.7" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.7.tgz#3b193e9233f01d42d0b3f78294bbeeb418f94a90" + integrity sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4: version "7.1.6" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" @@ -2464,6 +2481,18 @@ growly@^1.3.0: resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" integrity sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE= +handlebars@^4.7.7: + version "4.7.7" + resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.7.7.tgz#9ce33416aad02dbd6c8fafa8240d5d98004945a1" + integrity sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA== + dependencies: + minimist "^1.2.5" + neo-async "^2.6.0" + source-map "^0.6.1" + wordwrap "^1.0.0" + optionalDependencies: + uglify-js "^3.1.4" + har-schema@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" @@ -2667,6 +2696,11 @@ ini@^1.3.4: resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c" integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew== +interpret@^1.0.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.4.0.tgz#665ab8bc4da27a774a40584e812e3e0fa45b1a1e" + integrity sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA== + ip-regex@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/ip-regex/-/ip-regex-2.1.0.tgz#fa78bf5d2e6913c911ce9f819ee5146bb6d844e9" @@ -3618,7 +3652,7 @@ lodash@^4.17.15, lodash@^4.17.19: resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52" integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA== -lodash@^4.17.20: +lodash@^4.17.20, lodash@^4.17.21: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== @@ -3647,6 +3681,13 @@ lower-case@^2.0.2: dependencies: tslib "^2.0.3" +lru-cache@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" + integrity sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w== + dependencies: + yallist "^3.0.2" + lru-cache@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" @@ -3654,6 +3695,11 @@ lru-cache@^6.0.0: dependencies: yallist "^4.0.0" +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== + make-dir@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f" @@ -3695,6 +3741,11 @@ map-visit@^1.0.0: dependencies: object-visit "^1.0.0" +marked@^2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/marked/-/marked-2.0.3.tgz#3551c4958c4da36897bda2a16812ef1399c8d6b0" + integrity sha512-5otztIIcJfPc2qGTN8cVtOJEjNJZ0jwa46INMagrYfk0EvqtRuEHLsEe0LrFS0/q+ZRKT0+kXK7P2T1AN5lWRA== + meow@^8.0.0: version "8.1.0" resolved "https://registry.yarnpkg.com/meow/-/meow-8.1.0.tgz#0fcaa267e35e4d58584b8205923df6021ddcc7ba" @@ -3781,7 +3832,7 @@ minimalistic-crypto-utils@^1.0.1: resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo= -minimatch@^3.0.4: +minimatch@^3.0.0, minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== @@ -3847,6 +3898,11 @@ natural-compare@^1.4.0: resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= +neo-async@^2.6.0: + version "2.6.2" + resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" + integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== + nice-try@^1.0.4: version "1.0.5" resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" @@ -3990,6 +4046,13 @@ onetime@^5.1.0: dependencies: mimic-fn "^2.1.0" +onigasm@^2.2.5: + version "2.2.5" + resolved "https://registry.yarnpkg.com/onigasm/-/onigasm-2.2.5.tgz#cc4d2a79a0fa0b64caec1f4c7ea367585a676892" + integrity sha512-F+th54mPc0l1lp1ZcFMyL/jTs2Tlq4SqIHKIXGZOR/VkHkF9A7Fr5rRr5+ZG/lWeRsyrClLYRq7s/yFQ/XhWCA== + dependencies: + lru-cache "^5.1.1" + opencollective-postinstall@^2.0.2: version "2.0.3" resolved "https://registry.yarnpkg.com/opencollective-postinstall/-/opencollective-postinstall-2.0.3.tgz#7a0fff978f6dbfa4d006238fbac98ed4198c3259" @@ -4197,7 +4260,7 @@ process-nextick-args@~2.0.0: resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== -progress@^2.0.0: +progress@^2.0.0, progress@^2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== @@ -4289,6 +4352,13 @@ readable-stream@~2.3.6: string_decoder "~1.1.1" util-deprecate "~1.0.1" +rechoir@^0.6.2: + version "0.6.2" + resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384" + integrity sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q= + dependencies: + resolve "^1.1.6" + redent@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/redent/-/redent-3.0.0.tgz#e557b7998316bb53c9f1f56fa626352c6963059f" @@ -4411,7 +4481,7 @@ resolve-url@^0.2.1: resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= -resolve@^1.10.0: +resolve@^1.1.6, resolve@^1.10.0: version "1.20.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.20.0.tgz#629a013fb3f70755d6f0b7935cc1c2c5378b1975" integrity sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A== @@ -4608,11 +4678,28 @@ shebang-regex@^3.0.0: resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== +shelljs@^0.8.4: + version "0.8.4" + resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.4.tgz#de7684feeb767f8716b326078a8a00875890e3c2" + integrity sha512-7gk3UZ9kOfPLIAbslLzyWeGiEqx9e3rxwZM0KE6EL8GlGwjym9Mrlx5/p33bWTu9YG6vcS4MBxYZDHYr5lr8BQ== + dependencies: + glob "^7.0.0" + interpret "^1.0.0" + rechoir "^0.6.2" + shellwords@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b" integrity sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww== +shiki@^0.9.3: + version "0.9.3" + resolved "https://registry.yarnpkg.com/shiki/-/shiki-0.9.3.tgz#7bf7bcf3ed50ca525ec89cc09254abce4264d5ca" + integrity sha512-NEjg1mVbAUrzRv2eIcUt3TG7X9svX7l3n3F5/3OdFq+/BxUdmBOeKGiH4icZJBLHy354Shnj6sfBTemea2e7XA== + dependencies: + onigasm "^2.2.5" + vscode-textmate "^5.2.0" + signal-exit@^3.0.0, signal-exit@^3.0.2: version "3.0.3" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c" @@ -5178,11 +5265,38 @@ typedarray-to-buffer@^3.1.5: dependencies: is-typedarray "^1.0.0" +typedoc-default-themes@^0.12.10: + version "0.12.10" + resolved "https://registry.yarnpkg.com/typedoc-default-themes/-/typedoc-default-themes-0.12.10.tgz#614c4222fe642657f37693ea62cad4dafeddf843" + integrity sha512-fIS001cAYHkyQPidWXmHuhs8usjP5XVJjWB8oZGqkTowZaz3v7g3KDZeeqE82FBrmkAnIBOY3jgy7lnPnqATbA== + +typedoc@^0.20.36: + version "0.20.36" + resolved "https://registry.yarnpkg.com/typedoc/-/typedoc-0.20.36.tgz#ee5523c32f566ad8283fc732aa8ea322d1a45f6a" + integrity sha512-qFU+DWMV/hifQ9ZAlTjdFO9wbUIHuUBpNXzv68ZyURAP9pInjZiO4+jCPeAzHVcaBCHER9WL/+YzzTt6ZlN/Nw== + dependencies: + colors "^1.4.0" + fs-extra "^9.1.0" + handlebars "^4.7.7" + lodash "^4.17.21" + lunr "^2.3.9" + marked "^2.0.3" + minimatch "^3.0.0" + progress "^2.0.3" + shelljs "^0.8.4" + shiki "^0.9.3" + typedoc-default-themes "^0.12.10" + typescript@^4.0.5: version "4.1.3" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.3.tgz#519d582bd94cba0cf8934c7d8e8467e473f53bb7" integrity sha512-B3ZIOf1IKeH2ixgHhj6la6xdwR9QrLC5d1VKeCSY4tvkqhF2eqd9O7txNlS0PO3GrBAFIdr3L1ndNwteUbZLYg== +uglify-js@^3.1.4: + version "3.13.5" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.13.5.tgz#5d71d6dbba64cf441f32929b1efce7365bb4f113" + integrity sha512-xtB8yEqIkn7zmOyS2zUNBsYCBRhDkvlNxMMY2smuJ/qA8NCHeQvKCF3i9Z4k8FJH4+PJvZRtMrPynfZ75+CSZw== + union-value@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.1.tgz#0b6fe7b835aecda61c6ea4d4f02c14221e109847" @@ -5276,6 +5390,11 @@ verror@1.10.0: core-util-is "1.0.2" extsprintf "^1.2.0" +vscode-textmate@^5.2.0: + version "5.4.0" + resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-5.4.0.tgz#4b25ffc1f14ac3a90faf9a388c67a01d24257cd7" + integrity sha512-c0Q4zYZkcLizeYJ3hNyaVUM2AA8KDhNCA3JvXY8CeZSJuBdAy3bAvSbv46RClC4P3dSO9BdwhnKEx2zOo6vP/w== + w3c-hr-time@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz#0a89cdf5cc15822df9c360543676963e0cc308cd" @@ -5357,6 +5476,11 @@ word-wrap@^1.2.3, word-wrap@~1.2.3: resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== +wordwrap@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" + integrity sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus= + wrap-ansi@^6.2.0: version "6.2.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53" @@ -5411,6 +5535,11 @@ y18n@^4.0.0: resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.1.tgz#8db2b83c31c5d75099bb890b23f3094891e247d4" integrity sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ== +yallist@^3.0.2: + version "3.1.1" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" + integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== + yallist@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72"