ts: Setup typedoc (#271)
This commit is contained in:
parent
6be1a065e5
commit
01cacfe0a2
|
@ -12,3 +12,4 @@ examples/*/Cargo.lock
|
||||||
examples/**/Cargo.lock
|
examples/**/Cargo.lock
|
||||||
.DS_Store
|
.DS_Store
|
||||||
docs/yarn.lock
|
docs/yarn.lock
|
||||||
|
ts/docs/
|
||||||
|
|
|
@ -17,7 +17,7 @@ If you're familiar with developing in Ethereum's [Solidity](https://docs.solidit
|
||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
For a quickstart guide and in depth tutorials, see the guided [documentation](https://project-serum.github.io/anchor/getting-started/introduction.html).
|
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
|
## 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-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-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) |
|
| `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
|
## Note
|
||||||
|
|
||||||
* **Anchor is in active development, so all APIs are subject to change.**
|
* **Anchor is in active development, so all APIs are subject to change.**
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
},
|
},
|
||||||
"repository": "/anchor",
|
"repository": "/anchor",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"deploy": "yarn build && gh-pages -d src/.vuepress/dist",
|
"deploy": "gh-pages -d src/.vuepress/dist",
|
||||||
"dev": "vuepress dev src",
|
"dev": "vuepress dev src",
|
||||||
"build": "vuepress build src"
|
"build": "vuepress build src"
|
||||||
},
|
},
|
||||||
|
|
|
@ -17,7 +17,8 @@
|
||||||
"build:node": "tsc && tsc -p tsconfig.cjs.json",
|
"build:node": "tsc && tsc -p tsconfig.cjs.json",
|
||||||
"lint:fix": "prettier src/** -w",
|
"lint:fix": "prettier src/** -w",
|
||||||
"watch": "tsc -p tsconfig.cjs.json --watch",
|
"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": {
|
"dependencies": {
|
||||||
"@project-serum/borsh": "^0.2.1",
|
"@project-serum/borsh": "^0.2.1",
|
||||||
|
@ -53,6 +54,7 @@
|
||||||
"prettier": "^2.1.2",
|
"prettier": "^2.1.2",
|
||||||
"ts-jest": "^26.4.3",
|
"ts-jest": "^26.4.3",
|
||||||
"ts-node": "^9.0.0",
|
"ts-node": "^9.0.0",
|
||||||
|
"typedoc": "^0.20.36",
|
||||||
"typescript": "^4.0.5"
|
"typescript": "^4.0.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ class InstructionCoder {
|
||||||
return this._encode(SIGHASH_STATE_NAMESPACE, ixName, ix);
|
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 buffer = Buffer.alloc(1000); // TODO: use a tighter buffer.
|
||||||
const methodName = camelCase(ixName);
|
const methodName = camelCase(ixName);
|
||||||
const len = this.ixLayout.get(methodName).encode(ix, buffer);
|
const len = this.ixLayout.get(methodName).encode(ix, buffer);
|
||||||
|
|
|
@ -7,6 +7,7 @@ import workspace from "./workspace";
|
||||||
import utils from "./utils";
|
import utils from "./utils";
|
||||||
import { Program } from "./program";
|
import { Program } from "./program";
|
||||||
import { ProgramAccount } from "./program/namespace";
|
import { ProgramAccount } from "./program/namespace";
|
||||||
|
import { Context, Accounts } from "./program/context";
|
||||||
|
|
||||||
let _provider: Provider | null = null;
|
let _provider: Provider | null = null;
|
||||||
|
|
||||||
|
@ -25,6 +26,8 @@ export {
|
||||||
workspace,
|
workspace,
|
||||||
Program,
|
Program,
|
||||||
ProgramAccount,
|
ProgramAccount,
|
||||||
|
Context,
|
||||||
|
Accounts,
|
||||||
Coder,
|
Coder,
|
||||||
setProvider,
|
setProvider,
|
||||||
getProvider,
|
getProvider,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import EventEmitter from "eventemitter3";
|
import EventEmitter from "eventemitter3";
|
||||||
import { Idl, IdlInstruction, IdlAccountItem, IdlStateMethod } from "../idl";
|
import { Idl, IdlInstruction, IdlAccountItem, IdlStateMethod } from "../idl";
|
||||||
import { ProgramError } from "../error";
|
import { ProgramError } from "../error";
|
||||||
import { RpcAccounts } from "./context";
|
import { Accounts } from "./context";
|
||||||
|
|
||||||
export type Subscription = {
|
export type Subscription = {
|
||||||
listener: number;
|
listener: number;
|
||||||
|
@ -40,7 +40,7 @@ export function toInstruction(
|
||||||
// Throws error if any account required for the `ix` is not given.
|
// Throws error if any account required for the `ix` is not given.
|
||||||
export function validateAccounts(
|
export function validateAccounts(
|
||||||
ixAccounts: IdlAccountItem[],
|
ixAccounts: IdlAccountItem[],
|
||||||
accounts: RpcAccounts
|
accounts: Accounts
|
||||||
) {
|
) {
|
||||||
ixAccounts.forEach((acc) => {
|
ixAccounts.forEach((acc) => {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
|
|
@ -8,41 +8,61 @@ import {
|
||||||
import { IdlInstruction } from "../idl";
|
import { IdlInstruction } from "../idl";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RpcContext provides all arguments for an RPC/IX invocation that are not
|
* Context provides all non-argument inputs for generating Anchor transactions.
|
||||||
* covered by the instruction enum.
|
*/
|
||||||
|
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.
|
||||||
*/
|
*/
|
||||||
type RpcContext = {
|
|
||||||
// Accounts the instruction will use.
|
|
||||||
accounts?: RpcAccounts;
|
|
||||||
// All accounts to pass into an instruction *after* the main `accounts`.
|
|
||||||
remainingAccounts?: AccountMeta[];
|
remainingAccounts?: AccountMeta[];
|
||||||
// Accounts that must sign the transaction.
|
|
||||||
|
/**
|
||||||
|
* Accounts that must sign a given transaction.
|
||||||
|
*/
|
||||||
signers?: Array<Account>;
|
signers?: Array<Account>;
|
||||||
// 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[];
|
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 };
|
__private?: { logAccounts: boolean };
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dynamic object representing a set of accounts given to an rpc/ix invocation.
|
* A set of accounts mapping one-to-one to the program's accounts struct, i.e.,
|
||||||
* The name of each key should match the name for that account in the IDL.
|
* 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 = {
|
export type Accounts = {
|
||||||
[key: string]: PublicKey | RpcAccounts;
|
[key: string]: PublicKey | Accounts;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Options for an RPC invocation.
|
|
||||||
*/
|
|
||||||
export type RpcOptions = ConfirmOptions;
|
|
||||||
|
|
||||||
export function splitArgsAndCtx(
|
export function splitArgsAndCtx(
|
||||||
idlIx: IdlInstruction,
|
idlIx: IdlInstruction,
|
||||||
args: any[]
|
args: any[]
|
||||||
): [any[], RpcContext] {
|
): [any[], Context] {
|
||||||
let options = {};
|
let options = {};
|
||||||
|
|
||||||
const inputLen = idlIx.args ? idlIx.args.length : 0;
|
const inputLen = idlIx.args ? idlIx.args.length : 0;
|
||||||
|
|
|
@ -4,97 +4,267 @@ import Provider from "../provider";
|
||||||
import { Idl, idlAddress, decodeIdlAccount } from "../idl";
|
import { Idl, idlAddress, decodeIdlAccount } from "../idl";
|
||||||
import Coder from "../coder";
|
import Coder from "../coder";
|
||||||
import NamespaceFactory, {
|
import NamespaceFactory, {
|
||||||
Rpcs,
|
RpcNamespace,
|
||||||
Ixs,
|
InstructionNamespace,
|
||||||
Txs,
|
TransactionNamespace,
|
||||||
Accounts,
|
AccountNamespace,
|
||||||
State,
|
StateNamespace,
|
||||||
Simulate,
|
SimulateNamespace,
|
||||||
} from "./namespace";
|
} from "./namespace";
|
||||||
import { getProvider } from "../";
|
import { getProvider } from "../";
|
||||||
import { decodeUtf8 } from "../utils";
|
import { decodeUtf8 } from "../utils";
|
||||||
import { EventParser } from "./event";
|
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.<namespace>.<program-specific-field>
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* 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 {
|
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.<method>(...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;
|
readonly rpc: RpcNamespace;
|
||||||
|
|
||||||
/**
|
|
||||||
* IDL describing this program's interface.
|
|
||||||
*/
|
|
||||||
readonly idl: Idl;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Async functions to invoke instructions against an Anchor program.
|
|
||||||
*/
|
|
||||||
readonly rpc: Rpcs;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Async functions to fetch deserialized program accounts from a cluster.
|
* Async functions to fetch deserialized program accounts from a cluster.
|
||||||
|
*
|
||||||
|
* ## account
|
||||||
|
*
|
||||||
|
* ```javascript
|
||||||
|
* program.account.<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.<method>(...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.<method>(...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.<method>(...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;
|
readonly simulate: SimulateNamespace;
|
||||||
|
|
||||||
/**
|
|
||||||
* Coder for serializing rpc requests.
|
|
||||||
*/
|
|
||||||
readonly coder: Coder;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Object with state account accessors and rpcs.
|
* 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.
|
* 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) {
|
public constructor(idl: Idl, programId: PublicKey, provider?: Provider) {
|
||||||
this.idl = idl;
|
// Fields.
|
||||||
this.programId = programId;
|
this._idl = idl;
|
||||||
this.provider = provider ?? getProvider();
|
this._programId = programId;
|
||||||
|
this._provider = provider ?? getProvider();
|
||||||
|
this._coder = new Coder(idl);
|
||||||
|
|
||||||
// Build the serializer.
|
// Dynamic namespaces.
|
||||||
const coder = new Coder(idl);
|
const [
|
||||||
|
rpc,
|
||||||
// Build the dynamic namespaces.
|
instruction,
|
||||||
const [rpcs, ixs, txs, accounts, state, simulate] = NamespaceFactory.build(
|
transaction,
|
||||||
idl,
|
account,
|
||||||
coder,
|
state,
|
||||||
programId,
|
simulate,
|
||||||
this.provider
|
] = NamespaceFactory.build(idl, this._coder, programId, this._provider);
|
||||||
);
|
this.rpc = rpc;
|
||||||
this.rpc = rpcs;
|
this.instruction = instruction;
|
||||||
this.instruction = ixs;
|
this.transaction = transaction;
|
||||||
this.transaction = txs;
|
this.account = account;
|
||||||
this.account = accounts;
|
|
||||||
this.coder = coder;
|
|
||||||
this.state = state;
|
this.state = state;
|
||||||
this.simulate = simulate;
|
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) {
|
public static async at(programId: PublicKey, provider?: Provider) {
|
||||||
const idl = await Program.fetchIdl(programId, provider);
|
const idl = await Program.fetchIdl(programId, provider);
|
||||||
|
@ -103,6 +273,12 @@ export class Program {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetches an idl from the blockchain.
|
* 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) {
|
public static async fetchIdl(programId: PublicKey, provider?: Provider) {
|
||||||
provider = provider ?? getProvider();
|
provider = provider ?? getProvider();
|
||||||
|
@ -116,13 +292,21 @@ export class Program {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invokes the given callback everytime the given event is emitted.
|
* 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(
|
public addEventListener(
|
||||||
eventName: string,
|
eventName: string,
|
||||||
callback: (event: any, slot: number) => void
|
callback: (event: any, slot: number) => void
|
||||||
): number {
|
): number {
|
||||||
const eventParser = new EventParser(this.coder, this.programId, this.idl);
|
const eventParser = new EventParser(
|
||||||
return this.provider.connection.onLogs(this.programId, (logs, ctx) => {
|
this._coder,
|
||||||
|
this._programId,
|
||||||
|
this._idl
|
||||||
|
);
|
||||||
|
return this._provider.connection.onLogs(this._programId, (logs, ctx) => {
|
||||||
if (logs.err) {
|
if (logs.err) {
|
||||||
console.error(logs);
|
console.error(logs);
|
||||||
return;
|
return;
|
||||||
|
@ -135,7 +319,10 @@ export class Program {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unsubscribes from the given event listener.
|
||||||
|
*/
|
||||||
public async removeEventListener(listener: number): Promise<void> {
|
public async removeEventListener(listener: number): Promise<void> {
|
||||||
return this.provider.connection.removeOnLogsListener(listener);
|
return this._provider.connection.removeOnLogsListener(listener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ import { Subscription } from "../common";
|
||||||
* Accounts is a dynamically generated object to fetch any given account
|
* Accounts is a dynamically generated object to fetch any given account
|
||||||
* of a program.
|
* of a program.
|
||||||
*/
|
*/
|
||||||
export interface Accounts {
|
export interface AccountNamespace {
|
||||||
[key: string]: AccountFn;
|
[key: string]: AccountFn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,6 +44,8 @@ type AccountProps = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @hidden
|
||||||
|
*
|
||||||
* Deserialized account owned by a program.
|
* Deserialized account owned by a program.
|
||||||
*/
|
*/
|
||||||
export type ProgramAccount<T = any> = {
|
export type ProgramAccount<T = any> = {
|
||||||
|
@ -54,15 +56,15 @@ export type ProgramAccount<T = any> = {
|
||||||
// Tracks all subscriptions.
|
// Tracks all subscriptions.
|
||||||
const subscriptions: Map<string, Subscription> = new Map();
|
const subscriptions: Map<string, Subscription> = new Map();
|
||||||
|
|
||||||
export default class AccountNamespace {
|
export default class AccountFactory {
|
||||||
// Returns the generated accounts namespace.
|
// Returns the generated accounts namespace.
|
||||||
public static build(
|
public static build(
|
||||||
idl: Idl,
|
idl: Idl,
|
||||||
coder: Coder,
|
coder: Coder,
|
||||||
programId: PublicKey,
|
programId: PublicKey,
|
||||||
provider: Provider
|
provider: Provider
|
||||||
): Accounts {
|
): AccountNamespace {
|
||||||
const accountFns: Accounts = {};
|
const accountFns: AccountNamespace = {};
|
||||||
|
|
||||||
idl.accounts.forEach((idlAccount) => {
|
idl.accounts.forEach((idlAccount) => {
|
||||||
const name = camelCase(idlAccount.name);
|
const name = camelCase(idlAccount.name);
|
||||||
|
|
|
@ -4,20 +4,20 @@ import Coder from "../../coder";
|
||||||
import Provider from "../../provider";
|
import Provider from "../../provider";
|
||||||
import { Idl } from "../../idl";
|
import { Idl } from "../../idl";
|
||||||
import { parseIdlErrors } from "../common";
|
import { parseIdlErrors } from "../common";
|
||||||
import StateNamespace, { State } from "./state";
|
import StateFactory, { StateNamespace } from "./state";
|
||||||
import InstructionNamespace, { Ixs } from "./instruction";
|
import InstructionFactory, { InstructionNamespace } from "./instruction";
|
||||||
import TransactionNamespace, { Txs } from "./transaction";
|
import TransactionFactory, { TransactionNamespace } from "./transaction";
|
||||||
import RpcNamespace, { Rpcs } from "./rpc";
|
import RpcFactory, { RpcNamespace } from "./rpc";
|
||||||
import AccountNamespace, { Accounts } from "./account";
|
import AccountFactory, { AccountNamespace } from "./account";
|
||||||
import SimulateNamespace, { Simulate } from "./simulate";
|
import SimulateFactory, { SimulateNamespace } from "./simulate";
|
||||||
|
|
||||||
// Re-exports.
|
// Re-exports.
|
||||||
export { State } from "./state";
|
export { StateNamespace } from "./state";
|
||||||
export { Ixs } from "./instruction";
|
export { InstructionNamespace } from "./instruction";
|
||||||
export { Txs, TxFn } from "./transaction";
|
export { TransactionNamespace, TxFn } from "./transaction";
|
||||||
export { Rpcs, RpcFn } from "./rpc";
|
export { RpcNamespace, RpcFn } from "./rpc";
|
||||||
export { Accounts, AccountFn, ProgramAccount } from "./account";
|
export { AccountNamespace, AccountFn, ProgramAccount } from "./account";
|
||||||
export { Simulate } from "./simulate";
|
export { SimulateNamespace } from "./simulate";
|
||||||
|
|
||||||
export default class NamespaceFactory {
|
export default class NamespaceFactory {
|
||||||
/**
|
/**
|
||||||
|
@ -30,15 +30,22 @@ export default class NamespaceFactory {
|
||||||
coder: Coder,
|
coder: Coder,
|
||||||
programId: PublicKey,
|
programId: PublicKey,
|
||||||
provider: Provider
|
provider: Provider
|
||||||
): [Rpcs, Ixs, Txs, Accounts, State, Simulate] {
|
): [
|
||||||
|
RpcNamespace,
|
||||||
|
InstructionNamespace,
|
||||||
|
TransactionNamespace,
|
||||||
|
AccountNamespace,
|
||||||
|
StateNamespace,
|
||||||
|
SimulateNamespace
|
||||||
|
] {
|
||||||
const idlErrors = parseIdlErrors(idl);
|
const idlErrors = parseIdlErrors(idl);
|
||||||
|
|
||||||
const rpcs: Rpcs = {};
|
const rpc: RpcNamespace = {};
|
||||||
const ixFns: Ixs = {};
|
const instruction: InstructionNamespace = {};
|
||||||
const txFns: Txs = {};
|
const transaction: TransactionNamespace = {};
|
||||||
const simulateFns: Simulate = {};
|
const simulate: SimulateNamespace = {};
|
||||||
|
|
||||||
const state = StateNamespace.build(
|
const state = StateFactory.build(
|
||||||
idl,
|
idl,
|
||||||
coder,
|
coder,
|
||||||
programId,
|
programId,
|
||||||
|
@ -47,10 +54,10 @@ export default class NamespaceFactory {
|
||||||
);
|
);
|
||||||
|
|
||||||
idl.instructions.forEach((idlIx) => {
|
idl.instructions.forEach((idlIx) => {
|
||||||
const ix = InstructionNamespace.build(idlIx, coder, programId);
|
const ix = InstructionFactory.build(idlIx, coder, programId);
|
||||||
const tx = TransactionNamespace.build(idlIx, ix);
|
const tx = TransactionFactory.build(idlIx, ix);
|
||||||
const rpc = RpcNamespace.build(idlIx, tx, idlErrors, provider);
|
const rpc = RpcFactory.build(idlIx, tx, idlErrors, provider);
|
||||||
const simulate = SimulateNamespace.build(
|
const simulate = SimulateFactory.build(
|
||||||
idlIx,
|
idlIx,
|
||||||
tx,
|
tx,
|
||||||
idlErrors,
|
idlErrors,
|
||||||
|
@ -62,16 +69,16 @@ export default class NamespaceFactory {
|
||||||
|
|
||||||
const name = camelCase(idlIx.name);
|
const name = camelCase(idlIx.name);
|
||||||
|
|
||||||
ixFns[name] = ix;
|
instruction[name] = ix;
|
||||||
txFns[name] = tx;
|
transaction[name] = tx;
|
||||||
rpcs[name] = rpc;
|
rpc[name] = rpc;
|
||||||
simulateFns[name] = simulate;
|
simulate[name] = simulate;
|
||||||
});
|
});
|
||||||
|
|
||||||
const accountFns = idl.accounts
|
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];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,12 +3,12 @@ import { IdlAccount, IdlInstruction, IdlAccountItem } from "../../idl";
|
||||||
import { IdlError } from "../../error";
|
import { IdlError } from "../../error";
|
||||||
import Coder from "../../coder";
|
import Coder from "../../coder";
|
||||||
import { toInstruction, validateAccounts } from "../common";
|
import { toInstruction, validateAccounts } from "../common";
|
||||||
import { RpcAccounts, splitArgsAndCtx } from "../context";
|
import { Accounts, splitArgsAndCtx } from "../context";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dynamically generated instruction namespace.
|
* Dynamically generated instruction namespace.
|
||||||
*/
|
*/
|
||||||
export interface Ixs {
|
export interface InstructionNamespace {
|
||||||
[key: string]: IxFn;
|
[key: string]: IxFn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,10 +17,10 @@ export interface Ixs {
|
||||||
*/
|
*/
|
||||||
export type IxFn = IxProps & ((...args: any[]) => any);
|
export type IxFn = IxProps & ((...args: any[]) => any);
|
||||||
type IxProps = {
|
type IxProps = {
|
||||||
accounts: (ctx: RpcAccounts) => any;
|
accounts: (ctx: Accounts) => any;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default class InstructionNamespace {
|
export default class InstructionNamespaceFactory {
|
||||||
// Builds the instuction namespace.
|
// Builds the instuction namespace.
|
||||||
public static build(
|
public static build(
|
||||||
idlIx: IdlInstruction,
|
idlIx: IdlInstruction,
|
||||||
|
@ -36,7 +36,7 @@ export default class InstructionNamespace {
|
||||||
validateAccounts(idlIx.accounts, ctx.accounts);
|
validateAccounts(idlIx.accounts, ctx.accounts);
|
||||||
validateInstruction(idlIx, ...args);
|
validateInstruction(idlIx, ...args);
|
||||||
|
|
||||||
const keys = InstructionNamespace.accountsArray(
|
const keys = InstructionNamespaceFactory.accountsArray(
|
||||||
ctx.accounts,
|
ctx.accounts,
|
||||||
idlIx.accounts
|
idlIx.accounts
|
||||||
);
|
);
|
||||||
|
@ -59,25 +59,22 @@ export default class InstructionNamespace {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Utility fn for ordering the accounts for this instruction.
|
// Utility fn for ordering the accounts for this instruction.
|
||||||
ix["accounts"] = (accs: RpcAccounts) => {
|
ix["accounts"] = (accs: Accounts) => {
|
||||||
return InstructionNamespace.accountsArray(accs, idlIx.accounts);
|
return InstructionNamespaceFactory.accountsArray(accs, idlIx.accounts);
|
||||||
};
|
};
|
||||||
|
|
||||||
return ix;
|
return ix;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static accountsArray(
|
public static accountsArray(ctx: Accounts, accounts: IdlAccountItem[]): any {
|
||||||
ctx: RpcAccounts,
|
|
||||||
accounts: IdlAccountItem[]
|
|
||||||
): any {
|
|
||||||
return accounts
|
return accounts
|
||||||
.map((acc: IdlAccountItem) => {
|
.map((acc: IdlAccountItem) => {
|
||||||
// Nested accounts.
|
// Nested accounts.
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const nestedAccounts: IdlAccountItem[] | undefined = acc.accounts;
|
const nestedAccounts: IdlAccountItem[] | undefined = acc.accounts;
|
||||||
if (nestedAccounts !== undefined) {
|
if (nestedAccounts !== undefined) {
|
||||||
const rpcAccs = ctx[acc.name] as RpcAccounts;
|
const rpcAccs = ctx[acc.name] as Accounts;
|
||||||
return InstructionNamespace.accountsArray(
|
return InstructionNamespaceFactory.accountsArray(
|
||||||
rpcAccs,
|
rpcAccs,
|
||||||
nestedAccounts
|
nestedAccounts
|
||||||
).flat();
|
).flat();
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { TxFn } from "./transaction";
|
||||||
/**
|
/**
|
||||||
* Dynamically generated rpc namespace.
|
* Dynamically generated rpc namespace.
|
||||||
*/
|
*/
|
||||||
export interface Rpcs {
|
export interface RpcNamespace {
|
||||||
[key: string]: RpcFn;
|
[key: string]: RpcFn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ export interface Rpcs {
|
||||||
*/
|
*/
|
||||||
export type RpcFn = (...args: any[]) => Promise<TransactionSignature>;
|
export type RpcFn = (...args: any[]) => Promise<TransactionSignature>;
|
||||||
|
|
||||||
export default class RpcNamespace {
|
export default class RpcFactory {
|
||||||
// Builds the rpc namespace.
|
// Builds the rpc namespace.
|
||||||
public static build(
|
public static build(
|
||||||
idlIx: IdlInstruction,
|
idlIx: IdlInstruction,
|
||||||
|
|
|
@ -11,7 +11,7 @@ import { Idl } from "../../idl";
|
||||||
/**
|
/**
|
||||||
* Dynamically generated simualte namespace.
|
* Dynamically generated simualte namespace.
|
||||||
*/
|
*/
|
||||||
export interface Simulate {
|
export interface SimulateNamespace {
|
||||||
[key: string]: SimulateFn;
|
[key: string]: SimulateFn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ type SimulateResponse = {
|
||||||
raw: string[];
|
raw: string[];
|
||||||
};
|
};
|
||||||
|
|
||||||
export default class SimulateNamespace {
|
export default class SimulateFactory {
|
||||||
// Builds the rpc namespace.
|
// Builds the rpc namespace.
|
||||||
public static build(
|
public static build(
|
||||||
idlIx: IdlInstruction,
|
idlIx: IdlInstruction,
|
||||||
|
|
|
@ -11,27 +11,27 @@ import {
|
||||||
import Provider from "../../provider";
|
import Provider from "../../provider";
|
||||||
import { Idl, IdlStateMethod } from "../../idl";
|
import { Idl, IdlStateMethod } from "../../idl";
|
||||||
import Coder, { stateDiscriminator } from "../../coder";
|
import Coder, { stateDiscriminator } from "../../coder";
|
||||||
import { Rpcs, Ixs } from "./";
|
import { RpcNamespace, InstructionNamespace } from "./";
|
||||||
import {
|
import {
|
||||||
Subscription,
|
Subscription,
|
||||||
translateError,
|
translateError,
|
||||||
toInstruction,
|
toInstruction,
|
||||||
validateAccounts,
|
validateAccounts,
|
||||||
} from "../common";
|
} from "../common";
|
||||||
import { RpcAccounts, splitArgsAndCtx } from "../context";
|
import { Accounts, splitArgsAndCtx } from "../context";
|
||||||
import InstructionNamespace from "./instruction";
|
import InstructionNamespaceFactory from "./instruction";
|
||||||
|
|
||||||
export type State = () =>
|
export type StateNamespace = () =>
|
||||||
| Promise<any>
|
| Promise<any>
|
||||||
| {
|
| {
|
||||||
address: () => Promise<PublicKey>;
|
address: () => Promise<PublicKey>;
|
||||||
rpc: Rpcs;
|
rpc: RpcNamespace;
|
||||||
instruction: Ixs;
|
instruction: InstructionNamespace;
|
||||||
subscribe: (address: PublicKey, commitment?: Commitment) => EventEmitter;
|
subscribe: (address: PublicKey, commitment?: Commitment) => EventEmitter;
|
||||||
unsubscribe: (address: PublicKey) => void;
|
unsubscribe: (address: PublicKey) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default class StateNamespace {
|
export default class StateFactory {
|
||||||
// Builds the state namespace.
|
// Builds the state namespace.
|
||||||
public static build(
|
public static build(
|
||||||
idl: Idl,
|
idl: Idl,
|
||||||
|
@ -39,7 +39,7 @@ export default class StateNamespace {
|
||||||
programId: PublicKey,
|
programId: PublicKey,
|
||||||
idlErrors: Map<number, string>,
|
idlErrors: Map<number, string>,
|
||||||
provider: Provider
|
provider: Provider
|
||||||
): State | undefined {
|
): StateNamespace | undefined {
|
||||||
if (idl.state === undefined) {
|
if (idl.state === undefined) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
@ -62,11 +62,11 @@ export default class StateNamespace {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Namespace with all rpc functions.
|
// Namespace with all rpc functions.
|
||||||
const rpc: Rpcs = {};
|
const rpc: RpcNamespace = {};
|
||||||
const ix: Ixs = {};
|
const ix: InstructionNamespace = {};
|
||||||
|
|
||||||
idl.state.methods.forEach((m: IdlStateMethod) => {
|
idl.state.methods.forEach((m: IdlStateMethod) => {
|
||||||
const accounts = async (accounts: RpcAccounts): Promise<any> => {
|
const accounts = async (accounts: Accounts): Promise<any> => {
|
||||||
const keys = await stateInstructionKeys(
|
const keys = await stateInstructionKeys(
|
||||||
programId,
|
programId,
|
||||||
provider,
|
provider,
|
||||||
|
@ -74,7 +74,7 @@ export default class StateNamespace {
|
||||||
accounts
|
accounts
|
||||||
);
|
);
|
||||||
return keys.concat(
|
return keys.concat(
|
||||||
InstructionNamespace.accountsArray(accounts, m.accounts)
|
InstructionNamespaceFactory.accountsArray(accounts, m.accounts)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
const ixFn = async (...args: any[]): Promise<TransactionInstruction> => {
|
const ixFn = async (...args: any[]): Promise<TransactionInstruction> => {
|
||||||
|
@ -177,7 +177,7 @@ async function stateInstructionKeys(
|
||||||
programId: PublicKey,
|
programId: PublicKey,
|
||||||
provider: Provider,
|
provider: Provider,
|
||||||
m: IdlStateMethod,
|
m: IdlStateMethod,
|
||||||
accounts: RpcAccounts
|
accounts: Accounts
|
||||||
) {
|
) {
|
||||||
if (m.name === "new") {
|
if (m.name === "new") {
|
||||||
// Ctor `new` method.
|
// Ctor `new` method.
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { IxFn } from "./instruction";
|
||||||
/**
|
/**
|
||||||
* Dynamically generated transaction namespace.
|
* Dynamically generated transaction namespace.
|
||||||
*/
|
*/
|
||||||
export interface Txs {
|
export interface TransactionNamespace {
|
||||||
[key: string]: TxFn;
|
[key: string]: TxFn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ export interface Txs {
|
||||||
*/
|
*/
|
||||||
export type TxFn = (...args: any[]) => Transaction;
|
export type TxFn = (...args: any[]) => Transaction;
|
||||||
|
|
||||||
export default class TransactionNamespace {
|
export default class TransactionFactory {
|
||||||
// Builds the transaction namespace.
|
// Builds the transaction namespace.
|
||||||
public static build(idlIx: IdlInstruction, ixFn: IxFn): TxFn {
|
public static build(idlIx: IdlInstruction, ixFn: IxFn): TxFn {
|
||||||
const txFn = (...args: any[]): Transaction => {
|
const txFn = (...args: any[]): Transaction => {
|
||||||
|
|
|
@ -11,7 +11,16 @@ import {
|
||||||
Commitment,
|
Commitment,
|
||||||
} from "@solana/web3.js";
|
} from "@solana/web3.js";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The network and wallet context used to send transactions paid for and signed
|
||||||
|
* by the provider.
|
||||||
|
*/
|
||||||
export default class 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(
|
constructor(
|
||||||
readonly connection: Connection,
|
readonly connection: Connection,
|
||||||
readonly wallet: Wallet,
|
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 {
|
static local(url?: string, opts?: ConfirmOptions): Provider {
|
||||||
opts = opts || Provider.defaultOptions();
|
opts = opts || Provider.defaultOptions();
|
||||||
const connection = new Connection(
|
const connection = new Connection(
|
||||||
|
@ -36,7 +52,12 @@ export default class Provider {
|
||||||
return new Provider(connection, wallet, opts);
|
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 {
|
static env(): Provider {
|
||||||
const process = require("process");
|
const process = require("process");
|
||||||
const url = process.env.ANCHOR_PROVIDER_URL;
|
const url = process.env.ANCHOR_PROVIDER_URL;
|
||||||
|
@ -50,6 +71,14 @@ export default class Provider {
|
||||||
return new Provider(connection, wallet, options);
|
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(
|
async send(
|
||||||
tx: Transaction,
|
tx: Transaction,
|
||||||
signers?: Array<Account | undefined>,
|
signers?: Array<Account | undefined>,
|
||||||
|
@ -88,6 +117,9 @@ export default class Provider {
|
||||||
return txId;
|
return txId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Similar to `send`, but for an array of transactions and signers.
|
||||||
|
*/
|
||||||
async sendAll(
|
async sendAll(
|
||||||
reqs: Array<SendTxRequest>,
|
reqs: Array<SendTxRequest>,
|
||||||
opts?: ConfirmOptions
|
opts?: ConfirmOptions
|
||||||
|
@ -138,6 +170,14 @@ export default class Provider {
|
||||||
return sigs;
|
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(
|
async simulate(
|
||||||
tx: Transaction,
|
tx: Transaction,
|
||||||
signers?: Array<Account | undefined>,
|
signers?: Array<Account | undefined>,
|
||||||
|
@ -173,12 +213,18 @@ export type SendTxRequest = {
|
||||||
signers: Array<Account | undefined>;
|
signers: Array<Account | undefined>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wallet interface for objects that can be used to sign provider transactions.
|
||||||
|
*/
|
||||||
export interface Wallet {
|
export interface Wallet {
|
||||||
signTransaction(tx: Transaction): Promise<Transaction>;
|
signTransaction(tx: Transaction): Promise<Transaction>;
|
||||||
signAllTransactions(txs: Transaction[]): Promise<Transaction[]>;
|
signAllTransactions(txs: Transaction[]): Promise<Transaction[]>;
|
||||||
publicKey: PublicKey;
|
publicKey: PublicKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Node only wallet.
|
||||||
|
*/
|
||||||
export class NodeWallet implements Wallet {
|
export class NodeWallet implements Wallet {
|
||||||
constructor(readonly payer: Account) {}
|
constructor(readonly payer: Account) {}
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,14 @@ import { Program } from "./program";
|
||||||
|
|
||||||
let _populatedWorkspace = false;
|
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) {
|
get(workspaceCache: { [key: string]: Program }, programName: string) {
|
||||||
const find = require("find");
|
const find = require("find");
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
|
@ -51,3 +57,5 @@ export default new Proxy({} as any, {
|
||||||
return workspaceCache[programName];
|
return workspaceCache[programName];
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export default workspace;
|
||||||
|
|
139
ts/yarn.lock
139
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"
|
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
|
||||||
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
|
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:
|
combined-stream@^1.0.6, combined-stream@~1.0.6:
|
||||||
version "1.0.8"
|
version "1.0.8"
|
||||||
resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f"
|
resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f"
|
||||||
|
@ -2297,7 +2302,7 @@ fragment-cache@^0.2.1:
|
||||||
dependencies:
|
dependencies:
|
||||||
map-cache "^0.2.2"
|
map-cache "^0.2.2"
|
||||||
|
|
||||||
fs-extra@^9.0.0:
|
fs-extra@^9.0.0, fs-extra@^9.1.0:
|
||||||
version "9.1.0"
|
version "9.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d"
|
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d"
|
||||||
integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==
|
integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==
|
||||||
|
@ -2406,6 +2411,18 @@ glob-parent@^5.0.0, glob-parent@^5.1.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
is-glob "^4.0.1"
|
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:
|
glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4:
|
||||||
version "7.1.6"
|
version "7.1.6"
|
||||||
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6"
|
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"
|
resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081"
|
||||||
integrity sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE=
|
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:
|
har-schema@^2.0.0:
|
||||||
version "2.0.0"
|
version "2.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92"
|
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"
|
resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c"
|
||||||
integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==
|
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:
|
ip-regex@^2.1.0:
|
||||||
version "2.1.0"
|
version "2.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/ip-regex/-/ip-regex-2.1.0.tgz#fa78bf5d2e6913c911ce9f819ee5146bb6d844e9"
|
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"
|
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52"
|
||||||
integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==
|
integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==
|
||||||
|
|
||||||
lodash@^4.17.20:
|
lodash@^4.17.20, lodash@^4.17.21:
|
||||||
version "4.17.21"
|
version "4.17.21"
|
||||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
|
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
|
||||||
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
|
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
|
||||||
|
@ -3647,6 +3681,13 @@ lower-case@^2.0.2:
|
||||||
dependencies:
|
dependencies:
|
||||||
tslib "^2.0.3"
|
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:
|
lru-cache@^6.0.0:
|
||||||
version "6.0.0"
|
version "6.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94"
|
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94"
|
||||||
|
@ -3654,6 +3695,11 @@ lru-cache@^6.0.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
yallist "^4.0.0"
|
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:
|
make-dir@^3.0.0:
|
||||||
version "3.1.0"
|
version "3.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f"
|
resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-3.1.0.tgz#415e967046b3a7f1d185277d84aa58203726a13f"
|
||||||
|
@ -3695,6 +3741,11 @@ map-visit@^1.0.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
object-visit "^1.0.0"
|
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:
|
meow@^8.0.0:
|
||||||
version "8.1.0"
|
version "8.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/meow/-/meow-8.1.0.tgz#0fcaa267e35e4d58584b8205923df6021ddcc7ba"
|
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"
|
resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a"
|
||||||
integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=
|
integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=
|
||||||
|
|
||||||
minimatch@^3.0.4:
|
minimatch@^3.0.0, minimatch@^3.0.4:
|
||||||
version "3.0.4"
|
version "3.0.4"
|
||||||
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
|
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
|
||||||
integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==
|
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"
|
resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7"
|
||||||
integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=
|
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:
|
nice-try@^1.0.4:
|
||||||
version "1.0.5"
|
version "1.0.5"
|
||||||
resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366"
|
resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366"
|
||||||
|
@ -3990,6 +4046,13 @@ onetime@^5.1.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
mimic-fn "^2.1.0"
|
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:
|
opencollective-postinstall@^2.0.2:
|
||||||
version "2.0.3"
|
version "2.0.3"
|
||||||
resolved "https://registry.yarnpkg.com/opencollective-postinstall/-/opencollective-postinstall-2.0.3.tgz#7a0fff978f6dbfa4d006238fbac98ed4198c3259"
|
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"
|
resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2"
|
||||||
integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==
|
integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==
|
||||||
|
|
||||||
progress@^2.0.0:
|
progress@^2.0.0, progress@^2.0.3:
|
||||||
version "2.0.3"
|
version "2.0.3"
|
||||||
resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8"
|
resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8"
|
||||||
integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==
|
integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==
|
||||||
|
@ -4289,6 +4352,13 @@ readable-stream@~2.3.6:
|
||||||
string_decoder "~1.1.1"
|
string_decoder "~1.1.1"
|
||||||
util-deprecate "~1.0.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:
|
redent@^3.0.0:
|
||||||
version "3.0.0"
|
version "3.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/redent/-/redent-3.0.0.tgz#e557b7998316bb53c9f1f56fa626352c6963059f"
|
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"
|
resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a"
|
||||||
integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=
|
integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=
|
||||||
|
|
||||||
resolve@^1.10.0:
|
resolve@^1.1.6, resolve@^1.10.0:
|
||||||
version "1.20.0"
|
version "1.20.0"
|
||||||
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.20.0.tgz#629a013fb3f70755d6f0b7935cc1c2c5378b1975"
|
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.20.0.tgz#629a013fb3f70755d6f0b7935cc1c2c5378b1975"
|
||||||
integrity sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==
|
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"
|
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172"
|
||||||
integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==
|
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:
|
shellwords@^0.1.1:
|
||||||
version "0.1.1"
|
version "0.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b"
|
resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b"
|
||||||
integrity sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==
|
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:
|
signal-exit@^3.0.0, signal-exit@^3.0.2:
|
||||||
version "3.0.3"
|
version "3.0.3"
|
||||||
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c"
|
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:
|
dependencies:
|
||||||
is-typedarray "^1.0.0"
|
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:
|
typescript@^4.0.5:
|
||||||
version "4.1.3"
|
version "4.1.3"
|
||||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.3.tgz#519d582bd94cba0cf8934c7d8e8467e473f53bb7"
|
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.1.3.tgz#519d582bd94cba0cf8934c7d8e8467e473f53bb7"
|
||||||
integrity sha512-B3ZIOf1IKeH2ixgHhj6la6xdwR9QrLC5d1VKeCSY4tvkqhF2eqd9O7txNlS0PO3GrBAFIdr3L1ndNwteUbZLYg==
|
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:
|
union-value@^1.0.0:
|
||||||
version "1.0.1"
|
version "1.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.1.tgz#0b6fe7b835aecda61c6ea4d4f02c14221e109847"
|
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"
|
core-util-is "1.0.2"
|
||||||
extsprintf "^1.2.0"
|
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:
|
w3c-hr-time@^1.0.2:
|
||||||
version "1.0.2"
|
version "1.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz#0a89cdf5cc15822df9c360543676963e0cc308cd"
|
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"
|
resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c"
|
||||||
integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==
|
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:
|
wrap-ansi@^6.2.0:
|
||||||
version "6.2.0"
|
version "6.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53"
|
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"
|
resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.1.tgz#8db2b83c31c5d75099bb890b23f3094891e247d4"
|
||||||
integrity sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ==
|
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:
|
yallist@^4.0.0:
|
||||||
version "4.0.0"
|
version "4.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72"
|
resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72"
|
||||||
|
|
Loading…
Reference in New Issue