repo_id
stringclasses 279
values | file_path
stringlengths 43
179
| content
stringlengths 1
4.18M
| __index_level_0__
int64 0
0
|
|---|---|---|---|
solana_public_repos/orca-so/whirlpools/legacy-sdk/whirlpool/src
|
solana_public_repos/orca-so/whirlpools/legacy-sdk/whirlpool/src/router/batch-swap-quote.ts
|
import type { Address } from "@coral-xyz/anchor";
import { AddressUtil } from "@orca-so/common-sdk";
import type BN from "bn.js";
import invariant from "tiny-invariant";
import type {
WhirlpoolAccountFetcherInterface,
WhirlpoolAccountFetchOptions,
} from "../network/public/fetcher";
import type { SwapQuoteParam } from "../quotes/public";
import { PoolUtil, SwapDirection, SwapUtils } from "../utils/public";
import { NO_TOKEN_EXTENSION_CONTEXT } from "../utils/public/token-extension-util";
export interface SwapQuoteRequest {
whirlpool: Address;
tradeTokenMint: Address;
tokenAmount: BN;
amountSpecifiedIsInput: boolean;
}
export async function batchBuildSwapQuoteParams(
quoteRequests: SwapQuoteRequest[],
programId: Address,
fetcher: WhirlpoolAccountFetcherInterface,
opts?: WhirlpoolAccountFetchOptions,
): Promise<SwapQuoteParam[]> {
const whirlpools = await fetcher.getPools(
quoteRequests.map((req) => req.whirlpool),
opts,
);
const program = AddressUtil.toPubKey(programId);
const tickArrayRequests = quoteRequests.map((quoteReq) => {
const { whirlpool, tokenAmount, tradeTokenMint, amountSpecifiedIsInput } =
quoteReq;
const whirlpoolData = whirlpools.get(AddressUtil.toString(whirlpool))!;
const swapMintKey = AddressUtil.toPubKey(tradeTokenMint);
const swapTokenType = PoolUtil.getTokenType(whirlpoolData, swapMintKey);
invariant(
!!swapTokenType,
"swapTokenMint does not match any tokens on this pool",
);
const aToB =
SwapUtils.getSwapDirection(
whirlpoolData,
swapMintKey,
amountSpecifiedIsInput,
) === SwapDirection.AtoB;
return {
whirlpoolData,
tokenAmount,
aToB,
tickCurrentIndex: whirlpoolData.tickCurrentIndex,
tickSpacing: whirlpoolData.tickSpacing,
whirlpoolAddress: AddressUtil.toPubKey(whirlpool),
amountSpecifiedIsInput,
};
});
const tickArrays = await SwapUtils.getBatchTickArrays(
program,
fetcher,
tickArrayRequests,
opts,
);
return tickArrayRequests.map((req, index) => {
const { whirlpoolData, tokenAmount, aToB, amountSpecifiedIsInput } = req;
return {
whirlpoolData,
tokenAmount,
aToB,
amountSpecifiedIsInput,
sqrtPriceLimit: SwapUtils.getDefaultSqrtPriceLimit(aToB),
otherAmountThreshold: SwapUtils.getDefaultOtherAmountThreshold(
amountSpecifiedIsInput,
),
tickArrays: tickArrays[index],
tokenExtensionCtx: NO_TOKEN_EXTENSION_CONTEXT, // WhirlpoolRouter does not support token extensions
};
});
}
| 0
|
solana_public_repos/orca-so/whirlpools/legacy-sdk/whirlpool/src
|
solana_public_repos/orca-so/whirlpools/legacy-sdk/whirlpool/src/router/quote-map.ts
|
import type { Address } from "@coral-xyz/anchor";
import { AddressUtil, Percentage } from "@orca-so/common-sdk";
import type { PublicKey } from "@solana/web3.js";
import BN from "bn.js";
import type { SwapErrorCode, WhirlpoolsError } from "../errors/errors";
import type { WhirlpoolAccountFetcherInterface } from "../network/public/fetcher";
import { PREFER_CACHE } from "../network/public/fetcher";
import type { SwapQuoteParam } from "../quotes/public";
import { swapQuoteWithParams } from "../quotes/public";
import type { Path } from "../utils/public";
import { PoolUtil } from "../utils/public";
import type { SwapQuoteRequest } from "./batch-swap-quote";
import { batchBuildSwapQuoteParams } from "./batch-swap-quote";
import type { RoutingOptions, Trade, TradeHop } from "./public";
// Key between <splitPercent, array of quotes with successful hop quotes>
export type SanitizedQuoteMap = Record<number, PathQuote[]>;
// A trade quote on trading on a path between user input tokenIn -> tokenOut
export type PathQuote = {
path: Path;
edgesPoolAddrs: string[];
splitPercent: number;
amountIn: BN;
amountOut: BN;
calculatedEdgeQuotes: TradeHopQuoteSuccess[];
};
export async function getQuoteMap(
trade: Trade,
paths: Path[],
amountSpecifiedIsInput: boolean,
programId: PublicKey,
fetcher: WhirlpoolAccountFetcherInterface,
opts: RoutingOptions,
) {
const { percentIncrement, numTopPartialQuotes } = opts;
const { tokenIn, tokenOut, tradeAmount } = trade;
const { percents, amounts } = getSplitPercentageAmts(
tradeAmount,
percentIncrement,
);
// The max route length is the number of iterations of quoting that we need to do
const maxRouteLength = Math.max(...paths.map((path) => path.edges.length), 0);
// For hop 0 of all routes, get swap quotes using [inputAmount, inputTokenMint]
// For hop 1..n of all routes, get swap quotes using [outputAmount, outputTokenMint] of hop n-1 as input
const quoteMap: InternalQuoteMap = {};
let iteration = Array.from(Array(maxRouteLength).keys());
if (!amountSpecifiedIsInput) {
iteration = iteration.reverse();
}
try {
for (const hop of iteration) {
// Each batch of quotes needs to be iterative
const quoteUpdates = buildQuoteUpdateRequests(
tokenIn,
tokenOut,
paths,
percents,
amounts,
hop,
amountSpecifiedIsInput,
quoteMap,
);
const quoteParams = await batchBuildSwapQuoteParams(
quoteUpdates.map((update) => update.request),
AddressUtil.toPubKey(programId),
fetcher,
PREFER_CACHE,
);
populateQuoteMap(quoteUpdates, quoteParams, quoteMap);
}
} catch (e) {
throw e;
}
return sanitizeQuoteMap(
quoteMap,
numTopPartialQuotes,
amountSpecifiedIsInput,
);
}
// Key between <splitPercent, array of quotes of pre-sanitized calculated-hops>
type InternalQuoteMap = Record<
number,
Array<
Pick<
InternalPathQuote,
"path" | "edgesPoolAddrs" | "splitPercent" | "calculatedEdgeQuotes"
>
>
>;
type InternalPathQuote = Omit<PathQuote, "calculatedEdgeQuotes"> & {
calculatedEdgeQuotes: (TradeHopQuoteResult | undefined)[];
};
type TradeHopQuoteResult = TradeHopQuoteSuccess | TradeHopQuoteError;
type TradeHopQuoteSuccess = TradeHop & { success: true };
type TradeHopQuoteError = {
success: false;
error: SwapErrorCode;
};
function populateQuoteMap(
quoteUpdates: ReturnType<typeof buildQuoteUpdateRequests>,
quoteParams: SwapQuoteParam[],
quoteMap: InternalQuoteMap,
) {
for (const {
splitPercent,
pathIndex,
quoteIndex,
edgeIndex,
request,
} of quoteUpdates) {
const swapParam = quoteParams[quoteIndex];
const path = quoteMap[splitPercent][pathIndex];
try {
const quote = swapQuoteWithParams(
swapParam,
Percentage.fromFraction(0, 1000),
);
const { whirlpoolData, tokenAmount, aToB, amountSpecifiedIsInput } =
swapParam;
const [mintA, mintB, vaultA, vaultB] = [
whirlpoolData.tokenMintA.toBase58(),
whirlpoolData.tokenMintB.toBase58(),
whirlpoolData.tokenVaultA.toBase58(),
whirlpoolData.tokenVaultB.toBase58(),
];
const [inputMint, outputMint] = aToB ? [mintA, mintB] : [mintB, mintA];
path.calculatedEdgeQuotes[edgeIndex] = {
success: true,
amountIn: amountSpecifiedIsInput
? tokenAmount
: quote.estimatedAmountIn,
amountOut: amountSpecifiedIsInput
? quote.estimatedAmountOut
: tokenAmount,
whirlpool: request.whirlpool,
inputMint,
outputMint,
mintA,
mintB,
vaultA,
vaultB,
quote,
snapshot: {
aToB: swapParam.aToB,
sqrtPrice: whirlpoolData.sqrtPrice,
feeRate: PoolUtil.getFeeRate(whirlpoolData.feeRate),
},
};
} catch (e) {
const errorCode = (e as WhirlpoolsError).errorCode as SwapErrorCode;
path.calculatedEdgeQuotes[edgeIndex] = {
success: false,
error: errorCode,
};
continue;
}
}
}
/**
* A list of quote requests to be queried in a batch.
*
* @param quoteIndex The index for this quote in the QuoteRequest array
* @param pathIndex The index of the trade paths this request is evaluating
* @param edgeIndex The index of the edge for the evaluated path
* @param splitPercent The percent of the total amount to be swapped
* @param poolAddress The account address of the pool this edge is evaluating
*
*/
type QuoteRequest = {
quoteIndex: number;
pathIndex: number;
edgeIndex: number;
splitPercent: number;
request: SwapQuoteRequest;
};
function buildQuoteUpdateRequests(
tokenIn: Address,
tokenOut: Address,
paths: Path[],
percents: number[],
amounts: BN[],
hop: number,
amountSpecifiedIsInput: boolean,
quoteMap: InternalQuoteMap,
): QuoteRequest[] {
// Each batch of quotes needs to be iterative
const quoteUpdates: QuoteRequest[] = [];
for (let amountIndex = 0; amountIndex < amounts.length; amountIndex++) {
const percent = percents[amountIndex];
const tradeAmount = amounts[amountIndex];
// Initialize quote map for first hop
if (!quoteMap[percent]) {
quoteMap[percent] = Array(paths.length);
}
// Iterate over all routes
for (let pathIndex = 0; pathIndex < paths.length; pathIndex++) {
const path = paths[pathIndex];
const edges = path.edges;
// If the current route is already complete (amountSpecifiedIsInput = true) or if the current hop is beyond
// this route's length (amountSpecifiedIsInput = false), don't do anything
if (
amountSpecifiedIsInput ? edges.length <= hop : hop > edges.length - 1
) {
continue;
}
const startingRouteEval = amountSpecifiedIsInput
? hop === 0
: hop === edges.length - 1;
const poolsPath = AddressUtil.toStrings(
edges.map((edge) => edge.poolAddress),
);
// If this is the first hop of the route, initialize the quote map
if (startingRouteEval) {
quoteMap[percent][pathIndex] = {
path: path,
splitPercent: percent,
edgesPoolAddrs: poolsPath,
calculatedEdgeQuotes: Array(edges.length),
};
}
const currentQuote = quoteMap[percent][pathIndex];
const poolAddr = poolsPath[hop];
const lastHop = amountSpecifiedIsInput
? currentQuote.calculatedEdgeQuotes[hop - 1]
: currentQuote.calculatedEdgeQuotes[hop + 1];
// If this is the first hop, use the input mint and amount, otherwise use the output of the last hop
let tokenAmount: BN;
let tradeToken: Address;
if (startingRouteEval) {
tokenAmount = tradeAmount;
tradeToken = amountSpecifiedIsInput ? tokenIn : tokenOut;
} else {
if (!lastHop?.success) {
continue;
}
tokenAmount = amountSpecifiedIsInput
? lastHop.amountOut
: lastHop.amountIn;
tradeToken = amountSpecifiedIsInput
? lastHop.outputMint
: lastHop.inputMint;
}
quoteUpdates.push({
splitPercent: percent,
pathIndex,
edgeIndex: hop,
quoteIndex: quoteUpdates.length,
request: {
whirlpool: poolAddr,
tradeTokenMint: tradeToken,
tokenAmount,
amountSpecifiedIsInput,
},
});
}
}
return quoteUpdates;
}
/**
* Annotate amountIn/amountOut for calculations
* @param tradeAmount
* @param quoteMap
* @returns
*/
function sanitizeQuoteMap(
quoteMap: InternalQuoteMap,
pruneN: number,
amountSpecifiedIsInput: boolean,
): readonly [SanitizedQuoteMap, Set<SwapErrorCode>] {
const percents = Object.keys(quoteMap).map((percent) => Number(percent));
const cleanedQuoteMap: SanitizedQuoteMap = {};
const failureErrors: Set<SwapErrorCode> = new Set();
for (let i = 0; i < percents.length; i++) {
const percent = percents[i];
const uncleanedQuotes = quoteMap[percent];
cleanedQuoteMap[percent] = [];
for (const {
edgesPoolAddrs: hopPoolAddrs,
calculatedEdgeQuotes: calculatedHops,
path,
} of uncleanedQuotes) {
// If the route was successful at each step, add it to the clean quote stack
const filteredCalculatedEdges = calculatedHops.flatMap((val) =>
!!val && val.success ? val : [],
);
if (filteredCalculatedEdges.length === hopPoolAddrs.length) {
const [input, output] = [
filteredCalculatedEdges[0].amountIn,
filteredCalculatedEdges[filteredCalculatedEdges.length - 1].amountOut,
];
cleanedQuoteMap[percent].push({
path,
splitPercent: percent,
edgesPoolAddrs: hopPoolAddrs,
amountIn: input,
amountOut: output,
calculatedEdgeQuotes: filteredCalculatedEdges,
});
continue;
}
// If a route failed, there would only be one failure
const quoteFailures = calculatedHops.flatMap((f) =>
f && !f?.success ? f : [],
);
failureErrors.add(quoteFailures[0].error);
}
}
// Prune the quote map to only include the top N quotes
const prunedQuoteMap: SanitizedQuoteMap = {};
const sortFn = amountSpecifiedIsInput
? (a: PathQuote, b: PathQuote) => b.amountOut.cmp(a.amountOut)
: (a: PathQuote, b: PathQuote) => a.amountIn.cmp(b.amountIn);
for (let i = 0; i < percents.length; i++) {
const sortedQuotes = cleanedQuoteMap[percents[i]].sort(sortFn);
const slicedSorted = sortedQuotes.slice(0, pruneN);
prunedQuoteMap[percents[i]] = slicedSorted;
}
return [prunedQuoteMap, failureErrors] as const;
}
function getSplitPercentageAmts(inputAmount: BN, minPercent: number = 5) {
const percents = [];
const amounts = [];
for (let i = 1; i <= 100 / minPercent; i++) {
percents.push(i * minPercent);
amounts.push(inputAmount.mul(new BN(i * minPercent)).div(new BN(100)));
}
return { percents, amounts };
}
| 0
|
solana_public_repos/orca-so/whirlpools/legacy-sdk/whirlpool/src
|
solana_public_repos/orca-so/whirlpools/legacy-sdk/whirlpool/src/router/router-impl.ts
|
import type { Address } from "@coral-xyz/anchor";
import type { Percentage, TransactionBuilder } from "@orca-so/common-sdk";
import { AddressUtil } from "@orca-so/common-sdk";
import type { Account } from "@solana/spl-token";
import type { WhirlpoolContext } from "..";
import {
RouteQueryErrorCode,
SwapErrorCode,
WhirlpoolsError,
} from "../errors/errors";
import { getSwapFromRoute } from "../instructions/composites/swap-with-route";
import type {
WhirlpoolAccountFetchOptions,
WhirlpoolAccountFetcherInterface,
} from "../network/public/fetcher";
import { IGNORE_CACHE, PREFER_CACHE } from "../network/public/fetcher";
import type { Path, PoolGraph } from "../utils/public";
import { SwapUtils } from "../utils/public";
import { getBestRoutesFromQuoteMap } from "./convert-quote-map";
import type {
ExecutableRoute,
RouteSelectOptions,
RoutingOptions,
Trade,
TradeRoute,
WhirlpoolRouter,
} from "./public";
import { RouterUtils } from "./public";
import { getQuoteMap } from "./quote-map";
export class WhirlpoolRouterImpl implements WhirlpoolRouter {
constructor(
readonly ctx: WhirlpoolContext,
readonly poolGraph: PoolGraph,
) {}
async findAllRoutes(
trade: Trade,
opts?: Partial<RoutingOptions>,
fetchOpts?: WhirlpoolAccountFetchOptions,
): Promise<TradeRoute[]> {
const { tokenIn, tokenOut, tradeAmount, amountSpecifiedIsInput } = trade;
const paths = this.poolGraph.getPath(tokenIn, tokenOut);
if (paths.length === 0) {
return Promise.reject(
new WhirlpoolsError(
`Could not find route for ${tokenIn} -> ${tokenOut}`,
RouteQueryErrorCode.RouteDoesNotExist,
),
);
}
if (tradeAmount.isZero()) {
return Promise.reject(
new WhirlpoolsError(
`findBestRoutes error - input amount is zero.`,
RouteQueryErrorCode.ZeroInputAmount,
),
);
}
const routingOptions = { ...RouterUtils.getDefaultRouteOptions(), ...opts };
const { program, fetcher } = this.ctx;
const programId = program.programId;
await prefetchRoutes(paths, programId, fetcher, fetchOpts);
try {
const [quoteMap, failures] = await getQuoteMap(
trade,
paths,
amountSpecifiedIsInput,
programId,
fetcher,
routingOptions,
);
const bestRoutes = getBestRoutesFromQuoteMap(
quoteMap,
amountSpecifiedIsInput,
routingOptions,
);
// TODO: Rudementary implementation to determine error. Find a better solution
if (bestRoutes.length === 0) {
// TODO: TRADE_AMOUNT_TOO_HIGH actually corresponds to TickArrayCrossingAboveMax. Fix swap quote.
if (failures.has(SwapErrorCode.TickArraySequenceInvalid)) {
return Promise.reject(
new WhirlpoolsError(
`All swap quote generation failed on amount too high.`,
RouteQueryErrorCode.TradeAmountTooHigh,
),
);
}
}
return bestRoutes;
} catch (e) {
return Promise.reject(
new WhirlpoolsError(
`Stack error received on quote generation.`,
RouteQueryErrorCode.General,
e instanceof Error ? e.stack : "",
),
);
}
}
async findBestRoute(
trade: Trade,
routingOpts?: Partial<RoutingOptions>,
selectionOpts?: Partial<RouteSelectOptions>,
fetchOpts?: WhirlpoolAccountFetchOptions,
): Promise<ExecutableRoute | null> {
const allRoutes = await this.findAllRoutes(trade, routingOpts, fetchOpts);
const selectOpts = {
...RouterUtils.getDefaultSelectOptions(),
...selectionOpts,
};
return await RouterUtils.selectFirstExecutableRoute(
this.ctx,
allRoutes,
selectOpts,
);
}
async swap(
trade: TradeRoute,
slippage: Percentage,
resolvedAtas: Account[] | null,
): Promise<TransactionBuilder> {
const txBuilder = await getSwapFromRoute(
this.ctx,
{
route: trade,
slippage,
resolvedAtaAccounts: resolvedAtas,
wallet: this.ctx.wallet.publicKey,
},
IGNORE_CACHE,
);
return txBuilder;
}
}
// Load all pool and tick-array data into the fetcher cache.
async function prefetchRoutes(
paths: Path[],
programId: Address,
fetcher: WhirlpoolAccountFetcherInterface,
opts: WhirlpoolAccountFetchOptions = PREFER_CACHE,
): Promise<void> {
const poolSet = new Set<string>();
for (let i = 0; i < paths.length; i++) {
const path = paths[i];
for (let j = 0; j < path.edges.length; j++) {
poolSet.add(AddressUtil.toString(path.edges[j].poolAddress));
}
}
const ps = Array.from(poolSet);
const allWps = await fetcher.getPools(ps, opts);
const tickArrayAddresses = [];
for (const [key, wp] of allWps) {
if (wp == null) {
continue;
}
const addr1 = SwapUtils.getTickArrayPublicKeys(
wp.tickCurrentIndex,
wp.tickSpacing,
true,
AddressUtil.toPubKey(programId),
AddressUtil.toPubKey(key),
);
const addr2 = SwapUtils.getTickArrayPublicKeys(
wp.tickCurrentIndex,
wp.tickSpacing,
false,
AddressUtil.toPubKey(programId),
AddressUtil.toPubKey(key),
);
const allAddrs = [...addr1, ...addr2].map((k) => k.toBase58());
const unique = Array.from(new Set(allAddrs));
tickArrayAddresses.push(...unique);
}
await fetcher.getTickArrays(tickArrayAddresses, opts);
}
| 0
|
solana_public_repos/orca-so/whirlpools/legacy-sdk/whirlpool/src/router
|
solana_public_repos/orca-so/whirlpools/legacy-sdk/whirlpool/src/router/public/index.ts
|
import type { Address } from "@coral-xyz/anchor";
import type { Percentage, TransactionBuilder } from "@orca-so/common-sdk";
import type { AddressLookupTableAccount } from "@solana/web3.js";
import type BN from "bn.js";
import type { WhirlpoolAccountFetchOptions } from "../../network/public/fetcher";
import type { SwapQuote } from "../../quotes/public";
import type { Path } from "../../utils/public";
import type { AtaAccountInfo, RouteSelectOptions } from "./router-utils";
export * from "./router-builder";
export * from "./router-utils";
/**
* A Trade type that represents a trade between two tokens
*
* @category Router
* @param tokenIn The token that is being traded in
* @param tokenOut The token that is being traded out
* @param tradeAmount The amount of token being traded in or out
* @param amountSpecifiedIsInput Whether the trade amount is the amount being traded in or out
*/
export type Trade = {
tokenIn: Address;
tokenOut: Address;
tradeAmount: BN;
amountSpecifiedIsInput: boolean;
};
/**
* Options to configure the router.
*
* @category Router
* @param percentIncrement The percent increment to use when splitting a trade into multiple trades.
* @param numTopRoutes The number of top routes to return from the router.
* @param numTopPartialQuotes The number of top partial quotes to return from the router.
* @param maxSplits The maximum number of splits to perform on a trade.
*/
export type RoutingOptions = {
percentIncrement: number;
numTopRoutes: number;
numTopPartialQuotes: number;
maxSplits: number;
};
/**
* A trade route that is ready to execute.
* A trade can be broken into multiple sub-trades for potentially better trades.
*
* @category Router
* @param subRoutes
* The sub-routes that make up the trade route. The sum of all splitPercent should equal 100.
* @param totalAmountIn The total amount of token being traded in for this trade.
* @param totalAmountOut The total amount of token being traded out for this trade.
*/
export type TradeRoute = {
subRoutes: SubTradeRoute[];
totalAmountIn: BN;
totalAmountOut: BN;
};
/**
* Represents a fragment of a trade that was splitted into multiple trades for more efficient execution.
*
* @category Router
* @param path The path of pool addresses that make up this sub trade.
* @param splitPercent The percent of the trade that this sub trade represents.
* @param amountIn The amount of token being traded in within this sub-route.
* @param amountOut The amount of token being traded out within this sub-routes.
* @param hopQuotes The quotes for each hop in the path of this trade.
*/
export type SubTradeRoute = {
path: Path;
splitPercent: number;
amountIn: BN;
amountOut: BN;
hopQuotes: TradeHop[];
};
/**
* Represents a quote for a single hop in the path of a {@link SubTradeRoute}.
*
* @category Router
* @param amountIn The amount of token being traded in for this hop.
* @param amountOut The amount of token being traded out for this hop.
* @param whirlpool The address of the whirlpool that this hop is trading through.
* @param inputMint The address of the input token mint.
* @param outputMint The address of the output token mint.
* @param mintA The address of the first mint in the pool.
* @param mintB The address of the second mint in the pool.
* @param vaultA The address of the first vault in the pool.
* @param vaultB The address of the second vault in the pool.
* @param quote The {@link SwapQuote} for this hop.
* @param snapshot A snapshot of the whirlpool condition when this hop was made
*/
export type TradeHop = {
amountIn: BN;
amountOut: BN;
whirlpool: Address;
inputMint: Address;
outputMint: Address;
mintA: Address;
mintB: Address;
vaultA: Address;
vaultB: Address;
quote: SwapQuote;
snapshot: TradeHopSnapshot;
};
/**
* A snapshot of the whirlpool condition when a trade hop was made.
* @category Router
*/
export type TradeHopSnapshot = {
aToB: boolean;
sqrtPrice: BN;
feeRate: Percentage;
};
/**
* A trade route that is ready to execute.
* Contains the {@link TradeRoute} and a possible set of {@link AddressLookupTableAccount} that
* is needed to successfully execute the trade.
*
* If the lookup table accounts are undefined, then the trade can be executed with a legacy transaction.
*
* @category Router
*/
export type ExecutableRoute = readonly [
TradeRoute,
AddressLookupTableAccount[] | undefined,
];
/**
* Convienience class to find routes through a set of Whirlpools and execute a swap across them.
* The router only supports up to 2-hop trades between pools and does not support arbitrage trades
* between the same token.
*
* @category Router
*
* @deprecated WhirlpoolRouter will be removed in the future release. Please use endpoint which provides qoutes.
*/
export interface WhirlpoolRouter {
/**
* Finds all possible routes for a trade, ordered by the best other token amount you would get from a trade.
* Use {@link RouterUtils.selectFirstExecutableRoute} to find the best executable route.
*
* @param trade
* The trade to find routes for.
* @param opts an {@link WhirlpoolAccountFetchOptions} object to define fetch and cache options when accessing on-chain accounts
* @param opts
* {@link RoutingOptions} to configure the router. Missing options will be filled with default values from
* {@link RouterUtils.getDefaultRoutingOptions}.
* @param fetchOpts
* {@link WhirlpoolAccountFetchOptions} to configure the fetching of on-chain data.
* @return A list of {@link TradeRoute} that can be used to execute a swap, ordered by the best other token amount.
*
* @deprecated WhirlpoolRouter will be removed in the future release. Please use endpoint which provides qoutes.
*/
findAllRoutes(
trade: Trade,
opts?: Partial<RoutingOptions>,
fetchOpts?: WhirlpoolAccountFetchOptions,
): Promise<TradeRoute[]>;
/**
* Finds all possible routes for a trade and select the best route that is executable
* under the current execution environment.
* @param trade
* The trade to find routes for.
* @param opts an {@link WhirlpoolAccountFetchOptions} object to define fetch and cache options when accessing on-chain accounts
* @param opts
* {@link RoutingOptions} to configure the router. Missing options will be filled with default values from
* {@link RouterUtils.getDefaultRoutingOptions}.
* @param selectionOpts
* {@link RouteSelectOptions} to configure the selection of the best route. Missing options
* will be filled with default values from {@link RouterUtils.getDefaultRouteSelectOptions}.
* @param fetchOpts
* {@link WhirlpoolAccountFetchOptions} to configure the fetching of on-chain data.
* @returns
* The best {@link ExecutableRoute} that can be used to execute a swap. If no executable route is found, null is returned.
*
* @deprecated WhirlpoolRouter will be removed in the future release. Please use endpoint which provides qoutes.
*/
findBestRoute(
trade: Trade,
opts?: Partial<RoutingOptions>,
selectionOpts?: Partial<RouteSelectOptions>,
fetchOpts?: WhirlpoolAccountFetchOptions,
): Promise<ExecutableRoute | null>;
/**
* Construct a {@link TransactionBuilder} to help execute a trade route.
* @param trade The trade route to execute.
* @param slippage The slippage tolerance for the trade.
* @param resolvedAtas
* The ATA accounts that the executing wallet owns / needed by the execution.
* If not provided, the router will attempt to resolve them.
* @returns
* A {@link TransactionBuilder}that can be used to execute the trade.
* If provvided from {@link ExecutableRoute}, plug the {@link AddressLookupTableAccount}s
* into builder to lower the transaction size.
*
* @deprecated WhirlpoolRouter will be removed in the future release. Please use endpoint which provides qoutes.
*/
swap(
trade: TradeRoute,
slippage: Percentage,
resolvedAtas: AtaAccountInfo[] | null,
): Promise<TransactionBuilder>;
}
| 0
|
solana_public_repos/orca-so/whirlpools/legacy-sdk/whirlpool/src/router
|
solana_public_repos/orca-so/whirlpools/legacy-sdk/whirlpool/src/router/public/router-builder.ts
|
import type { Address } from "@coral-xyz/anchor";
import type { WhirlpoolRouter } from ".";
import type { WhirlpoolContext } from "../..";
import type { PoolGraph } from "../../utils/public";
import { PoolGraphBuilder } from "../../utils/public";
import { WhirlpoolRouterImpl } from "../router-impl";
/**
* Builder to build instances of the {@link WhirlpoolRouter}
* @category Router
*
* @deprecated WhirlpoolRouter will be removed in the future release. Please use endpoint which provides qoutes.
*/
export class WhirlpoolRouterBuilder {
/**
* Builds a {@link WhirlpoolRouter} with a prebuilt {@link PoolGraph}
*
* @param ctx A {@link WhirlpoolContext} for the current execution environment
* @param graph A {@link PoolGraph} that represents the connections between all pools.
* @returns A {@link WhirlpoolRouter} that can be used to find routes and execute swaps
*
* @deprecated WhirlpoolRouter will be removed in the future release. Please use endpoint which provides qoutes.
*/
static buildWithPoolGraph(
ctx: WhirlpoolContext,
graph: PoolGraph,
): WhirlpoolRouter {
return new WhirlpoolRouterImpl(ctx, graph);
}
/**
* Fetch and builds a {@link WhirlpoolRouter} with a list of pool addresses.
* @param ctx A {@link WhirlpoolContext} for the current execution environment
* @param pools A list of {@link Address}es that the router will find routes through.
* @returns A {@link WhirlpoolRouter} that can be used to find routes and execute swaps
*
* @deprecated WhirlpoolRouter will be removed in the future release. Please use endpoint which provides qoutes.
*/
static async buildWithPools(
ctx: WhirlpoolContext,
pools: Address[],
): Promise<WhirlpoolRouter> {
const poolGraph = await PoolGraphBuilder.buildPoolGraphWithFetch(
pools,
ctx.fetcher,
);
return new WhirlpoolRouterImpl(ctx, poolGraph);
}
}
| 0
|
solana_public_repos/orca-so/whirlpools/legacy-sdk/whirlpool/src/router
|
solana_public_repos/orca-so/whirlpools/legacy-sdk/whirlpool/src/router/public/router-utils.ts
|
import type {
LookupTableFetcher,
TransactionBuilder,
} from "@orca-so/common-sdk";
import {
AddressUtil,
MEASUREMENT_BLOCKHASH,
Percentage,
TX_SIZE_LIMIT,
} from "@orca-so/common-sdk";
import type { Account } from "@solana/spl-token";
import type { PublicKey } from "@solana/web3.js";
import BN from "bn.js";
import Decimal from "decimal.js";
import type { ExecutableRoute, RoutingOptions, Trade, TradeRoute } from ".";
import type { WhirlpoolContext } from "../../context";
import { getSwapFromRoute } from "../../instructions/composites/swap-with-route";
import { PREFER_CACHE } from "../../network/public/fetcher";
import { U64 } from "../../utils/math/constants";
import { PriceMath } from "../../utils/public";
import { isWalletConnected } from "../../utils/wallet-utils";
/**
* A type representing a Associated Token Account
* @param address The address of the ATA account.
* @param owner The owner address of the ATA.
* @param mint The mint of the token the ATA represents.
*/
export type AtaAccountInfo = Pick<Account, "address" | "owner" | "mint">;
/**
* Parameters to configure the selection of the best route.
* @category Router
* @param maxSupportedTransactionVersion The maximum transaction version that the wallet supports.
* @param maxTransactionSize The maximum transaction size that the wallet supports.
* @param availableAtaAccounts A list of ATA accounts that are available in this wallet to use for the swap.
* @param onRouteEvaluation
* A callback that is called right before a route is evaluated. Users have a chance to add additional instructions
* to be added for an accurate txn size measurement. (ex. Adding a priority fee ix to the transaction)
*
*/
export type RouteSelectOptions = {
maxSupportedTransactionVersion: "legacy" | number;
maxTransactionSize: number;
availableAtaAccounts?: AtaAccountInfo[];
onRouteEvaluation?: (
route: Readonly<TradeRoute>,
tx: TransactionBuilder,
) => void;
};
/**
* A selection of utility functions for the {@link WhirlpoolRouter}.
* @category Router
* @deprecated WhirlpoolRouter will be removed in the future release. Please use endpoint which provides qoutes.
*/
export class RouterUtils {
/**
* Selects the best executable route from a list of routes using the current execution environment.
* The wallet support type, available ATA accounts, existence of lookup tables all effect the transaction size
* and eligibility of a route.
*
* @param ctx The {@link WhirlpoolContext} that represents the current execution environment
* @param orderedRoutes A list of routes to select from, ordered by the best routes (trade amount wise) first.
* @param opts {@link RouteSelectOptions} to configure the selection of the best route.
* @returns
* The best {@link ExecutableRoute} that can be used to execute a swap. If no executable route is found, null is returned.
*
* @deprecated WhirlpoolRouter will be removed in the future release. Please use endpoint which provides qoutes.
*/
static async selectFirstExecutableRoute(
ctx: WhirlpoolContext,
orderedRoutes: TradeRoute[],
opts: RouteSelectOptions,
): Promise<ExecutableRoute | null> {
const { wallet } = ctx;
if (orderedRoutes.length === 0) {
return null;
}
// Don't measure if there is no wallet
if (!isWalletConnected(wallet)) {
return [orderedRoutes[0], undefined];
}
// Preload LookupTableFetcher with lookup tables that are needed for v0 transactions
if (
opts.maxSupportedTransactionVersion !== "legacy" &&
ctx.lookupTableFetcher
) {
await loadLookupTablesForRoutes(ctx.lookupTableFetcher, orderedRoutes);
}
for (let i = 0; i < orderedRoutes.length && i < MEASURE_ROUTE_MAX; i++) {
const route = orderedRoutes[i];
const tx = await getSwapFromRoute(
ctx,
{
route,
slippage: Percentage.fromFraction(0, 100),
resolvedAtaAccounts: opts.availableAtaAccounts ?? null,
wallet: wallet.publicKey,
},
PREFER_CACHE,
);
if (!!opts.onRouteEvaluation) {
opts.onRouteEvaluation(route, tx);
}
try {
const legacyTxSize = tx.txnSize({
latestBlockhash: MEASUREMENT_BLOCKHASH,
maxSupportedTransactionVersion: "legacy",
});
if (
legacyTxSize !== undefined &&
legacyTxSize <= opts.maxTransactionSize
) {
return [route, undefined];
}
} catch {
// No-op
}
let v0TxSize;
if (
opts.maxSupportedTransactionVersion !== "legacy" &&
ctx.lookupTableFetcher
) {
const addressesToLookup =
RouterUtils.getTouchedTickArraysFromRoute(route);
if (addressesToLookup.length > MAX_LOOKUP_TABLE_FETCH_SIZE) {
continue;
}
const lookupTableAccounts =
await ctx.lookupTableFetcher.getLookupTableAccountsForAddresses(
addressesToLookup,
);
try {
v0TxSize = tx.txnSize({
latestBlockhash: MEASUREMENT_BLOCKHASH,
maxSupportedTransactionVersion: opts.maxSupportedTransactionVersion,
lookupTableAccounts,
});
if (v0TxSize !== undefined && v0TxSize <= opts.maxTransactionSize) {
return [route, lookupTableAccounts];
}
} catch {
// No-op
}
}
}
return null;
}
/**
* Calculate the price impact for a route.
* @param trade The trade the user used to derive the route.
* @param route The route to calculate the price impact for.
* @returns A Decimal object representing the percentage value of the price impact (ex. 3.01%)
*
* @deprecated WhirlpoolRouter will be removed in the future release. Please use endpoint which provides qoutes.
*/
static getPriceImpactForRoute(trade: Trade, route: TradeRoute): Decimal {
const { amountSpecifiedIsInput } = trade;
const totalBaseValue = route.subRoutes.reduce((acc, route) => {
const directionalHops = amountSpecifiedIsInput
? route.hopQuotes
: route.hopQuotes.slice().reverse();
const baseOutputs = directionalHops.reduce((acc, quote, index) => {
const { snapshot } = quote;
const { aToB, sqrtPrice, feeRate } = snapshot;
// Inverse sqrt price will cause 1bps precision loss since ticks are spaces of 1bps
const directionalSqrtPrice = aToB
? sqrtPrice
: PriceMath.invertSqrtPriceX64(sqrtPrice);
// Convert from in/out -> base_out/in using the directional price & fee rate
let nextBaseValue;
const price = directionalSqrtPrice.mul(directionalSqrtPrice).div(U64);
if (amountSpecifiedIsInput) {
const amountIn = index === 0 ? quote.amountIn : acc[index - 1];
const feeAdjustedAmount = amountIn
.mul(feeRate.denominator.sub(feeRate.numerator))
.div(feeRate.denominator);
nextBaseValue = price.mul(feeAdjustedAmount).div(U64);
} else {
const amountOut = index === 0 ? quote.amountOut : acc[index - 1];
const feeAdjustedAmount = amountOut.mul(U64).div(price);
nextBaseValue = feeAdjustedAmount
.mul(feeRate.denominator)
.div(feeRate.denominator.sub(feeRate.numerator));
}
acc.push(nextBaseValue);
return acc;
}, new Array<BN>());
return acc.add(baseOutputs[baseOutputs.length - 1]);
}, new BN(0));
const totalBaseValueDec = new Decimal(totalBaseValue.toString());
const totalAmountEstimatedDec = new Decimal(
amountSpecifiedIsInput
? route.totalAmountOut.toString()
: route.totalAmountIn.toString(),
);
const priceImpact = amountSpecifiedIsInput
? totalBaseValueDec.sub(totalAmountEstimatedDec).div(totalBaseValueDec)
: totalAmountEstimatedDec
.sub(totalBaseValueDec)
.div(totalAmountEstimatedDec);
return priceImpact.mul(100);
}
/**
* Get the tick arrays addresses that are touched by a route.
* @param route The route to get the tick arrays from.
* @returns The tick arrays addresses that are touched by the route.
* @deprecated WhirlpoolRouter will be removed in the future release. Please use endpoint which provides qoutes.
*/
static getTouchedTickArraysFromRoute(route: TradeRoute): PublicKey[] {
const taAddresses = new Set<string>();
for (const quote of route.subRoutes) {
for (const hop of quote.hopQuotes) {
// We only need to search for tick arrays, since we should be guaranteed due to the layout
// that all other addresses are included in the LUTs for the tick array
taAddresses.add(hop.quote.tickArray0.toBase58());
taAddresses.add(hop.quote.tickArray1.toBase58());
taAddresses.add(hop.quote.tickArray2.toBase58());
}
}
return AddressUtil.toPubKeys(Array.from(taAddresses));
}
/**
* Get the default options for generating trade routes.
* @returns Default options for generating trade routes.
* @deprecated WhirlpoolRouter will be removed in the future release. Please use endpoint which provides qoutes.
*/
static getDefaultRouteOptions(): RoutingOptions {
return {
percentIncrement: 20,
numTopRoutes: 50,
numTopPartialQuotes: 10,
maxSplits: 3,
};
}
/**
* Get the default options for selecting a route from a list of generated routes.
* @returns Default options for selecting a route from a list of generated routes.
*/
static getDefaultSelectOptions(): RouteSelectOptions {
return {
maxSupportedTransactionVersion: 0,
maxTransactionSize: TX_SIZE_LIMIT,
};
}
}
async function loadLookupTablesForRoutes(
lookupTableFetcher: LookupTableFetcher,
routes: TradeRoute[],
) {
const altTicks = new Set<string>();
for (let i = 0; i < routes.length && i < MEASURE_ROUTE_MAX; i++) {
const route = routes[i];
RouterUtils.getTouchedTickArraysFromRoute(route).map((ta) =>
altTicks.add(ta.toBase58()),
);
}
const altTickArray = Array.from(altTicks);
const altPageSize = 45;
const altRequests = [];
for (let i = 0; i < altTickArray.length; i += altPageSize) {
altRequests.push(altTickArray.slice(i, i + altPageSize));
}
await Promise.all(
altRequests.map((altPage) => {
const altPageKeys = AddressUtil.toPubKeys(altPage);
lookupTableFetcher.loadLookupTables(altPageKeys);
}),
);
}
// The maximum number of routes to measure
const MEASURE_ROUTE_MAX = 100;
// The maximum number of tick arrays to lookup per network request
const MAX_LOOKUP_TABLE_FETCH_SIZE = 50;
| 0
|
solana_public_repos/nautilus-project
|
solana_public_repos/nautilus-project/nautilus/CODE_OF_CONDUCT.md
|
# Code of Conduct
As contributors and maintainers of this project, we are committed to fostering an inclusive and welcoming community for all, and to promoting a respectful and collaborative environment that values the diversity of its participants. We believe that everyone should be treated with respect and dignity.
We adhere to a high standard for respectful and professional interactions. Our Code of Conduct follows the [Rust Code of Conduct](https://www.rust-lang.org/policies/code-of-conduct). We encourage all contributors to familiarize themselves with the Rust Code of Conduct.
As project maintainers, we have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned with this Code of Conduct. By adopting this Code of Conduct, we commit ourselves to fairly and consistently applying these principles to every aspect of managing this project, and we expect all contributors to do the same.
This code of conduct applies to all project spaces, including public and private communication channels, such as mailing lists, social media, issue trackers, and chat rooms, as well as in-person events related to the project.
If you witness or experience any behavior that violates this Code of Conduct, please contact the project maintainers at [jcaulfield135@gmail.com]. All complaints will be reviewed and investigated, and we will take appropriate action to address the situation.
Thank you for being a part of our community, and for helping us to create a welcoming and inclusive environment for all.
| 0
|
solana_public_repos/nautilus-project
|
solana_public_repos/nautilus-project/nautilus/LICENSE
|
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
Copyright 2024 Joe Caulfield
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
| 0
|
solana_public_repos/nautilus-project
|
solana_public_repos/nautilus-project/nautilus/README.md
|
# Nautilus
[](https://github.com/nautilus-project/nautilus/actions/workflows/rust.yml)
[](https://github.com/nautilus-project/nautilus/actions/workflows/typescript.yml)
[](https://github.com/nautilus-project/nautilus/actions/workflows/python.yml)
<p width="full" margin="auto" align="center" style = "background:gray"><img src="https://raw.githubusercontent.com/nautilus-project/nautilus/main/docs/public/nautilus-icon.jpg" alt="youtube" width="200" margin="auto" align="center" bg="white"/></p>
**Snippets from Tests:**
```rust
use nautilus::*;
#[nautilus]
pub mod my_program {
fn create<'a>(mut new_wallet: Create<'a, Wallet<'a>>) -> ProgramResult {
new_wallet.create()
}
fn transfer<'a>(from: Signer<Wallet<'a>>, to: Mut<Wallet<'a>>, amount: u64) -> ProgramResult {
from.transfer_lamports(to.clone(), amount)
}
fn create_token<'a>(
mut new_token: Create<'a, Token<'a>>,
decimals: u8,
title: String,
symbol: String,
uri: String,
mint_authority: Signer<Wallet<'a>>,
) -> ProgramResult {
new_token.create(
decimals,
title,
symbol,
uri,
mint_authority.clone(),
mint_authority.clone(),
Some(mint_authority),
)
}
fn create_person<'a>(
mut new_person: Create<'a, Record<'a, Person>>,
name: String,
authority: Pubkey,
) -> ProgramResult {
new_person.create(name, authority)
}
fn create_home<'a>(
mut new_home: Create<'a, Account<'a, Home>>,
house_number: u8,
street: String,
some_pubkey: Pubkey,
) -> ProgramResult {
new_home.create(house_number, street, (some_pubkey,)) // Seed parameter required
}
}
#[derive(Table)]
struct Person {
#[primary_key(autoincrement = true)]
id: u8,
name: String,
#[authority]
authority: Pubkey,
}
#[derive(State)]
#[seeds(
"home", // Literal seed
some_pubkey: Pubkey, // Parameter seed
)]
struct Home {
house_number: u8,
street: String,
}
```
### ⚡️ Rust-Analyzer Friendly!


**More Snippets from Tests:**
```rust
use nautilus::*;
#[nautilus]
mod program_nautilus {
fn create_with_payer<'a>(
mut new_wallet: Create<'a, Wallet<'a>>,
rent_payer: Signer<Wallet<'a>>,
) -> ProgramResult {
new_wallet.create_with_payer(rent_payer)
}
fn create_mint_with_payer<'a>(
mut new_mint: Create<'a, Mint<'a>>,
decimals: u8,
mint_authority: Signer<Wallet<'a>>,
rent_payer: Signer<Wallet<'a>>,
) -> ProgramResult {
new_mint.create_with_payer(
decimals,
mint_authority.clone(),
Some(mint_authority),
rent_payer,
)
}
fn mint_mint_to<'a>(
mint: Mut<Mint<'a>>,
to: Mut<AssociatedTokenAccount<'a>>,
authority: Signer<Wallet<'a>>,
amount: u64,
) -> ProgramResult {
mint.mint_to(to, authority, amount)
}
fn create_nft<'a>(
mut new_nft: Create<'a, Nft<'a>>,
title: String,
symbol: String,
uri: String,
mint_authority: Signer<Wallet<'a>>,
) -> ProgramResult {
new_nft.create(
title,
symbol,
uri,
mint_authority.clone(),
mint_authority.clone(),
Some(mint_authority),
)
}
fn create_home<'a>(
mut new_home: Create<'a, Record<'a, Home>>,
id: u8,
house_number: u8,
street: String,
) -> ProgramResult {
new_home.create(id, house_number, street)
}
fn transfer_from_home<'a>(
home: Mut<Record<'a, Home>>,
recipient: Mut<Wallet<'a>>,
amount: u64,
) -> ProgramResult {
home.transfer_lamports(recipient, amount)
}
fn create_car<'a>(
mut new_car: Create<'a, Account<'a, Car>>,
make: String,
model: String,
purchase_authority: Pubkey,
operating_authority: Pubkey,
) -> ProgramResult {
new_car.create(make, model, purchase_authority, operating_authority)
}
/// A simluated "complex" program instruction to test Nautilus.
/// The logic herein is just for example.
fn complex<'a>(
_authority1: Signer<Wallet<'a>>, // Marking this as `Signer` will ensure it's a signer on the tx.
authority2: Signer<Wallet<'a>>,
rent_payer1: Signer<Wallet<'a>>,
rent_payer2: Signer<Wallet<'a>>,
wallet_to_allocate: Create<'a, Wallet<'a>>, // Marking this as `Create` will ensure it hasn't been created.
mut wallet_to_create: Create<'a, Wallet<'a>>,
wallet_to_create_with_transfer_safe: Create<'a, Wallet<'a>>,
wallet_to_create_with_transfer_unsafe: Mut<Wallet<'a>>,
some_other_transfer_recipient: Mut<Wallet<'a>>,
amount_to_fund: u64,
amount_to_transfer: u64,
) -> ProgramResult {
//
// /* Business Logic */
//
// Some random checks to simulate how custom checks might look.
assert!(rent_payer1
.owner()
.eq(&nautilus::solana_program::system_program::ID));
assert!(rent_payer2
.owner()
.eq(&nautilus::solana_program::system_program::ID));
// Even though the check will be applied via `Signer` in the function sig, you can still
// check yourself if you choose to.
assert!(authority2.is_signer());
// Even though the check will be applied via `Create` in the function sig, you can still
// check yourself if you choose to.
assert!(wallet_to_allocate.lamports() == 0);
assert!(wallet_to_allocate.is_writable());
wallet_to_allocate.allocate()?;
assert!(wallet_to_create.lamports() == 0);
assert!(wallet_to_create.is_writable());
wallet_to_create.create()?;
// Safe - checked at entry with `Create`.
rent_payer1.transfer_lamports(wallet_to_create_with_transfer_safe, amount_to_fund)?;
// Unsafe - not marked with `Create`.
rent_payer2.transfer_lamports(wallet_to_create_with_transfer_unsafe, amount_to_fund)?;
// Transfer with balance assertions
let from_beg_balance = authority2.lamports();
let to_beg_balance = some_other_transfer_recipient.lamports();
authority2.transfer_lamports(some_other_transfer_recipient.clone(), amount_to_transfer)?;
let from_end_balance = authority2.lamports();
let to_end_balance = some_other_transfer_recipient.lamports();
assert!(from_beg_balance - from_end_balance == amount_to_transfer);
assert!(to_end_balance - to_beg_balance == amount_to_transfer);
//
Ok(())
}
}
#[derive(Table)]
struct Home {
#[primary_key(autoincrement = false)]
id: u8,
house_number: u8,
street: String,
}
#[derive(State)]
#[seeds(
"car", // Literal seed
purchase_authority, // Self-referencing seed
operating_authority, // Self-referencing seed
)]
struct Car {
make: String,
model: String,
#[authority]
purchase_authority: Pubkey,
#[authority]
operating_authority: Pubkey,
}
```
### 🔎 How It Works

| 0
|
solana_public_repos/nautilus-project
|
solana_public_repos/nautilus-project/nautilus/CONTRIBUTING.md
|
# Contributing Guidelines
Welcome to Nautilus! Please take a moment to review these guidelines before submitting your contributions.
## Getting Started
To get started, first **fork this repository to your own account**. Then clone the repository to your local machine and create a new branch for your changes:
```shell
$ git clone https://github.com/your-username/nautilus.git
$ cd nautilus
$ git checkout -b my-new-feature
```
Make your changes and commit them with clear commit messages. Be sure to test your changes thoroughly before submitting a pull request.
## Pull Requests
When submitting a pull request, please make sure it meets the following criteria:
The code is well-written and follows the project's coding standards.
The code has been tested thoroughly and works as intended.
The commit messages are clear and informative.
## Issues
If you encounter any issues while working on the project, please check the issue tracker to see if the issue has already been reported. If not, please open a new issue and provide as much detail as possible about the problem, including steps to reproduce it.
## Code of Conduct
Please note that this project is governed by our code of conduct. We expect all contributors to abide by this code of conduct, which can be found in the CODE_OF_CONDUCT.md file in this repository.
Thank you for contributing to Nautilus!
| 0
|
solana_public_repos/nautilus-project/nautilus
|
solana_public_repos/nautilus-project/nautilus/py/README.md
|
# 🐍 Nautilus Py
| 0
|
solana_public_repos/nautilus-project/nautilus
|
solana_public_repos/nautilus-project/nautilus/py/setup.py
|
import pathlib
from setuptools import setup
# The directory containing this file
HERE = pathlib.Path(__file__).parent
# The text of the README file
README = (HERE / "README.md").read_text()
setup(
name='nautilus_py',
version='0.0.1',
author='Joe Caulfield',
author_email='jcaulfield135@gmail.com',
packages=['nautilus'],
url='https://github.com/nautilus-project/nautilus',
description='Python client for Nautilus programs on Solana',
install_requires=[
"pytest",
"solana",
"solders",
"sqlparse",
"termcolor",
],
)
| 0
|
solana_public_repos/nautilus-project/nautilus/py
|
solana_public_repos/nautilus-project/nautilus/py/nautilus/index.py
|
#
#
# ----------------------------------------------------------------
# Nautilus
# ----------------------------------------------------------------
#
#
from .util.index import NautilusUtils
from solana.rpc.async_api import AsyncClient
from solders.pubkey import Pubkey
from solders.keypair import Keypair
class Nautilus:
connection: AsyncClient
programId: Pubkey
payer: Keypair
util: NautilusUtils
def __init__(self, connection, programId, payer=None):
self.connection = connection
self.programId = programId
self.payer = payer
self.util = NautilusUtils()
| 0
|
solana_public_repos/nautilus-project/nautilus/py
|
solana_public_repos/nautilus-project/nautilus/py/nautilus/__init__.py
|
__version__ = "0.0.1"
from .index import Nautilus
from .util import NautilusUtils
| 0
|
solana_public_repos/nautilus-project/nautilus/py/nautilus
|
solana_public_repos/nautilus-project/nautilus/py/nautilus/idl/program_shank.json
|
{
"version": "0.1.0",
"name": "program_shank",
"instructions": [
{
"name": "CreatePerson",
"accounts": [
{
"name": "autoincAccount",
"isMut": true,
"isSigner": false,
"desc": "The account for autoincrementing this table"
},
{
"name": "newAccount",
"isMut": true,
"isSigner": false,
"desc": "The account that will represent the Person being created"
},
{
"name": "authority",
"isMut": false,
"isSigner": true,
"desc": "Record authority"
},
{
"name": "feePayer",
"isMut": true,
"isSigner": true,
"desc": "Fee payer"
},
{
"name": "systemProgram",
"isMut": false,
"isSigner": false,
"desc": "The System Program"
}
],
"args": [
{
"name": "createPersonArgs",
"type": {
"defined": "CreatePersonArgs"
}
}
],
"discriminant": {
"type": "u8",
"value": 0
}
},
{
"name": "DeletePerson",
"accounts": [
{
"name": "targetAccount",
"isMut": true,
"isSigner": false,
"desc": "The account that will represent the Person being deleted"
},
{
"name": "authority",
"isMut": false,
"isSigner": true,
"desc": "Record authority"
},
{
"name": "feePayer",
"isMut": true,
"isSigner": true,
"desc": "Fee payer"
}
],
"args": [],
"discriminant": {
"type": "u8",
"value": 1
}
},
{
"name": "UpdatePerson",
"accounts": [
{
"name": "newAccount",
"isMut": true,
"isSigner": false,
"desc": "The account that will represent the Person being updated"
},
{
"name": "authority",
"isMut": false,
"isSigner": true,
"desc": "Record authority"
},
{
"name": "feePayer",
"isMut": true,
"isSigner": true,
"desc": "Fee payer"
},
{
"name": "systemProgram",
"isMut": false,
"isSigner": false,
"desc": "The System Program"
}
],
"args": [
{
"name": "updatePersonArgs",
"type": {
"defined": "UpdatePersonArgs"
}
}
],
"discriminant": {
"type": "u8",
"value": 2
}
}
],
"accounts": [
{
"name": "Person",
"type": {
"kind": "struct",
"fields": [
{
"name": "id",
"type": "u32"
},
{
"name": "name",
"type": "string"
},
{
"name": "authority",
"type": "publicKey"
}
]
}
}
],
"types": [
{
"name": "CreatePersonArgs",
"type": {
"kind": "struct",
"fields": [
{
"name": "id",
"type": "u32"
},
{
"name": "name",
"type": "string"
},
{
"name": "authority",
"type": "publicKey"
}
]
}
},
{
"name": "UpdatePersonArgs",
"type": {
"kind": "struct",
"fields": [
{
"name": "id",
"type": "u32"
},
{
"name": "name",
"type": {
"option": "string"
}
},
{
"name": "authority",
"type": {
"option": "publicKey"
}
}
]
}
}
],
"metadata": {
"origin": "shank",
"address": "45A6jtRE6Tr71EpRATyWF8FYUNP7LEZ7NFd3Xb9LJ4TR"
}
}
| 0
|
solana_public_repos/nautilus-project/nautilus/py/nautilus
|
solana_public_repos/nautilus-project/nautilus/py/nautilus/util/index.py
|
class NautilusUtils:
def __init__(self) -> None:
pass
| 0
|
solana_public_repos/nautilus-project/nautilus/py/nautilus
|
solana_public_repos/nautilus-project/nautilus/py/nautilus/util/__init__.py
|
from .index import NautilusUtils
| 0
|
solana_public_repos/nautilus-project/nautilus/py
|
solana_public_repos/nautilus-project/nautilus/py/tests/sql_parse.py
|
from solana.rpc.async_api import AsyncClient
from solders.pubkey import Pubkey
from termcolor import colored
from nautilus import Nautilus
CONNECTION = AsyncClient("https://api.devnet.solana.com", "confirmed")
PROGRAM_ID = Pubkey.from_string("9kYnTzxTSTtKJjBBScH2m3SLBq8grogLhwMLZdcD2wG4")
nautilus = Nautilus(CONNECTION, PROGRAM_ID)
def test_parse_sql(input: str):
# output = nautilus.query(input).dump_sql()
output = input
assert input == output
print(colored(" ✅ -- can parse: ", "grey") + input)
if __name__ == '__main__':
test_parse_sql(
"SELECT * FROM person"
)
test_parse_sql(
"SELECT id, name FROM person"
)
test_parse_sql(
"SELECT * FROM person WHERE name = 'Joe'"
)
test_parse_sql(
"SELECT (id, name) FROM person WHERE name = 'Joe'"
)
test_parse_sql(
"SELECT * FROM person WHERE id = 1 AND name = 'Joe'"
)
test_parse_sql(
"SELECT (id, name) FROM person WHERE id = 1 AND name = 'Joe'"
)
test_parse_sql(
"SELECT * FROM person WHERE id = 1 AND name = 'Joe' AND authority = 'Joe'"
)
test_parse_sql(
"SELECT (id, name) FROM person WHERE id = 1 AND name = 'Joe' AND authority = 'Joe'"
)
test_parse_sql(
"SELECT * FROM person ORDER BY name ASC"
)
test_parse_sql(
"SELECT (id, name) FROM person ORDER BY name ASC"
)
test_parse_sql(
"SELECT * FROM person WHERE name = 'Joe' ORDER BY name ASC"
)
test_parse_sql(
"SELECT (id, name) FROM person WHERE name = 'Joe' ORDER BY name ASC"
)
test_parse_sql(
"SELECT * FROM person WHERE id = 1 AND name = 'Joe' ORDER BY name ASC"
)
test_parse_sql(
"SELECT (id, name) FROM person WHERE id = 1 AND name = 'Joe' ORDER BY name ASC"
)
test_parse_sql(
"SELECT * FROM person ORDER BY id DESC, name ASC"
)
test_parse_sql(
"SELECT (id, name) FROM person ORDER BY id DESC, name ASC"
)
test_parse_sql(
"SELECT * FROM person WHERE name = 'Joe' ORDER BY id DESC, name ASC"
)
test_parse_sql(
"SELECT (id, name) FROM person WHERE name = 'Joe' ORDER BY id DESC, name ASC"
)
test_parse_sql(
"SELECT * FROM person WHERE id = 1 AND name = 'Joe' ORDER BY id DESC, name ASC"
)
test_parse_sql(
"SELECT (id, name) FROM person WHERE id = 1 AND name = 'Joe' ORDER BY id DESC, name ASC"
)
test_parse_sql(
"SELECT id, name FROM person; SELECT id, name from heroes"
)
test_parse_sql(
"INSERT INTO person VALUES ('Paul', 'none')"
)
test_parse_sql(
"INSERT INTO person (name, authority) VALUES ('Paul', 'none')"
)
test_parse_sql(
"INSERT INTO person VALUES ('Paul', 'none'), ('John', 'none')"
)
test_parse_sql(
"INSERT INTO person (name, authority) VALUES ('Paul', 'none'), ('John', 'none')"
)
#Can un-comment when autoincrement config comes from IDL
#
#test_parse_sql(
# "INSERT INTO person VALUES (3, 'Paul', 'none')"
#)
#test_parse_sql(
# "INSERT INTO person (id, name, authority) VALUES (3, 'Paul', 'none')"
#)
#test_parse_sql(
# "INSERT INTO person VALUES (3, 'Paul', 'none'), (4, 'John', 'none')"
#)
#test_parse_sql(
# "INSERT INTO person (id, name, authority) VALUES (3, 'Paul', 'none'), (4, 'John', 'none')"
#)
#
test_parse_sql(
"DELETE FROM person"
)
test_parse_sql(
"DELETE FROM person WHERE name = 'Joe'"
)
test_parse_sql(
"DELETE FROM person WHERE id = 1 AND name = 'Joe'"
)
test_parse_sql(
"UPDATE person SET name = 'Paul' WHERE id = 1"
)
test_parse_sql(
"UPDATE person SET name = 'Paul' WHERE name = 'Joe'"
)
test_parse_sql(
"UPDATE person SET name = 'Paul' WHERE id = 1 AND name = 'Joe'"
)
test_parse_sql(
"UPDATE person SET name = 'Paul', authority = 'none' WHERE id = 1"
)
test_parse_sql(
"UPDATE person SET name = 'Paul', authority = 'none' WHERE name = 'Joe'"
)
test_parse_sql(
"UPDATE person SET name = 'Paul', authority = 'none' WHERE id = 1 AND name = 'Joe'"
)
| 0
|
solana_public_repos/nautilus-project/nautilus
|
solana_public_repos/nautilus-project/nautilus/js/yarn.lock
|
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"@babel/runtime@^7.12.5", "@babel/runtime@^7.17.2":
version "7.21.0"
resolved "https://registry.npmjs.org/@babel/runtime/-/runtime-7.21.0.tgz"
integrity sha512-xwII0//EObnq89Ji5AKYQaRYiW/nZ3llSv29d49IuxPhKbtJoLP+9QUUZ4nVragQVtaVGeZrpB+ZtG/Pdy/POw==
dependencies:
regenerator-runtime "^0.13.11"
"@noble/ed25519@^1.7.0":
version "1.7.3"
resolved "https://registry.npmjs.org/@noble/ed25519/-/ed25519-1.7.3.tgz"
integrity sha512-iR8GBkDt0Q3GyaVcIu7mSsVIqnFbkbRzGLWlvhwunacoLwt4J3swfKhfaM6rN6WY+TBGoYT1GtT1mIh2/jGbRQ==
"@noble/hashes@^1.1.2":
version "1.3.0"
resolved "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.0.tgz"
integrity sha512-ilHEACi9DwqJB0pw7kv+Apvh50jiiSyR/cQ3y4W7lOR5mhvn/50FLUfsnfJz0BDZtl/RR16kXvptiv6q1msYZg==
"@noble/secp256k1@^1.6.3":
version "1.7.1"
resolved "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.7.1.tgz"
integrity sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw==
"@solana/buffer-layout@^4.0.0":
version "4.0.1"
resolved "https://registry.npmjs.org/@solana/buffer-layout/-/buffer-layout-4.0.1.tgz"
integrity sha512-E1ImOIAD1tBZFRdjeM4/pzTiTApC0AOBGwyAMS4fwIodCWArzJ3DWdoh8cKxeFM2fElkxBh2Aqts1BPC373rHA==
dependencies:
buffer "~6.0.3"
"@solana/web3.js@^1.73.2":
version "1.74.0"
resolved "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.74.0.tgz"
integrity sha512-RKZyPqizPCxmpMGfpu4fuplNZEWCrhRBjjVstv5QnAJvgln1jgOfgui+rjl1ExnqDnWKg9uaZ5jtGROH/cwabg==
dependencies:
"@babel/runtime" "^7.12.5"
"@noble/ed25519" "^1.7.0"
"@noble/hashes" "^1.1.2"
"@noble/secp256k1" "^1.6.3"
"@solana/buffer-layout" "^4.0.0"
agentkeepalive "^4.2.1"
bigint-buffer "^1.1.5"
bn.js "^5.0.0"
borsh "^0.7.0"
bs58 "^4.0.1"
buffer "6.0.1"
fast-stable-stringify "^1.0.0"
jayson "^3.4.4"
node-fetch "^2.6.7"
rpc-websockets "^7.5.1"
superstruct "^0.14.2"
"@types/chai@^4.3.4":
version "4.3.4"
resolved "https://registry.npmjs.org/@types/chai/-/chai-4.3.4.tgz"
integrity sha512-KnRanxnpfpjUTqTCXslZSEdLfXExwgNxYPdiO2WGUj8+HDjFi8R3k5RVKPeSCzLjCcshCAtVO2QBbVuAV4kTnw==
"@types/connect@^3.4.33":
version "3.4.35"
resolved "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz"
integrity sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==
dependencies:
"@types/node" "*"
"@types/json5@^0.0.29":
version "0.0.29"
resolved "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz"
integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==
"@types/mocha@^10.0.1":
version "10.0.1"
resolved "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.1.tgz"
integrity sha512-/fvYntiO1GeICvqbQ3doGDIP97vWmvFt83GKguJ6prmQM2iXZfFcq6YE8KteFyRtX2/h5Hf91BYvPodJKFYv5Q==
"@types/node-fetch@^2.6.2":
version "2.6.3"
resolved "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.3.tgz"
integrity sha512-ETTL1mOEdq/sxUtgtOhKjyB2Irra4cjxksvcMUR5Zr4n+PxVhsCD9WS46oPbHL3et9Zde7CNRr+WUNlcHvsX+w==
dependencies:
"@types/node" "*"
form-data "^3.0.0"
"@types/node@*":
version "18.15.11"
resolved "https://registry.npmjs.org/@types/node/-/node-18.15.11.tgz"
integrity sha512-E5Kwq2n4SbMzQOn6wnmBjuK9ouqlURrcZDVfbo9ftDDTFt3nk7ZKK4GMOzoYgnpQJKcxwQw+lGaBvvlMo0qN/Q==
"@types/node@^12.12.54":
version "12.20.55"
resolved "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz"
integrity sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==
"@types/ws@^7.4.4":
version "7.4.7"
resolved "https://registry.npmjs.org/@types/ws/-/ws-7.4.7.tgz"
integrity sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==
dependencies:
"@types/node" "*"
agentkeepalive@^4.2.1:
version "4.3.0"
resolved "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.3.0.tgz"
integrity sha512-7Epl1Blf4Sy37j4v9f9FjICCh4+KAQOyXgHEwlyBiAQLbhKdq/i2QQU3amQalS/wPhdPzDXPL5DMR5bkn+YeWg==
dependencies:
debug "^4.1.0"
depd "^2.0.0"
humanize-ms "^1.2.1"
ansi-colors@4.1.1:
version "4.1.1"
resolved "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz"
integrity sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==
ansi-regex@^5.0.1:
version "5.0.1"
resolved "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz"
integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==
ansi-styles@^4.0.0, ansi-styles@^4.1.0:
version "4.3.0"
resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz"
integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==
dependencies:
color-convert "^2.0.1"
anymatch@~3.1.2:
version "3.1.3"
resolved "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz"
integrity sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==
dependencies:
normalize-path "^3.0.0"
picomatch "^2.0.4"
argparse@^2.0.1:
version "2.0.1"
resolved "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz"
integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==
arrify@^1.0.0:
version "1.0.1"
resolved "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz"
integrity sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==
asynckit@^0.4.0:
version "0.4.0"
resolved "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz"
integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==
balanced-match@^1.0.0:
version "1.0.2"
resolved "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz"
integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==
base-x@^3.0.2:
version "3.0.9"
resolved "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz"
integrity sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==
dependencies:
safe-buffer "^5.0.1"
base64-js@^1.3.1:
version "1.5.1"
resolved "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz"
integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==
big-integer@^1.6.48:
version "1.6.51"
resolved "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz"
integrity sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==
bigint-buffer@^1.1.5:
version "1.1.5"
resolved "https://registry.npmjs.org/bigint-buffer/-/bigint-buffer-1.1.5.tgz"
integrity sha512-trfYco6AoZ+rKhKnxA0hgX0HAbVP/s808/EuDSe2JDzUnCp/xAsli35Orvk67UrTEcwuxZqYZDmfA2RXJgxVvA==
dependencies:
bindings "^1.3.0"
binary-extensions@^2.0.0:
version "2.2.0"
resolved "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz"
integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==
bindings@^1.3.0:
version "1.5.0"
resolved "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz"
integrity sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==
dependencies:
file-uri-to-path "1.0.0"
bn.js@^5.0.0, bn.js@^5.2.0:
version "5.2.1"
resolved "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz"
integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==
borsh@^0.7.0:
version "0.7.0"
resolved "https://registry.npmjs.org/borsh/-/borsh-0.7.0.tgz"
integrity sha512-CLCsZGIBCFnPtkNnieW/a8wmreDmfUtjU2m9yHrzPXIlNbqVs0AQrSatSG6vdNYUqdc83tkQi2eHfF98ubzQLA==
dependencies:
bn.js "^5.2.0"
bs58 "^4.0.0"
text-encoding-utf-8 "^1.0.2"
brace-expansion@^1.1.7:
version "1.1.11"
resolved "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz"
integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==
dependencies:
balanced-match "^1.0.0"
concat-map "0.0.1"
brace-expansion@^2.0.1:
version "2.0.1"
resolved "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz"
integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==
dependencies:
balanced-match "^1.0.0"
braces@~3.0.2:
version "3.0.2"
resolved "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz"
integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==
dependencies:
fill-range "^7.0.1"
browser-stdout@1.3.1:
version "1.3.1"
resolved "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz"
integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==
bs58@^4.0.0, bs58@^4.0.1:
version "4.0.1"
resolved "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz"
integrity sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==
dependencies:
base-x "^3.0.2"
buffer-from@^1.0.0, buffer-from@^1.1.0:
version "1.1.2"
resolved "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz"
integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==
buffer@~6.0.3:
version "6.0.3"
resolved "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz"
integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==
dependencies:
base64-js "^1.3.1"
ieee754 "^1.2.1"
buffer@6.0.1:
version "6.0.1"
resolved "https://registry.npmjs.org/buffer/-/buffer-6.0.1.tgz"
integrity sha512-rVAXBwEcEoYtxnHSO5iWyhzV/O1WMtkUYWlfdLS7FjU4PnSJJHEfHXi/uHPI5EwltmOA794gN3bm3/pzuctWjQ==
dependencies:
base64-js "^1.3.1"
ieee754 "^1.2.1"
bufferutil@^4.0.1:
version "4.0.7"
resolved "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.7.tgz"
integrity sha512-kukuqc39WOHtdxtw4UScxF/WVnMFVSQVKhtx3AjZJzhd0RGZZldcrfSEbVsWWe6KNH253574cq5F+wpv0G9pJw==
dependencies:
node-gyp-build "^4.3.0"
camelcase@^6.0.0:
version "6.3.0"
resolved "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz"
integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==
chalk@^4.1.0:
version "4.1.2"
resolved "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz"
integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==
dependencies:
ansi-styles "^4.1.0"
supports-color "^7.1.0"
chokidar@3.5.3:
version "3.5.3"
resolved "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz"
integrity sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==
dependencies:
anymatch "~3.1.2"
braces "~3.0.2"
glob-parent "~5.1.2"
is-binary-path "~2.1.0"
is-glob "~4.0.1"
normalize-path "~3.0.0"
readdirp "~3.6.0"
optionalDependencies:
fsevents "~2.3.2"
cliui@^7.0.2:
version "7.0.4"
resolved "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz"
integrity sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==
dependencies:
string-width "^4.2.0"
strip-ansi "^6.0.0"
wrap-ansi "^7.0.0"
color-convert@^2.0.1:
version "2.0.1"
resolved "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz"
integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==
dependencies:
color-name "~1.1.4"
color-name@~1.1.4:
version "1.1.4"
resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz"
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
combined-stream@^1.0.8:
version "1.0.8"
resolved "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz"
integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==
dependencies:
delayed-stream "~1.0.0"
commander@^2.20.3:
version "2.20.3"
resolved "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz"
integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==
concat-map@0.0.1:
version "0.0.1"
resolved "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz"
integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==
debug@^4.1.0, debug@4.3.4:
version "4.3.4"
resolved "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz"
integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==
dependencies:
ms "2.1.2"
decamelize@^4.0.0:
version "4.0.0"
resolved "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz"
integrity sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==
delay@^5.0.0:
version "5.0.0"
resolved "https://registry.npmjs.org/delay/-/delay-5.0.0.tgz"
integrity sha512-ReEBKkIfe4ya47wlPYf/gu5ib6yUG0/Aez0JQZQz94kiWtRQvZIQbTiehsnwHvLSWJnQdhVeqYue7Id1dKr0qw==
delayed-stream@~1.0.0:
version "1.0.0"
resolved "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz"
integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==
depd@^2.0.0:
version "2.0.0"
resolved "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz"
integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==
diff@^3.1.0:
version "3.5.0"
resolved "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz"
integrity sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==
diff@5.0.0:
version "5.0.0"
resolved "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz"
integrity sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==
emoji-regex@^8.0.0:
version "8.0.0"
resolved "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz"
integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==
es6-promise@^4.0.3:
version "4.2.8"
resolved "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz"
integrity sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==
es6-promisify@^5.0.0:
version "5.0.0"
resolved "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz"
integrity sha512-C+d6UdsYDk0lMebHNR4S2NybQMMngAOnOwYBQjTOiv0MkoJMP0Myw2mgpDLBcpfCmRLxyFqYhS/CfOENq4SJhQ==
dependencies:
es6-promise "^4.0.3"
escalade@^3.1.1:
version "3.1.1"
resolved "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz"
integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==
escape-string-regexp@4.0.0:
version "4.0.0"
resolved "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz"
integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==
eventemitter3@^4.0.7:
version "4.0.7"
resolved "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz"
integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==
eyes@^0.1.8:
version "0.1.8"
resolved "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz"
integrity sha512-GipyPsXO1anza0AOZdy69Im7hGFCNB7Y/NGjDlZGJ3GJJLtwNSb2vrzYrTYJRrRloVx7pl+bhUaTB8yiccPvFQ==
fast-stable-stringify@^1.0.0:
version "1.0.0"
resolved "https://registry.npmjs.org/fast-stable-stringify/-/fast-stable-stringify-1.0.0.tgz"
integrity sha512-wpYMUmFu5f00Sm0cj2pfivpmawLZ0NKdviQ4w9zJeR8JVtOpOxHmLaJuj0vxvGqMJQWyP/COUkF75/57OKyRag==
file-uri-to-path@1.0.0:
version "1.0.0"
resolved "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz"
integrity sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==
fill-range@^7.0.1:
version "7.0.1"
resolved "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz"
integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==
dependencies:
to-regex-range "^5.0.1"
find-up@5.0.0:
version "5.0.0"
resolved "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz"
integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==
dependencies:
locate-path "^6.0.0"
path-exists "^4.0.0"
flat@^5.0.2:
version "5.0.2"
resolved "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz"
integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==
form-data@^3.0.0:
version "3.0.1"
resolved "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz"
integrity sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==
dependencies:
asynckit "^0.4.0"
combined-stream "^1.0.8"
mime-types "^2.1.12"
fs.realpath@^1.0.0:
version "1.0.0"
resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz"
integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==
fs@^0.0.1-security:
version "0.0.1-security"
resolved "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz"
integrity sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w==
fsevents@~2.3.2:
version "2.3.2"
resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz"
integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==
get-caller-file@^2.0.5:
version "2.0.5"
resolved "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz"
integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==
glob-parent@~5.1.2:
version "5.1.2"
resolved "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz"
integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==
dependencies:
is-glob "^4.0.1"
glob@7.2.0:
version "7.2.0"
resolved "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz"
integrity sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==
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"
has-flag@^4.0.0:
version "4.0.0"
resolved "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz"
integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==
he@1.2.0:
version "1.2.0"
resolved "https://registry.npmjs.org/he/-/he-1.2.0.tgz"
integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==
humanize-ms@^1.2.1:
version "1.2.1"
resolved "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz"
integrity sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==
dependencies:
ms "^2.0.0"
ieee754@^1.2.1:
version "1.2.1"
resolved "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz"
integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==
inflight@^1.0.4:
version "1.0.6"
resolved "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz"
integrity sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==
dependencies:
once "^1.3.0"
wrappy "1"
inherits@2:
version "2.0.4"
resolved "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz"
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
is-binary-path@~2.1.0:
version "2.1.0"
resolved "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz"
integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==
dependencies:
binary-extensions "^2.0.0"
is-extglob@^2.1.1:
version "2.1.1"
resolved "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz"
integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==
is-fullwidth-code-point@^3.0.0:
version "3.0.0"
resolved "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz"
integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==
is-glob@^4.0.1, is-glob@~4.0.1:
version "4.0.3"
resolved "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz"
integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==
dependencies:
is-extglob "^2.1.1"
is-number@^7.0.0:
version "7.0.0"
resolved "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz"
integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==
is-plain-obj@^2.1.0:
version "2.1.0"
resolved "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz"
integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==
is-unicode-supported@^0.1.0:
version "0.1.0"
resolved "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz"
integrity sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==
isomorphic-ws@^4.0.1:
version "4.0.1"
resolved "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz"
integrity sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==
jayson@^3.4.4:
version "3.7.0"
resolved "https://registry.npmjs.org/jayson/-/jayson-3.7.0.tgz"
integrity sha512-tfy39KJMrrXJ+mFcMpxwBvFDetS8LAID93+rycFglIQM4kl3uNR3W4lBLE/FFhsoUCEox5Dt2adVpDm/XtebbQ==
dependencies:
"@types/connect" "^3.4.33"
"@types/node" "^12.12.54"
"@types/ws" "^7.4.4"
commander "^2.20.3"
delay "^5.0.0"
es6-promisify "^5.0.0"
eyes "^0.1.8"
isomorphic-ws "^4.0.1"
json-stringify-safe "^5.0.1"
JSONStream "^1.3.5"
lodash "^4.17.20"
uuid "^8.3.2"
ws "^7.4.5"
js-yaml@4.1.0:
version "4.1.0"
resolved "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz"
integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==
dependencies:
argparse "^2.0.1"
json-stringify-safe@^5.0.1:
version "5.0.1"
resolved "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz"
integrity sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==
json5@^1.0.2:
version "1.0.2"
resolved "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz"
integrity sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==
dependencies:
minimist "^1.2.0"
jsonparse@^1.2.0:
version "1.3.1"
resolved "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz"
integrity sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==
JSONStream@^1.3.5:
version "1.3.5"
resolved "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz"
integrity sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==
dependencies:
jsonparse "^1.2.0"
through ">=2.2.7 <3"
locate-path@^6.0.0:
version "6.0.0"
resolved "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz"
integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==
dependencies:
p-locate "^5.0.0"
lodash@^4.17.20:
version "4.17.21"
resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
log-symbols@4.1.0:
version "4.1.0"
resolved "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz"
integrity sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==
dependencies:
chalk "^4.1.0"
is-unicode-supported "^0.1.0"
make-error@^1.1.1:
version "1.3.6"
resolved "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz"
integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==
mime-db@1.52.0:
version "1.52.0"
resolved "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz"
integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==
mime-types@^2.1.12:
version "2.1.35"
resolved "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz"
integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==
dependencies:
mime-db "1.52.0"
minimatch@^3.0.4:
version "3.1.2"
resolved "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz"
integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==
dependencies:
brace-expansion "^1.1.7"
minimatch@5.0.1:
version "5.0.1"
resolved "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz"
integrity sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==
dependencies:
brace-expansion "^2.0.1"
minimist@^1.2.0, minimist@^1.2.6:
version "1.2.8"
resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz"
integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==
mkdirp@^0.5.1:
version "0.5.6"
resolved "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz"
integrity sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==
dependencies:
minimist "^1.2.6"
mocha@^10.1.0, "mocha@^3.X.X || ^4.X.X || ^5.X.X || ^6.X.X || ^7.X.X || ^8.X.X || ^9.X.X || ^10.X.X":
version "10.2.0"
resolved "https://registry.npmjs.org/mocha/-/mocha-10.2.0.tgz"
integrity sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==
dependencies:
ansi-colors "4.1.1"
browser-stdout "1.3.1"
chokidar "3.5.3"
debug "4.3.4"
diff "5.0.0"
escape-string-regexp "4.0.0"
find-up "5.0.0"
glob "7.2.0"
he "1.2.0"
js-yaml "4.1.0"
log-symbols "4.1.0"
minimatch "5.0.1"
ms "2.1.3"
nanoid "3.3.3"
serialize-javascript "6.0.0"
strip-json-comments "3.1.1"
supports-color "8.1.1"
workerpool "6.2.1"
yargs "16.2.0"
yargs-parser "20.2.4"
yargs-unparser "2.0.0"
ms@^2.0.0, ms@2.1.3:
version "2.1.3"
resolved "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz"
integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==
ms@2.1.2:
version "2.1.2"
resolved "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz"
integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==
nanoid@3.3.3:
version "3.3.3"
resolved "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz"
integrity sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w==
node-fetch@^2.6.7:
version "2.6.9"
resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.9.tgz"
integrity sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==
dependencies:
whatwg-url "^5.0.0"
node-gyp-build@^4.3.0:
version "4.6.0"
resolved "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.6.0.tgz"
integrity sha512-NTZVKn9IylLwUzaKjkas1e4u2DLNcV4rdYagA4PWdPwW87Bi7z+BznyKSRwS/761tV/lzCGXplWsiaMjLqP2zQ==
node-sql-parser@^4.6.5:
version "4.6.6"
resolved "https://registry.npmjs.org/node-sql-parser/-/node-sql-parser-4.6.6.tgz"
integrity sha512-zpash5xnRY6+0C9HFru32iRJV1LTkwtrVpO90i385tYVF6efyXK/B3Nsq/15Fuv2utxrqHNjKtL55OHb8sl+eQ==
dependencies:
big-integer "^1.6.48"
normalize-path@^3.0.0, normalize-path@~3.0.0:
version "3.0.0"
resolved "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz"
integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==
once@^1.3.0:
version "1.4.0"
resolved "https://registry.npmjs.org/once/-/once-1.4.0.tgz"
integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==
dependencies:
wrappy "1"
p-limit@^3.0.2:
version "3.1.0"
resolved "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz"
integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==
dependencies:
yocto-queue "^0.1.0"
p-locate@^5.0.0:
version "5.0.0"
resolved "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz"
integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==
dependencies:
p-limit "^3.0.2"
path-exists@^4.0.0:
version "4.0.0"
resolved "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz"
integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==
path-is-absolute@^1.0.0:
version "1.0.1"
resolved "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz"
integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==
picomatch@^2.0.4, picomatch@^2.2.1:
version "2.3.1"
resolved "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz"
integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==
randombytes@^2.1.0:
version "2.1.0"
resolved "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz"
integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==
dependencies:
safe-buffer "^5.1.0"
readdirp@~3.6.0:
version "3.6.0"
resolved "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz"
integrity sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==
dependencies:
picomatch "^2.2.1"
regenerator-runtime@^0.13.11:
version "0.13.11"
resolved "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz"
integrity sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==
require-directory@^2.1.1:
version "2.1.1"
resolved "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz"
integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==
rpc-websockets@^7.5.1:
version "7.5.1"
resolved "https://registry.npmjs.org/rpc-websockets/-/rpc-websockets-7.5.1.tgz"
integrity sha512-kGFkeTsmd37pHPMaHIgN1LVKXMi0JD782v4Ds9ZKtLlwdTKjn+CxM9A9/gLT2LaOuEcEFGL98h1QWQtlOIdW0w==
dependencies:
"@babel/runtime" "^7.17.2"
eventemitter3 "^4.0.7"
uuid "^8.3.2"
ws "^8.5.0"
optionalDependencies:
bufferutil "^4.0.1"
utf-8-validate "^5.0.2"
safe-buffer@^5.0.1, safe-buffer@^5.1.0:
version "5.2.1"
resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz"
integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==
serialize-javascript@6.0.0:
version "6.0.0"
resolved "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz"
integrity sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==
dependencies:
randombytes "^2.1.0"
source-map-support@^0.5.6:
version "0.5.21"
resolved "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz"
integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==
dependencies:
buffer-from "^1.0.0"
source-map "^0.6.0"
source-map@^0.6.0:
version "0.6.1"
resolved "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz"
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
string-width@^4.1.0, string-width@^4.2.0:
version "4.2.3"
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.1"
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.1"
strip-bom@^3.0.0:
version "3.0.0"
resolved "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz"
integrity sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==
strip-json-comments@3.1.1:
version "3.1.1"
resolved "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz"
integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==
superstruct@^0.14.2:
version "0.14.2"
resolved "https://registry.npmjs.org/superstruct/-/superstruct-0.14.2.tgz"
integrity sha512-nPewA6m9mR3d6k7WkZ8N8zpTWfenFH3q9pA2PkuiZxINr9DKB2+40wEQf0ixn8VaGuJ78AB6iWOtStI+/4FKZQ==
supports-color@^7.1.0:
version "7.2.0"
resolved "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz"
integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==
dependencies:
has-flag "^4.0.0"
supports-color@8.1.1:
version "8.1.1"
resolved "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz"
integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==
dependencies:
has-flag "^4.0.0"
text-encoding-utf-8@^1.0.2:
version "1.0.2"
resolved "https://registry.npmjs.org/text-encoding-utf-8/-/text-encoding-utf-8-1.0.2.tgz"
integrity sha512-8bw4MY9WjdsD2aMtO0OzOCY3pXGYNx2d2FfHRVUKkiCPDWjKuOlhLVASS+pD7VkLTVjW268LYJHwsnPFlBpbAg==
"through@>=2.2.7 <3":
version "2.3.8"
resolved "https://registry.npmjs.org/through/-/through-2.3.8.tgz"
integrity sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==
to-regex-range@^5.0.1:
version "5.0.1"
resolved "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz"
integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==
dependencies:
is-number "^7.0.0"
tr46@~0.0.3:
version "0.0.3"
resolved "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz"
integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==
ts-mocha@^10.0.0:
version "10.0.0"
resolved "https://registry.npmjs.org/ts-mocha/-/ts-mocha-10.0.0.tgz"
integrity sha512-VRfgDO+iiuJFlNB18tzOfypJ21xn2xbuZyDvJvqpTbWgkAgD17ONGr8t+Tl8rcBtOBdjXp5e/Rk+d39f7XBHRw==
dependencies:
ts-node "7.0.1"
optionalDependencies:
tsconfig-paths "^3.5.0"
ts-node@7.0.1:
version "7.0.1"
resolved "https://registry.npmjs.org/ts-node/-/ts-node-7.0.1.tgz"
integrity sha512-BVwVbPJRspzNh2yfslyT1PSbl5uIk03EZlb493RKHN4qej/D06n1cEhjlOJG69oFsE7OT8XjpTUcYf6pKTLMhw==
dependencies:
arrify "^1.0.0"
buffer-from "^1.1.0"
diff "^3.1.0"
make-error "^1.1.1"
minimist "^1.2.0"
mkdirp "^0.5.1"
source-map-support "^0.5.6"
yn "^2.0.0"
tsconfig-paths@^3.5.0:
version "3.14.2"
resolved "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz"
integrity sha512-o/9iXgCYc5L/JxCHPe3Hvh8Q/2xm5Z+p18PESBU6Ff33695QnCHBEjcytY2q19ua7Mbl/DavtBOLq+oG0RCL+g==
dependencies:
"@types/json5" "^0.0.29"
json5 "^1.0.2"
minimist "^1.2.6"
strip-bom "^3.0.0"
typescript@^4.9.3:
version "4.9.5"
resolved "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz"
integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==
utf-8-validate@^5.0.2, utf-8-validate@>=5.0.2:
version "5.0.10"
resolved "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz"
integrity sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==
dependencies:
node-gyp-build "^4.3.0"
uuid@^8.3.2:
version "8.3.2"
resolved "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz"
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==
webidl-conversions@^3.0.0:
version "3.0.1"
resolved "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz"
integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==
whatwg-url@^5.0.0:
version "5.0.0"
resolved "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz"
integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==
dependencies:
tr46 "~0.0.3"
webidl-conversions "^3.0.0"
workerpool@6.2.1:
version "6.2.1"
resolved "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz"
integrity sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==
wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"
wrappy@1:
version "1.0.2"
resolved "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz"
integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==
ws@*, ws@^7.4.5:
version "7.5.9"
resolved "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz"
integrity sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==
ws@^8.5.0:
version "8.13.0"
resolved "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz"
integrity sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==
y18n@^5.0.5:
version "5.0.8"
resolved "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz"
integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==
yargs-parser@^20.2.2:
version "20.2.9"
resolved "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz"
integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==
yargs-parser@20.2.4:
version "20.2.4"
resolved "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz"
integrity sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==
yargs-unparser@2.0.0:
version "2.0.0"
resolved "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz"
integrity sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==
dependencies:
camelcase "^6.0.0"
decamelize "^4.0.0"
flat "^5.0.2"
is-plain-obj "^2.1.0"
yargs@16.2.0:
version "16.2.0"
resolved "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz"
integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==
dependencies:
cliui "^7.0.2"
escalade "^3.1.1"
get-caller-file "^2.0.5"
require-directory "^2.1.1"
string-width "^4.2.0"
y18n "^5.0.5"
yargs-parser "^20.2.2"
yn@^2.0.0:
version "2.0.0"
resolved "https://registry.npmjs.org/yn/-/yn-2.0.0.tgz"
integrity sha512-uTv8J/wiWTgUTg+9vLTi//leUl5vDQS6uii/emeTb2ssY7vl6QWf2fFbIIGjnhjvbdKlU0ed7QPgY1htTC86jQ==
yocto-queue@^0.1.0:
version "0.1.0"
resolved "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz"
integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==
| 0
|
solana_public_repos/nautilus-project/nautilus
|
solana_public_repos/nautilus-project/nautilus/js/package-lock.json
|
{
"name": "nautilus-js",
"version": "0.0.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "nautilus-js",
"version": "0.0.1",
"license": "MIT",
"dependencies": {
"@solana/web3.js": "^1.73.2",
"node-sql-parser": "^4.6.5"
},
"devDependencies": {
"@types/chai": "^4.3.4",
"@types/mocha": "^10.0.1",
"@types/node-fetch": "^2.6.2",
"fs": "^0.0.1-security",
"mocha": "^10.1.0",
"ts-mocha": "^10.0.0",
"typescript": "^4.9.3"
}
},
"node_modules/@babel/runtime": {
"version": "7.21.0",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.21.0.tgz",
"integrity": "sha512-xwII0//EObnq89Ji5AKYQaRYiW/nZ3llSv29d49IuxPhKbtJoLP+9QUUZ4nVragQVtaVGeZrpB+ZtG/Pdy/POw==",
"license": "MIT",
"dependencies": {
"regenerator-runtime": "^0.13.11"
},
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@noble/ed25519": {
"version": "1.7.3",
"resolved": "https://registry.npmjs.org/@noble/ed25519/-/ed25519-1.7.3.tgz",
"integrity": "sha512-iR8GBkDt0Q3GyaVcIu7mSsVIqnFbkbRzGLWlvhwunacoLwt4J3swfKhfaM6rN6WY+TBGoYT1GtT1mIh2/jGbRQ==",
"funding": [
{
"type": "individual",
"url": "https://paulmillr.com/funding/"
}
],
"license": "MIT"
},
"node_modules/@noble/hashes": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.0.tgz",
"integrity": "sha512-ilHEACi9DwqJB0pw7kv+Apvh50jiiSyR/cQ3y4W7lOR5mhvn/50FLUfsnfJz0BDZtl/RR16kXvptiv6q1msYZg==",
"funding": [
{
"type": "individual",
"url": "https://paulmillr.com/funding/"
}
],
"license": "MIT"
},
"node_modules/@noble/secp256k1": {
"version": "1.7.1",
"resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.7.1.tgz",
"integrity": "sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw==",
"funding": [
{
"type": "individual",
"url": "https://paulmillr.com/funding/"
}
],
"license": "MIT"
},
"node_modules/@solana/buffer-layout": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/@solana/buffer-layout/-/buffer-layout-4.0.1.tgz",
"integrity": "sha512-E1ImOIAD1tBZFRdjeM4/pzTiTApC0AOBGwyAMS4fwIodCWArzJ3DWdoh8cKxeFM2fElkxBh2Aqts1BPC373rHA==",
"license": "MIT",
"dependencies": {
"buffer": "~6.0.3"
},
"engines": {
"node": ">=5.10"
}
},
"node_modules/@solana/buffer-layout/node_modules/buffer": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",
"integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"license": "MIT",
"dependencies": {
"base64-js": "^1.3.1",
"ieee754": "^1.2.1"
}
},
"node_modules/@solana/web3.js": {
"version": "1.74.0",
"resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.74.0.tgz",
"integrity": "sha512-RKZyPqizPCxmpMGfpu4fuplNZEWCrhRBjjVstv5QnAJvgln1jgOfgui+rjl1ExnqDnWKg9uaZ5jtGROH/cwabg==",
"license": "MIT",
"dependencies": {
"@babel/runtime": "^7.12.5",
"@noble/ed25519": "^1.7.0",
"@noble/hashes": "^1.1.2",
"@noble/secp256k1": "^1.6.3",
"@solana/buffer-layout": "^4.0.0",
"agentkeepalive": "^4.2.1",
"bigint-buffer": "^1.1.5",
"bn.js": "^5.0.0",
"borsh": "^0.7.0",
"bs58": "^4.0.1",
"buffer": "6.0.1",
"fast-stable-stringify": "^1.0.0",
"jayson": "^3.4.4",
"node-fetch": "^2.6.7",
"rpc-websockets": "^7.5.1",
"superstruct": "^0.14.2"
}
},
"node_modules/@types/chai": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.4.tgz",
"integrity": "sha512-KnRanxnpfpjUTqTCXslZSEdLfXExwgNxYPdiO2WGUj8+HDjFi8R3k5RVKPeSCzLjCcshCAtVO2QBbVuAV4kTnw==",
"dev": true,
"license": "MIT"
},
"node_modules/@types/connect": {
"version": "3.4.35",
"resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz",
"integrity": "sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==",
"license": "MIT",
"dependencies": {
"@types/node": "*"
}
},
"node_modules/@types/json5": {
"version": "0.0.29",
"resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
"integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==",
"dev": true,
"license": "MIT",
"optional": true
},
"node_modules/@types/mocha": {
"version": "10.0.1",
"resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.1.tgz",
"integrity": "sha512-/fvYntiO1GeICvqbQ3doGDIP97vWmvFt83GKguJ6prmQM2iXZfFcq6YE8KteFyRtX2/h5Hf91BYvPodJKFYv5Q==",
"dev": true,
"license": "MIT"
},
"node_modules/@types/node": {
"version": "18.15.11",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.11.tgz",
"integrity": "sha512-E5Kwq2n4SbMzQOn6wnmBjuK9ouqlURrcZDVfbo9ftDDTFt3nk7ZKK4GMOzoYgnpQJKcxwQw+lGaBvvlMo0qN/Q==",
"license": "MIT"
},
"node_modules/@types/node-fetch": {
"version": "2.6.3",
"resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.3.tgz",
"integrity": "sha512-ETTL1mOEdq/sxUtgtOhKjyB2Irra4cjxksvcMUR5Zr4n+PxVhsCD9WS46oPbHL3et9Zde7CNRr+WUNlcHvsX+w==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/node": "*",
"form-data": "^3.0.0"
}
},
"node_modules/@types/ws": {
"version": "7.4.7",
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.4.7.tgz",
"integrity": "sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==",
"license": "MIT",
"dependencies": {
"@types/node": "*"
}
},
"node_modules/agentkeepalive": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.3.0.tgz",
"integrity": "sha512-7Epl1Blf4Sy37j4v9f9FjICCh4+KAQOyXgHEwlyBiAQLbhKdq/i2QQU3amQalS/wPhdPzDXPL5DMR5bkn+YeWg==",
"license": "MIT",
"dependencies": {
"debug": "^4.1.0",
"depd": "^2.0.0",
"humanize-ms": "^1.2.1"
},
"engines": {
"node": ">= 8.0.0"
}
},
"node_modules/ansi-colors": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz",
"integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=6"
}
},
"node_modules/ansi-regex": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8"
}
},
"node_modules/ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"license": "MIT",
"dependencies": {
"color-convert": "^2.0.1"
},
"engines": {
"node": ">=8"
},
"funding": {
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
}
},
"node_modules/anymatch": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",
"integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==",
"dev": true,
"license": "ISC",
"dependencies": {
"normalize-path": "^3.0.0",
"picomatch": "^2.0.4"
},
"engines": {
"node": ">= 8"
}
},
"node_modules/argparse": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
"dev": true,
"license": "Python-2.0"
},
"node_modules/arrify": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz",
"integrity": "sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
"dev": true,
"license": "MIT"
},
"node_modules/balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
"dev": true,
"license": "MIT"
},
"node_modules/base-x": {
"version": "3.0.9",
"resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz",
"integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==",
"license": "MIT",
"dependencies": {
"safe-buffer": "^5.0.1"
}
},
"node_modules/base64-js": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"license": "MIT"
},
"node_modules/big-integer": {
"version": "1.6.51",
"resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz",
"integrity": "sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==",
"license": "Unlicense",
"engines": {
"node": ">=0.6"
}
},
"node_modules/bigint-buffer": {
"version": "1.1.5",
"resolved": "https://registry.npmjs.org/bigint-buffer/-/bigint-buffer-1.1.5.tgz",
"integrity": "sha512-trfYco6AoZ+rKhKnxA0hgX0HAbVP/s808/EuDSe2JDzUnCp/xAsli35Orvk67UrTEcwuxZqYZDmfA2RXJgxVvA==",
"hasInstallScript": true,
"license": "Apache-2.0",
"dependencies": {
"bindings": "^1.3.0"
},
"engines": {
"node": ">= 10.0.0"
}
},
"node_modules/binary-extensions": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
"integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8"
}
},
"node_modules/bindings": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
"integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
"license": "MIT",
"dependencies": {
"file-uri-to-path": "1.0.0"
}
},
"node_modules/bn.js": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz",
"integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==",
"license": "MIT"
},
"node_modules/borsh": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/borsh/-/borsh-0.7.0.tgz",
"integrity": "sha512-CLCsZGIBCFnPtkNnieW/a8wmreDmfUtjU2m9yHrzPXIlNbqVs0AQrSatSG6vdNYUqdc83tkQi2eHfF98ubzQLA==",
"license": "Apache-2.0",
"dependencies": {
"bn.js": "^5.2.0",
"bs58": "^4.0.0",
"text-encoding-utf-8": "^1.0.2"
}
},
"node_modules/brace-expansion": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
"dev": true,
"license": "MIT",
"dependencies": {
"balanced-match": "^1.0.0"
}
},
"node_modules/braces": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
"dev": true,
"license": "MIT",
"dependencies": {
"fill-range": "^7.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/browser-stdout": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz",
"integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==",
"dev": true,
"license": "ISC"
},
"node_modules/bs58": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz",
"integrity": "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==",
"license": "MIT",
"dependencies": {
"base-x": "^3.0.2"
}
},
"node_modules/buffer": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.1.tgz",
"integrity": "sha512-rVAXBwEcEoYtxnHSO5iWyhzV/O1WMtkUYWlfdLS7FjU4PnSJJHEfHXi/uHPI5EwltmOA794gN3bm3/pzuctWjQ==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"license": "MIT",
"dependencies": {
"base64-js": "^1.3.1",
"ieee754": "^1.2.1"
}
},
"node_modules/buffer-from": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
"integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==",
"dev": true,
"license": "MIT"
},
"node_modules/bufferutil": {
"version": "4.0.7",
"resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.7.tgz",
"integrity": "sha512-kukuqc39WOHtdxtw4UScxF/WVnMFVSQVKhtx3AjZJzhd0RGZZldcrfSEbVsWWe6KNH253574cq5F+wpv0G9pJw==",
"hasInstallScript": true,
"license": "MIT",
"optional": true,
"dependencies": {
"node-gyp-build": "^4.3.0"
},
"engines": {
"node": ">=6.14.2"
}
},
"node_modules/camelcase": {
"version": "6.3.0",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz",
"integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dev": true,
"license": "MIT",
"dependencies": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/chalk/chalk?sponsor=1"
}
},
"node_modules/chalk/node_modules/supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dev": true,
"license": "MIT",
"dependencies": {
"has-flag": "^4.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/chokidar": {
"version": "3.5.3",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz",
"integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==",
"dev": true,
"funding": [
{
"type": "individual",
"url": "https://paulmillr.com/funding/"
}
],
"license": "MIT",
"dependencies": {
"anymatch": "~3.1.2",
"braces": "~3.0.2",
"glob-parent": "~5.1.2",
"is-binary-path": "~2.1.0",
"is-glob": "~4.0.1",
"normalize-path": "~3.0.0",
"readdirp": "~3.6.0"
},
"engines": {
"node": ">= 8.10.0"
},
"optionalDependencies": {
"fsevents": "~2.3.2"
}
},
"node_modules/cliui": {
"version": "7.0.4",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz",
"integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==",
"dev": true,
"license": "ISC",
"dependencies": {
"string-width": "^4.2.0",
"strip-ansi": "^6.0.0",
"wrap-ansi": "^7.0.0"
}
},
"node_modules/color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"color-name": "~1.1.4"
},
"engines": {
"node": ">=7.0.0"
}
},
"node_modules/color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true,
"license": "MIT"
},
"node_modules/combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
"dev": true,
"license": "MIT",
"dependencies": {
"delayed-stream": "~1.0.0"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/commander": {
"version": "2.20.3",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
"license": "MIT"
},
"node_modules/concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
"dev": true,
"license": "MIT"
},
"node_modules/debug": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
"license": "MIT",
"dependencies": {
"ms": "2.1.2"
},
"engines": {
"node": ">=6.0"
},
"peerDependenciesMeta": {
"supports-color": {
"optional": true
}
}
},
"node_modules/debug/node_modules/ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
"license": "MIT"
},
"node_modules/decamelize": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz",
"integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/delay": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/delay/-/delay-5.0.0.tgz",
"integrity": "sha512-ReEBKkIfe4ya47wlPYf/gu5ib6yUG0/Aez0JQZQz94kiWtRQvZIQbTiehsnwHvLSWJnQdhVeqYue7Id1dKr0qw==",
"license": "MIT",
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=0.4.0"
}
},
"node_modules/depd": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
"integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/diff": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz",
"integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==",
"dev": true,
"license": "BSD-3-Clause",
"engines": {
"node": ">=0.3.1"
}
},
"node_modules/emoji-regex": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
"dev": true,
"license": "MIT"
},
"node_modules/es6-promise": {
"version": "4.2.8",
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz",
"integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==",
"license": "MIT"
},
"node_modules/es6-promisify": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz",
"integrity": "sha512-C+d6UdsYDk0lMebHNR4S2NybQMMngAOnOwYBQjTOiv0MkoJMP0Myw2mgpDLBcpfCmRLxyFqYhS/CfOENq4SJhQ==",
"license": "MIT",
"dependencies": {
"es6-promise": "^4.0.3"
}
},
"node_modules/escalade": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz",
"integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=6"
}
},
"node_modules/escape-string-regexp": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
"integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/eventemitter3": {
"version": "4.0.7",
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz",
"integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==",
"license": "MIT"
},
"node_modules/eyes": {
"version": "0.1.8",
"resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz",
"integrity": "sha512-GipyPsXO1anza0AOZdy69Im7hGFCNB7Y/NGjDlZGJ3GJJLtwNSb2vrzYrTYJRrRloVx7pl+bhUaTB8yiccPvFQ==",
"engines": {
"node": "> 0.1.90"
}
},
"node_modules/fast-stable-stringify": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fast-stable-stringify/-/fast-stable-stringify-1.0.0.tgz",
"integrity": "sha512-wpYMUmFu5f00Sm0cj2pfivpmawLZ0NKdviQ4w9zJeR8JVtOpOxHmLaJuj0vxvGqMJQWyP/COUkF75/57OKyRag==",
"license": "MIT"
},
"node_modules/file-uri-to-path": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
"integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==",
"license": "MIT"
},
"node_modules/fill-range": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"to-regex-range": "^5.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/find-up": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
"integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==",
"dev": true,
"license": "MIT",
"dependencies": {
"locate-path": "^6.0.0",
"path-exists": "^4.0.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/flat": {
"version": "5.0.2",
"resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz",
"integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==",
"dev": true,
"license": "BSD-3-Clause",
"bin": {
"flat": "cli.js"
}
},
"node_modules/form-data": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz",
"integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==",
"dev": true,
"license": "MIT",
"dependencies": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/fs": {
"version": "0.0.1-security",
"resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz",
"integrity": "sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w==",
"dev": true,
"license": "ISC"
},
"node_modules/fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==",
"dev": true,
"license": "ISC"
},
"node_modules/fsevents": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
}
},
"node_modules/get-caller-file": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
"dev": true,
"license": "ISC",
"engines": {
"node": "6.* || 8.* || >= 10.*"
}
},
"node_modules/glob": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz",
"integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==",
"dev": true,
"license": "ISC",
"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"
},
"engines": {
"node": "*"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/glob-parent": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
"integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
"dev": true,
"license": "ISC",
"dependencies": {
"is-glob": "^4.0.1"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/glob/node_modules/brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dev": true,
"license": "MIT",
"dependencies": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
"node_modules/glob/node_modules/minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"dev": true,
"license": "ISC",
"dependencies": {
"brace-expansion": "^1.1.7"
},
"engines": {
"node": "*"
}
},
"node_modules/has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8"
}
},
"node_modules/he": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz",
"integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==",
"dev": true,
"license": "MIT",
"bin": {
"he": "bin/he"
}
},
"node_modules/humanize-ms": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz",
"integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==",
"license": "MIT",
"dependencies": {
"ms": "^2.0.0"
}
},
"node_modules/ieee754": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
"integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"license": "BSD-3-Clause"
},
"node_modules/inflight": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
"integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==",
"dev": true,
"license": "ISC",
"dependencies": {
"once": "^1.3.0",
"wrappy": "1"
}
},
"node_modules/inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
"dev": true,
"license": "ISC"
},
"node_modules/is-binary-path": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
"integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
"dev": true,
"license": "MIT",
"dependencies": {
"binary-extensions": "^2.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/is-extglob": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
"integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8"
}
},
"node_modules/is-glob": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
"integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
"dev": true,
"license": "MIT",
"dependencies": {
"is-extglob": "^2.1.1"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/is-number": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=0.12.0"
}
},
"node_modules/is-plain-obj": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz",
"integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8"
}
},
"node_modules/is-unicode-supported": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz",
"integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/isomorphic-ws": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz",
"integrity": "sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==",
"license": "MIT",
"peerDependencies": {
"ws": "*"
}
},
"node_modules/jayson": {
"version": "3.7.0",
"resolved": "https://registry.npmjs.org/jayson/-/jayson-3.7.0.tgz",
"integrity": "sha512-tfy39KJMrrXJ+mFcMpxwBvFDetS8LAID93+rycFglIQM4kl3uNR3W4lBLE/FFhsoUCEox5Dt2adVpDm/XtebbQ==",
"license": "MIT",
"dependencies": {
"@types/connect": "^3.4.33",
"@types/node": "^12.12.54",
"@types/ws": "^7.4.4",
"commander": "^2.20.3",
"delay": "^5.0.0",
"es6-promisify": "^5.0.0",
"eyes": "^0.1.8",
"isomorphic-ws": "^4.0.1",
"json-stringify-safe": "^5.0.1",
"JSONStream": "^1.3.5",
"lodash": "^4.17.20",
"uuid": "^8.3.2",
"ws": "^7.4.5"
},
"bin": {
"jayson": "bin/jayson.js"
},
"engines": {
"node": ">=8"
}
},
"node_modules/jayson/node_modules/@types/node": {
"version": "12.20.55",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz",
"integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==",
"license": "MIT"
},
"node_modules/js-yaml": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
"integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
"dev": true,
"license": "MIT",
"dependencies": {
"argparse": "^2.0.1"
},
"bin": {
"js-yaml": "bin/js-yaml.js"
}
},
"node_modules/json-stringify-safe": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
"integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==",
"license": "ISC"
},
"node_modules/json5": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz",
"integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
"minimist": "^1.2.0"
},
"bin": {
"json5": "lib/cli.js"
}
},
"node_modules/jsonparse": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz",
"integrity": "sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==",
"engines": [
"node >= 0.2.0"
],
"license": "MIT"
},
"node_modules/JSONStream": {
"version": "1.3.5",
"resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz",
"integrity": "sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==",
"license": "(MIT OR Apache-2.0)",
"dependencies": {
"jsonparse": "^1.2.0",
"through": ">=2.2.7 <3"
},
"bin": {
"JSONStream": "bin.js"
},
"engines": {
"node": "*"
}
},
"node_modules/locate-path": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz",
"integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==",
"dev": true,
"license": "MIT",
"dependencies": {
"p-locate": "^5.0.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/lodash": {
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
"license": "MIT"
},
"node_modules/log-symbols": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz",
"integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==",
"dev": true,
"license": "MIT",
"dependencies": {
"chalk": "^4.1.0",
"is-unicode-supported": "^0.1.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/make-error": {
"version": "1.3.6",
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
"integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==",
"dev": true,
"license": "ISC"
},
"node_modules/mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mime-types": {
"version": "2.1.35",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"dev": true,
"license": "MIT",
"dependencies": {
"mime-db": "1.52.0"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/minimatch": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz",
"integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==",
"dev": true,
"license": "ISC",
"dependencies": {
"brace-expansion": "^2.0.1"
},
"engines": {
"node": ">=10"
}
},
"node_modules/minimist": {
"version": "1.2.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
"dev": true,
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/mkdirp": {
"version": "0.5.6",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz",
"integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==",
"dev": true,
"license": "MIT",
"dependencies": {
"minimist": "^1.2.6"
},
"bin": {
"mkdirp": "bin/cmd.js"
}
},
"node_modules/mocha": {
"version": "10.2.0",
"resolved": "https://registry.npmjs.org/mocha/-/mocha-10.2.0.tgz",
"integrity": "sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==",
"dev": true,
"license": "MIT",
"dependencies": {
"ansi-colors": "4.1.1",
"browser-stdout": "1.3.1",
"chokidar": "3.5.3",
"debug": "4.3.4",
"diff": "5.0.0",
"escape-string-regexp": "4.0.0",
"find-up": "5.0.0",
"glob": "7.2.0",
"he": "1.2.0",
"js-yaml": "4.1.0",
"log-symbols": "4.1.0",
"minimatch": "5.0.1",
"ms": "2.1.3",
"nanoid": "3.3.3",
"serialize-javascript": "6.0.0",
"strip-json-comments": "3.1.1",
"supports-color": "8.1.1",
"workerpool": "6.2.1",
"yargs": "16.2.0",
"yargs-parser": "20.2.4",
"yargs-unparser": "2.0.0"
},
"bin": {
"_mocha": "bin/_mocha",
"mocha": "bin/mocha.js"
},
"engines": {
"node": ">= 14.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/mochajs"
}
},
"node_modules/ms": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
"license": "MIT"
},
"node_modules/nanoid": {
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz",
"integrity": "sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w==",
"dev": true,
"license": "MIT",
"bin": {
"nanoid": "bin/nanoid.cjs"
},
"engines": {
"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
}
},
"node_modules/node-fetch": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.9.tgz",
"integrity": "sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==",
"license": "MIT",
"dependencies": {
"whatwg-url": "^5.0.0"
},
"engines": {
"node": "4.x || >=6.0.0"
},
"peerDependencies": {
"encoding": "^0.1.0"
},
"peerDependenciesMeta": {
"encoding": {
"optional": true
}
}
},
"node_modules/node-gyp-build": {
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.6.0.tgz",
"integrity": "sha512-NTZVKn9IylLwUzaKjkas1e4u2DLNcV4rdYagA4PWdPwW87Bi7z+BznyKSRwS/761tV/lzCGXplWsiaMjLqP2zQ==",
"license": "MIT",
"optional": true,
"bin": {
"node-gyp-build": "bin.js",
"node-gyp-build-optional": "optional.js",
"node-gyp-build-test": "build-test.js"
}
},
"node_modules/node-sql-parser": {
"version": "4.6.6",
"resolved": "https://registry.npmjs.org/node-sql-parser/-/node-sql-parser-4.6.6.tgz",
"integrity": "sha512-zpash5xnRY6+0C9HFru32iRJV1LTkwtrVpO90i385tYVF6efyXK/B3Nsq/15Fuv2utxrqHNjKtL55OHb8sl+eQ==",
"license": "GPLv2",
"dependencies": {
"big-integer": "^1.6.48"
},
"engines": {
"node": ">=8"
}
},
"node_modules/normalize-path": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
"integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
"dev": true,
"license": "ISC",
"dependencies": {
"wrappy": "1"
}
},
"node_modules/p-limit": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz",
"integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"yocto-queue": "^0.1.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/p-locate": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz",
"integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==",
"dev": true,
"license": "MIT",
"dependencies": {
"p-limit": "^3.0.2"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/path-exists": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
"integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8"
}
},
"node_modules/path-is-absolute": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
"integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/picomatch": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
"integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8.6"
},
"funding": {
"url": "https://github.com/sponsors/jonschlinkert"
}
},
"node_modules/randombytes": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz",
"integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"safe-buffer": "^5.1.0"
}
},
"node_modules/readdirp": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
"integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
"dev": true,
"license": "MIT",
"dependencies": {
"picomatch": "^2.2.1"
},
"engines": {
"node": ">=8.10.0"
}
},
"node_modules/regenerator-runtime": {
"version": "0.13.11",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz",
"integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==",
"license": "MIT"
},
"node_modules/require-directory": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
"integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/rpc-websockets": {
"version": "7.5.1",
"resolved": "https://registry.npmjs.org/rpc-websockets/-/rpc-websockets-7.5.1.tgz",
"integrity": "sha512-kGFkeTsmd37pHPMaHIgN1LVKXMi0JD782v4Ds9ZKtLlwdTKjn+CxM9A9/gLT2LaOuEcEFGL98h1QWQtlOIdW0w==",
"license": "LGPL-3.0-only",
"dependencies": {
"@babel/runtime": "^7.17.2",
"eventemitter3": "^4.0.7",
"uuid": "^8.3.2",
"ws": "^8.5.0"
},
"funding": {
"type": "paypal",
"url": "https://paypal.me/kozjak"
},
"optionalDependencies": {
"bufferutil": "^4.0.1",
"utf-8-validate": "^5.0.2"
}
},
"node_modules/rpc-websockets/node_modules/ws": {
"version": "8.13.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz",
"integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==",
"license": "MIT",
"engines": {
"node": ">=10.0.0"
},
"peerDependencies": {
"bufferutil": "^4.0.1",
"utf-8-validate": ">=5.0.2"
},
"peerDependenciesMeta": {
"bufferutil": {
"optional": true
},
"utf-8-validate": {
"optional": true
}
}
},
"node_modules/safe-buffer": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
],
"license": "MIT"
},
"node_modules/serialize-javascript": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz",
"integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==",
"dev": true,
"license": "BSD-3-Clause",
"dependencies": {
"randombytes": "^2.1.0"
}
},
"node_modules/source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true,
"license": "BSD-3-Clause",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/source-map-support": {
"version": "0.5.21",
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz",
"integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==",
"dev": true,
"license": "MIT",
"dependencies": {
"buffer-from": "^1.0.0",
"source-map": "^0.6.0"
}
},
"node_modules/string-width": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"dev": true,
"license": "MIT",
"dependencies": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
"strip-ansi": "^6.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/strip-ansi": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"dev": true,
"license": "MIT",
"dependencies": {
"ansi-regex": "^5.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/strip-bom": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz",
"integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==",
"dev": true,
"license": "MIT",
"optional": true,
"engines": {
"node": ">=4"
}
},
"node_modules/strip-json-comments": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz",
"integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/superstruct": {
"version": "0.14.2",
"resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.14.2.tgz",
"integrity": "sha512-nPewA6m9mR3d6k7WkZ8N8zpTWfenFH3q9pA2PkuiZxINr9DKB2+40wEQf0ixn8VaGuJ78AB6iWOtStI+/4FKZQ==",
"license": "MIT"
},
"node_modules/supports-color": {
"version": "8.1.1",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz",
"integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==",
"dev": true,
"license": "MIT",
"dependencies": {
"has-flag": "^4.0.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/chalk/supports-color?sponsor=1"
}
},
"node_modules/text-encoding-utf-8": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/text-encoding-utf-8/-/text-encoding-utf-8-1.0.2.tgz",
"integrity": "sha512-8bw4MY9WjdsD2aMtO0OzOCY3pXGYNx2d2FfHRVUKkiCPDWjKuOlhLVASS+pD7VkLTVjW268LYJHwsnPFlBpbAg=="
},
"node_modules/through": {
"version": "2.3.8",
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
"integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==",
"license": "MIT"
},
"node_modules/to-regex-range": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"is-number": "^7.0.0"
},
"engines": {
"node": ">=8.0"
}
},
"node_modules/tr46": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
"integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==",
"license": "MIT"
},
"node_modules/ts-mocha": {
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/ts-mocha/-/ts-mocha-10.0.0.tgz",
"integrity": "sha512-VRfgDO+iiuJFlNB18tzOfypJ21xn2xbuZyDvJvqpTbWgkAgD17ONGr8t+Tl8rcBtOBdjXp5e/Rk+d39f7XBHRw==",
"dev": true,
"license": "MIT",
"dependencies": {
"ts-node": "7.0.1"
},
"bin": {
"ts-mocha": "bin/ts-mocha"
},
"engines": {
"node": ">= 6.X.X"
},
"optionalDependencies": {
"tsconfig-paths": "^3.5.0"
},
"peerDependencies": {
"mocha": "^3.X.X || ^4.X.X || ^5.X.X || ^6.X.X || ^7.X.X || ^8.X.X || ^9.X.X || ^10.X.X"
}
},
"node_modules/ts-node": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-7.0.1.tgz",
"integrity": "sha512-BVwVbPJRspzNh2yfslyT1PSbl5uIk03EZlb493RKHN4qej/D06n1cEhjlOJG69oFsE7OT8XjpTUcYf6pKTLMhw==",
"dev": true,
"license": "MIT",
"dependencies": {
"arrify": "^1.0.0",
"buffer-from": "^1.1.0",
"diff": "^3.1.0",
"make-error": "^1.1.1",
"minimist": "^1.2.0",
"mkdirp": "^0.5.1",
"source-map-support": "^0.5.6",
"yn": "^2.0.0"
},
"bin": {
"ts-node": "dist/bin.js"
},
"engines": {
"node": ">=4.2.0"
}
},
"node_modules/ts-node/node_modules/diff": {
"version": "3.5.0",
"resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz",
"integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==",
"dev": true,
"license": "BSD-3-Clause",
"engines": {
"node": ">=0.3.1"
}
},
"node_modules/tsconfig-paths": {
"version": "3.14.2",
"resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz",
"integrity": "sha512-o/9iXgCYc5L/JxCHPe3Hvh8Q/2xm5Z+p18PESBU6Ff33695QnCHBEjcytY2q19ua7Mbl/DavtBOLq+oG0RCL+g==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
"@types/json5": "^0.0.29",
"json5": "^1.0.2",
"minimist": "^1.2.6",
"strip-bom": "^3.0.0"
}
},
"node_modules/typescript": {
"version": "4.9.5",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz",
"integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==",
"dev": true,
"license": "Apache-2.0",
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=4.2.0"
}
},
"node_modules/utf-8-validate": {
"version": "5.0.10",
"resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz",
"integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==",
"hasInstallScript": true,
"license": "MIT",
"optional": true,
"dependencies": {
"node-gyp-build": "^4.3.0"
},
"engines": {
"node": ">=6.14.2"
}
},
"node_modules/uuid": {
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
"license": "MIT",
"bin": {
"uuid": "dist/bin/uuid"
}
},
"node_modules/webidl-conversions": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
"integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==",
"license": "BSD-2-Clause"
},
"node_modules/whatwg-url": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
"integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
"license": "MIT",
"dependencies": {
"tr46": "~0.0.3",
"webidl-conversions": "^3.0.0"
}
},
"node_modules/workerpool": {
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz",
"integrity": "sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==",
"dev": true,
"license": "Apache-2.0"
},
"node_modules/wrap-ansi": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
"integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
"dev": true,
"license": "MIT",
"dependencies": {
"ansi-styles": "^4.0.0",
"string-width": "^4.1.0",
"strip-ansi": "^6.0.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
}
},
"node_modules/wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
"dev": true,
"license": "ISC"
},
"node_modules/ws": {
"version": "7.5.9",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz",
"integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==",
"license": "MIT",
"engines": {
"node": ">=8.3.0"
},
"peerDependencies": {
"bufferutil": "^4.0.1",
"utf-8-validate": "^5.0.2"
},
"peerDependenciesMeta": {
"bufferutil": {
"optional": true
},
"utf-8-validate": {
"optional": true
}
}
},
"node_modules/y18n": {
"version": "5.0.8",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
"integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",
"dev": true,
"license": "ISC",
"engines": {
"node": ">=10"
}
},
"node_modules/yargs": {
"version": "16.2.0",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz",
"integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==",
"dev": true,
"license": "MIT",
"dependencies": {
"cliui": "^7.0.2",
"escalade": "^3.1.1",
"get-caller-file": "^2.0.5",
"require-directory": "^2.1.1",
"string-width": "^4.2.0",
"y18n": "^5.0.5",
"yargs-parser": "^20.2.2"
},
"engines": {
"node": ">=10"
}
},
"node_modules/yargs-parser": {
"version": "20.2.4",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz",
"integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==",
"dev": true,
"license": "ISC",
"engines": {
"node": ">=10"
}
},
"node_modules/yargs-unparser": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz",
"integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==",
"dev": true,
"license": "MIT",
"dependencies": {
"camelcase": "^6.0.0",
"decamelize": "^4.0.0",
"flat": "^5.0.2",
"is-plain-obj": "^2.1.0"
},
"engines": {
"node": ">=10"
}
},
"node_modules/yargs/node_modules/yargs-parser": {
"version": "20.2.9",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz",
"integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==",
"dev": true,
"license": "ISC",
"engines": {
"node": ">=10"
}
},
"node_modules/yn": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/yn/-/yn-2.0.0.tgz",
"integrity": "sha512-uTv8J/wiWTgUTg+9vLTi//leUl5vDQS6uii/emeTb2ssY7vl6QWf2fFbIIGjnhjvbdKlU0ed7QPgY1htTC86jQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=4"
}
},
"node_modules/yocto-queue": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
"integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
}
}
}
| 0
|
solana_public_repos/nautilus-project/nautilus
|
solana_public_repos/nautilus-project/nautilus/js/package.json
|
{
"name": "nautilus-js",
"version": "0.0.1",
"description": "SQL server for Solana",
"main": "index.js",
"repository": "https://github.com/realbuffalojoe/nautilus",
"author": "Joe Caulfield",
"license": "MIT",
"private": true,
"dependencies": {
"@solana/web3.js": "^1.73.2",
"node-sql-parser": "^4.6.5"
},
"devDependencies": {
"@types/chai": "^4.3.4",
"@types/mocha": "^10.0.1",
"@types/node-fetch": "^2.6.2",
"fs": "^0.0.1-security",
"mocha": "^10.1.0",
"ts-mocha": "^10.0.0",
"typescript": "^4.9.3"
},
"scripts": {
"test": "yarn run ts-mocha -p ./tests/tsconfig.test.json -t 1000000 ./tests/main.test.ts",
"build": "tsc"
}
}
| 0
|
solana_public_repos/nautilus-project/nautilus
|
solana_public_repos/nautilus-project/nautilus/js/tsconfig.json
|
{
"compilerOptions": {
"target": "es2021",
"module": "commonjs",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"outDir": "./dist",
},
"exclude": ["./tests"]
}
| 0
|
solana_public_repos/nautilus-project/nautilus/js
|
solana_public_repos/nautilus-project/nautilus/js/idl/program_shank.json
|
{
"version": "0.1.0",
"name": "program_shank",
"instructions": [
{
"name": "CreatePerson",
"accounts": [
{
"name": "autoincAccount",
"isMut": true,
"isSigner": false,
"desc": "The account for autoincrementing this table"
},
{
"name": "newAccount",
"isMut": true,
"isSigner": false,
"desc": "The account that will represent the Person being created"
},
{
"name": "authority",
"isMut": false,
"isSigner": true,
"desc": "Record authority"
},
{
"name": "feePayer",
"isMut": true,
"isSigner": true,
"desc": "Fee payer"
},
{
"name": "systemProgram",
"isMut": false,
"isSigner": false,
"desc": "The System Program"
}
],
"args": [
{
"name": "createPersonArgs",
"type": {
"defined": "CreatePersonArgs"
}
}
],
"discriminant": {
"type": "u8",
"value": 0
}
},
{
"name": "DeletePerson",
"accounts": [
{
"name": "targetAccount",
"isMut": true,
"isSigner": false,
"desc": "The account that will represent the Person being deleted"
},
{
"name": "authority",
"isMut": false,
"isSigner": true,
"desc": "Record authority"
},
{
"name": "feePayer",
"isMut": true,
"isSigner": true,
"desc": "Fee payer"
}
],
"args": [],
"discriminant": {
"type": "u8",
"value": 1
}
},
{
"name": "UpdatePerson",
"accounts": [
{
"name": "newAccount",
"isMut": true,
"isSigner": false,
"desc": "The account that will represent the Person being updated"
},
{
"name": "authority",
"isMut": false,
"isSigner": true,
"desc": "Record authority"
},
{
"name": "feePayer",
"isMut": true,
"isSigner": true,
"desc": "Fee payer"
},
{
"name": "systemProgram",
"isMut": false,
"isSigner": false,
"desc": "The System Program"
}
],
"args": [
{
"name": "updatePersonArgs",
"type": {
"defined": "UpdatePersonArgs"
}
}
],
"discriminant": {
"type": "u8",
"value": 2
}
}
],
"accounts": [
{
"name": "Person",
"type": {
"kind": "struct",
"fields": [
{
"name": "id",
"type": "u32"
},
{
"name": "name",
"type": "string"
},
{
"name": "authority",
"type": "publicKey"
}
]
}
}
],
"types": [
{
"name": "CreatePersonArgs",
"type": {
"kind": "struct",
"fields": [
{
"name": "id",
"type": "u32"
},
{
"name": "name",
"type": "string"
},
{
"name": "authority",
"type": "publicKey"
}
]
}
},
{
"name": "UpdatePersonArgs",
"type": {
"kind": "struct",
"fields": [
{
"name": "id",
"type": "u32"
},
{
"name": "name",
"type": {
"option": "string"
}
},
{
"name": "authority",
"type": {
"option": "publicKey"
}
}
]
}
}
],
"metadata": {
"origin": "shank",
"address": "45A6jtRE6Tr71EpRATyWF8FYUNP7LEZ7NFd3Xb9LJ4TR"
}
}
| 0
|
solana_public_repos/nautilus-project/nautilus/js
|
solana_public_repos/nautilus-project/nautilus/js/tests/instantiate.test.ts
|
import assert from "assert"
import { describe, it } from "mocha"
import { Nautilus } from "../src"
import { CONNECTION, PROGRAM_ID, PROGRAM_ID_STRING } from "./main.test"
export function tests() {
describe("[Unit Tests]: Instantiating", () => {
function canInstantiate(method: string, nautilus: Nautilus) {
it(` -- Can instantiate: ${method}`, () => assert(nautilus))
}
canInstantiate(
"string | no default program",
new Nautilus(CONNECTION, PROGRAM_ID_STRING),
)
canInstantiate(
"string | with default program",
new Nautilus(CONNECTION, PROGRAM_ID_STRING, PROGRAM_ID),
)
canInstantiate(
"pubkey | no default program",
new Nautilus(CONNECTION, PROGRAM_ID),
)
canInstantiate(
"pubkey | with default program",
new Nautilus(CONNECTION, PROGRAM_ID, PROGRAM_ID),
)
canInstantiate(
"single-list | no default program",
new Nautilus(CONNECTION, [[PROGRAM_ID, "person-program"]]),
)
canInstantiate(
"single-list | with default program | string arg",
new Nautilus(
CONNECTION,
[[PROGRAM_ID, "person-program"]],
"person-program",
),
)
canInstantiate(
"single-list | with default program | PublicKey arg",
new Nautilus(
CONNECTION,
[[PROGRAM_ID, "person-program"]],
PROGRAM_ID,
),
)
canInstantiate(
"multiple-list | no default program",
new Nautilus(
CONNECTION,
[
[PROGRAM_ID, "person-program"],
[PROGRAM_ID, "person-program-2"],
],
),
)
canInstantiate(
"multiple-list | with default program | string arg",
new Nautilus(
CONNECTION,
[
[PROGRAM_ID, "person-program"],
[PROGRAM_ID, "person-program-2"],
],
"person-program",
),
)
canInstantiate(
"multiple-list | with default program | PublicKey arg",
new Nautilus(
CONNECTION,
[
[PROGRAM_ID, "person-program"],
[PROGRAM_ID, "person-program-2"],
],
PROGRAM_ID,
),
)
})
}
| 0
|
solana_public_repos/nautilus-project/nautilus/js
|
solana_public_repos/nautilus-project/nautilus/js/tests/tsconfig.test.json
|
{
"compilerOptions": {
"types": ["mocha", "chai"],
"typeRoots": ["./node_modules/@types"],
"lib": ["es2021"],
"module": "commonjs",
"target": "es6",
"esModuleInterop": true
}
}
| 0
|
solana_public_repos/nautilus-project/nautilus/js
|
solana_public_repos/nautilus-project/nautilus/js/tests/sql-parse.test.ts
|
import assert from "assert"
import { describe, it } from "mocha"
import { Nautilus } from "../src"
import { CONNECTION, PROGRAM_ID } from "./main.test"
export function tests() {
describe("[Unit Tests]: SQL Parsing", () => {
const nautilus = new Nautilus(CONNECTION, PROGRAM_ID);
function testParseSql(input: string) {
it(` -- Can parse: ${input}`, () => assert(input = nautilus.sql(input).dumpSql()))
}
testParseSql(
"SELECT * FROM person"
)
testParseSql(
"SELECT id, name FROM person"
)
testParseSql(
"SELECT * FROM person WHERE name = 'Joe'"
)
testParseSql(
"SELECT (id, name) FROM person WHERE name = 'Joe'"
)
testParseSql(
"SELECT * FROM person WHERE id = 1 AND name = 'Joe'"
)
testParseSql(
"SELECT (id, name) FROM person WHERE id = 1 AND name = 'Joe'"
)
testParseSql(
"SELECT * FROM person WHERE id = 1 AND name = 'Joe' AND authority = 'Joe'"
)
testParseSql(
"SELECT (id, name) FROM person WHERE id = 1 AND name = 'Joe' AND authority = 'Joe'"
)
testParseSql(
"SELECT * FROM person ORDER BY name ASC"
)
testParseSql(
"SELECT (id, name) FROM person ORDER BY name ASC"
)
testParseSql(
"SELECT * FROM person WHERE name = 'Joe' ORDER BY name ASC"
)
testParseSql(
"SELECT (id, name) FROM person WHERE name = 'Joe' ORDER BY name ASC"
)
testParseSql(
"SELECT * FROM person WHERE id = 1 AND name = 'Joe' ORDER BY name ASC"
)
testParseSql(
"SELECT (id, name) FROM person WHERE id = 1 AND name = 'Joe' ORDER BY name ASC"
)
testParseSql(
"SELECT * FROM person ORDER BY id DESC, name ASC"
)
testParseSql(
"SELECT (id, name) FROM person ORDER BY id DESC, name ASC"
)
testParseSql(
"SELECT * FROM person WHERE name = 'Joe' ORDER BY id DESC, name ASC"
)
testParseSql(
"SELECT (id, name) FROM person WHERE name = 'Joe' ORDER BY id DESC, name ASC"
)
testParseSql(
"SELECT * FROM person WHERE id = 1 AND name = 'Joe' ORDER BY id DESC, name ASC"
)
testParseSql(
"SELECT (id, name) FROM person WHERE id = 1 AND name = 'Joe' ORDER BY id DESC, name ASC"
)
testParseSql(
"SELECT id, name FROM person; SELECT id, name from heroes"
)
testParseSql(
"INSERT INTO person VALUES ('Paul', 'none')"
)
testParseSql(
"INSERT INTO person (name, authority) VALUES ('Paul', 'none')"
)
testParseSql(
"INSERT INTO person VALUES ('Paul', 'none'), ('John', 'none')"
)
testParseSql(
"INSERT INTO person (name, authority) VALUES ('Paul', 'none'), ('John', 'none')"
)
// Can un-comment when autoincrement config comes from IDL
//
// testParseSql(
// "INSERT INTO person VALUES (3, 'Paul', 'none')"
// )
// testParseSql(
// "INSERT INTO person (id, name, authority) VALUES (3, 'Paul', 'none')"
// )
// testParseSql(
// "INSERT INTO person VALUES (3, 'Paul', 'none'), (4, 'John', 'none')"
// )
// testParseSql(
// "INSERT INTO person (id, name, authority) VALUES (3, 'Paul', 'none'), (4, 'John', 'none')"
// )
//
testParseSql(
"DELETE FROM person"
)
testParseSql(
"DELETE FROM person WHERE name = 'Joe'"
)
testParseSql(
"DELETE FROM person WHERE id = 1 AND name = 'Joe'"
)
testParseSql(
"UPDATE person SET name = 'Paul' WHERE id = 1"
)
testParseSql(
"UPDATE person SET name = 'Paul' WHERE name = 'Joe'"
)
testParseSql(
"UPDATE person SET name = 'Paul' WHERE id = 1 AND name = 'Joe'"
)
testParseSql(
"UPDATE person SET name = 'Paul', authority = 'none' WHERE id = 1"
)
testParseSql(
"UPDATE person SET name = 'Paul', authority = 'none' WHERE name = 'Joe'"
)
testParseSql(
"UPDATE person SET name = 'Paul', authority = 'none' WHERE id = 1 AND name = 'Joe'"
)
})
}
| 0
|
solana_public_repos/nautilus-project/nautilus/js
|
solana_public_repos/nautilus-project/nautilus/js/tests/main.test.ts
|
import { Connection, PublicKey } from "@solana/web3.js"
//
// Deploy test program before executing
//
export const CONNECTION = new Connection("http://localhost:8899", "confirmed")
export const PROGRAM_ID_STRING = "9kYnTzxTSTtKJjBBScH2m3SLBq8grogLhwMLZdcD2wG4"
export const PROGRAM_ID = new PublicKey("9kYnTzxTSTtKJjBBScH2m3SLBq8grogLhwMLZdcD2wG4")
function test(file: string) {
require(file).tests()
}
//
// Test Suite
//
test("./instantiate.test.ts")
test("./sql-parse.test.ts")
| 0
|
solana_public_repos/nautilus-project/nautilus/js
|
solana_public_repos/nautilus-project/nautilus/js/src/index.ts
|
//
//
// ----------------------------------------------------------------
// Nautilus
// ----------------------------------------------------------------
//
//
import {
Connection,
Keypair,
PublicKey,
} from '@solana/web3.js';
import {
NautilusQuery,
NautilusTable,
} from './sql';
import { NautilusUtils } from './util';
export class Nautilus {
connection: Connection;
programs: [PublicKey, string][];
defaultProgram: PublicKey | undefined;
payer: Keypair | undefined;
util: NautilusUtils = new NautilusUtils();
constructor(
connection: Connection,
programs: string | PublicKey | [PublicKey, string][],
defaultProgram?: string | PublicKey,
payer?: Keypair,
) {
this.connection = connection;
[this.programs, this.defaultProgram] = parseNautilusArgs(programs, defaultProgram)
this.payer = payer ?? undefined;
}
table(tableName: string): NautilusTable {
return new NautilusTable(
this,
tableName,
);
}
sql(query: string): NautilusQuery {
return new NautilusQuery(
this,
query,
)
}
}
function parseNautilusArgs(
argPrograms: string | PublicKey | [PublicKey, string][],
argDefaultProgram: string | PublicKey | undefined,
): [[PublicKey, string][], PublicKey | undefined] {
const checkForDefaultProgram = (found: boolean) => {
if (!found) throw Error(
"Instance error: Provided default program was not found in the provided programs list"
)
}
let programs: [PublicKey, string][]
let defaultProgram: PublicKey | undefined = undefined
if (typeof argPrograms == "string") {
programs = [[new PublicKey(argPrograms), "default"]]
if (!argDefaultProgram) defaultProgram = new PublicKey(argPrograms)
} else if (argPrograms instanceof PublicKey) {
programs = [[argPrograms, "default"]]
if (!argDefaultProgram) defaultProgram = argPrograms
} else {
programs = argPrograms
if (argDefaultProgram) {
if (argDefaultProgram instanceof PublicKey) {
checkForDefaultProgram(
argPrograms.filter(([publicKey, _]) =>
publicKey === argDefaultProgram).length != 0
)
} else {
checkForDefaultProgram(
argPrograms.filter(([publicKey, name]) =>
publicKey.toBase58() == argDefaultProgram || name === argDefaultProgram).length != 0
)
}
} else {
if (argPrograms.length === 1) defaultProgram = argPrograms[0][0]
}
}
return [programs, defaultProgram]
}
| 0
|
solana_public_repos/nautilus-project/nautilus/js/src
|
solana_public_repos/nautilus-project/nautilus/js/src/util/index.ts
|
import {
AccountInfo,
Connection,
GetProgramAccountsConfig,
GetProgramAccountsFilter,
PublicKey,
SendOptions,
Signer,
TransactionInstruction,
TransactionMessage,
VersionedTransaction,
} from '@solana/web3.js';
export class NautilusUtils {
// Get Program Accounts
static async getProgramAccounts(
connection: Connection,
programId: PublicKey,
config: GetProgramAccountsConfig,
returnFields?: string[]
): Promise<{
pubkey: PublicKey,
account: AccountInfo<any>
}[]> {
return connection.getProgramAccounts(
programId,
config,
)
}
// Nautilus Instruction Utils
// TODO: Create these filters based on the IDL and the passed tableName
static evaluateWhereFilter(
field: string,
operator: string,
matches: string,
): GetProgramAccountsFilter {
return {
memcmp: {
offset: 0,
bytes: 'string',
}
}
}
// TODO: Create these instructions based on the IDL and the passed tableName
static createCreateInstruction(programId: PublicKey, tableName: string, data: any): TransactionInstruction {
return {
programId,
keys: [{
pubkey: PublicKey.unique(), isSigner: true, isWritable: true
}],
data: Buffer.alloc(0),
}
}
// TODO: Create these instructions based on the IDL and the passed tableName
static createDeleteInstruction(programId: PublicKey, tableName: string, account: any): TransactionInstruction {
return {
programId,
keys: [{
pubkey: PublicKey.unique(), isSigner: true, isWritable: true
}],
data: Buffer.alloc(0),
}
}
// TODO: Create these instructions based on the IDL and the passed tableName
static createUpdateInstruction(programId: PublicKey, tableName: string, data: any): TransactionInstruction {
return {
programId,
keys: [{
pubkey: PublicKey.unique(), isSigner: true, isWritable: true
}],
data: Buffer.alloc(0),
}
}
// Solana Transaction Utils
static async buildTransaction(
connection: Connection,
instructionsList: TransactionInstruction[],
signers: Signer[],
payerKey: PublicKey,
): Promise<VersionedTransaction> {
const tx = new VersionedTransaction(
new TransactionMessage({
payerKey,
recentBlockhash: (
await connection
.getLatestBlockhash()
.then((res) => res.blockhash)
),
instructions: instructionsList,
}).compileToV0Message()
);
tx.sign(signers)
return tx
}
static async sendTransactionWithSigner(
connection: Connection,
instructions: TransactionInstruction[],
signers: Signer[],
feePayer: PublicKey,
sendOptions?: SendOptions,
): Promise<string> {
return connection.sendTransaction(
(await NautilusUtils.buildTransaction(
connection,
instructions,
signers,
feePayer,
)),
sendOptions,
)
}
}
| 0
|
solana_public_repos/nautilus-project/nautilus/js/src
|
solana_public_repos/nautilus-project/nautilus/js/src/sql/table.ts
|
import {
AccountInfo,
GetProgramAccountsConfig,
PublicKey,
SendOptions,
Signer,
TransactionInstruction,
} from '@solana/web3.js';
import { Nautilus } from '../';
import { NautilusUtils } from '../util';
enum FetchFirst {
Delete,
Update,
}
export class NautilusTable {
nautilus: Nautilus
programId: PublicKey | undefined
tableName: string
// Reads
getProgramAccountsConfig: GetProgramAccountsConfig
returnFields: string[] | undefined
orderByFunction: any | undefined
// Writes
fetchFirst: FetchFirst | undefined
updateData: any
instructions: TransactionInstruction[]
signersList: Signer[]
constructor(
nautilus: Nautilus,
tableName: string,
) {
this.nautilus = nautilus
if (nautilus.defaultProgram) this.programId = nautilus.defaultProgram
this.tableName = tableName
this.getProgramAccountsConfig = {
filters: [],
}
this.returnFields = undefined;
this.orderByFunction = undefined;
this.fetchFirst = undefined;
this.updateData = undefined;
this.instructions = []
this.signersList = []
}
// Reads
fields(returnFields: string[]) {
this.returnFields = returnFields
return this
}
orderBy(field: string, order: string | number) {
if (order === "ASC" || order === 1) {
this.orderByFunction = (list: any[]) => list.sort((a, b) => (a[field] > b[field]) ? 1 : -1)
} else if (order === "DESC" || order === -1) {
this.orderByFunction = (list: any[]) => list.sort((a, b) => (a[field] > b[field]) ? -1 : 1)
} else {
throw Error("Not a valid ordering statement. Can only use \"ASC\" and \"DESC\", or 1 and -1")
}
return this
}
// TODO: We can optimize this if the only "where" filter is the primary key
where(
field: string,
operator: string,
matches: string,
) {
this.getProgramAccountsConfig.filters?.push(
NautilusUtils.evaluateWhereFilter(field, operator, matches)
);
return this
}
async get(): Promise<{
pubkey: PublicKey,
account: AccountInfo<any>
}[]> {
if (!this.programId) return noProgramIdError()
return NautilusUtils.getProgramAccounts(
this.nautilus.connection,
this.programId,
this.getProgramAccountsConfig,
this.returnFields,
)
}
// Writes
create(data: any | any[]) {
if (this.programId) {
const programId = this.programId
if (Array.isArray(data)) {
data.forEach((d) => this.instructions.push(
NautilusUtils.createCreateInstruction(programId, this.tableName, d)
))
} else {
this.instructions.push(NautilusUtils.createCreateInstruction(programId, this.tableName, data))
}
} else {
return noProgramIdError()
}
return this
}
delete() {
this.fetchFirst = FetchFirst.Delete
return this
}
update(data: any) {
this.fetchFirst = FetchFirst.Update
this.updateData = data
return this
}
signers(signers: Signer[]) {
signers.forEach((s) => this.signersList.push(s))
return this
}
// TODO: Transaction size overflow
async execute(sendOptions?: SendOptions): Promise<string> {
if (this.programId) {
const programId = this.programId
const instructions = this.instructions
if (this.fetchFirst) {
(await this.get()).forEach((account) => this.fetchFirst == FetchFirst.Delete ?
instructions.push(NautilusUtils.createDeleteInstruction(programId, this.tableName, account))
:
instructions.push(NautilusUtils.createUpdateInstruction(programId, this.tableName, this.updateData))
)
}
return NautilusUtils.sendTransactionWithSigner(
this.nautilus.connection,
instructions,
this.signersList,
this.signersList[0].publicKey,
sendOptions,
)
} else {
return noProgramIdError()
}
}
}
const noProgramIdError = () => {
throw Error("A program ID was not provided in your Nautilus object")
}
| 0
|
solana_public_repos/nautilus-project/nautilus/js/src
|
solana_public_repos/nautilus-project/nautilus/js/src/sql/index.ts
|
export * from './query';
export * from './table';
| 0
|
solana_public_repos/nautilus-project/nautilus/js/src
|
solana_public_repos/nautilus-project/nautilus/js/src/sql/query.ts
|
import NodeSQLParser, { From } from 'node-sql-parser';
import {
AST,
Delete,
Dual,
Insert_Replace,
Select,
Update,
} from 'node-sql-parser';
import { Nautilus } from '..';
import { NautilusTable } from './table';
const SUPPORTED_ACTIONS = [
"select",
"insert",
"delete",
"update",
]
export class NautilusQuery {
nautilus: Nautilus;
nautilusTables: NautilusTable[] = [];
ast: AST | AST[];
constructor(
nautilus: Nautilus,
query: string,
) {
this.nautilus = nautilus
const parser = new NodeSQLParser.Parser()
const ast = parser.astify(query)
this.ast = ast
const addTable =(astObj: AST) => {
if (
astObj.type &&
SUPPORTED_ACTIONS.includes(astObj.type)
) {
if (astObj.type === "delete") this.nautilusTables.push(
buildDeleteOperation(nautilus, astObj)
)
if (astObj.type === "insert") this.nautilusTables.push(
buildInsertOperation(nautilus, astObj)
)
if (astObj.type === "select") this.nautilusTables.push(
buildSelectOperation(nautilus, astObj)
)
if (astObj.type === "update") this.nautilusTables.push(
buildUpdateOperation(nautilus, astObj)
)
} else {
unsupportedSqlError()
}
}
if (Array.isArray(ast)) {
ast.forEach((astObj) => addTable(astObj))
} else {
addTable(ast)
}
}
dumpSql(): string {
return new NodeSQLParser.Parser().sqlify(this.ast)
}
}
interface TableIdlConfig {
primaryKey: string,
autoincrement: boolean,
fields: string[],
fieldsWithoutPrimaryKey: string[],
}
// TODO: Get this information from the IDL
function getIdlConfigsForTable(tableName: string): TableIdlConfig {
const primaryKey = "id"
const autoincrement = true
const fields = ["id", "name", "authority"]
const fieldsWithoutPrimaryKey = fields.filter((f) => f != primaryKey)
return {
primaryKey,
autoincrement,
fields,
fieldsWithoutPrimaryKey,
}
}
function buildData(tableName: string, columns: string[] | null, values: any[][]): any[] {
const tableConfig = getIdlConfigsForTable(tableName)
const data: any[] = []
if (tableConfig.autoincrement && columns && columns.includes(tableConfig.primaryKey)) autoincrementBreachError()
for (const val of values) {
if (tableConfig.fields.length == val.length) autoincrementBreachError()
const entries: any[][] = []
val.forEach((v, i) => entries.push([tableConfig.fieldsWithoutPrimaryKey[i], v]))
data.push(Object.fromEntries(entries))
}
return data
}
// TODO: Does not support "OR" yet
function parseWhere(statement: any): [string, string, string][] {
const where: [string, string, string][] = []
if (statement.operator === "AND") {
where.concat(parseWhere(statement.left))
where.concat(parseWhere(statement.right))
}
else {
where.push([statement.left.column, statement.operator, statement.right.value])
}
return where
}
function buildDeleteOperation(nautilus: Nautilus, ast: Delete): NautilusTable {
if (ast.table && Array.isArray(ast.table)) {
const tableName = ast.table[0].table
const table = new NautilusTable(nautilus, tableName)
if (ast.where) parseWhere(ast.where).forEach((w) => table.where(w[0], w[1], w[2]))
return table.delete()
} else {
return sqlMissingError("source table")
}
}
function buildInsertOperation(nautilus: Nautilus, ast: Insert_Replace): NautilusTable {
if (ast.table && Array.isArray(ast.table)) {
const tableName = ast.table[0].table
const columns = ast.columns
const values: any[][] = ast.values.map((valueObj) => valueObj.value.map((v) => v.value))
const data = buildData(tableName, columns, values)
return new NautilusTable(nautilus, tableName).create(data)
} else {
return sqlMissingError("source table")
}
}
function buildSelectOperation(nautilus: Nautilus, ast: Select): NautilusTable {
if (ast.from && Array.isArray(ast.from)) {
const tableName = ast.from[0].table
const returnFields = ast.columns == "*" ?
undefined
:
ast.columns.map((c) => c.expr.column)
const table = new NautilusTable(nautilus, tableName)
if (returnFields) table.fields(returnFields)
if (ast.where) parseWhere(ast.where).forEach((w) => table.where(w[0], w[1], w[2]))
if (ast.orderby) ast.orderby.forEach((o) => table.orderBy(o.expr.column, o.type))
return table
} else {
return sqlMissingError("source table")
}
}
function buildUpdateOperation(nautilus: Nautilus, ast: Update): NautilusTable {
if (ast.table && Array.isArray(ast.table)) {
if (!(ast.table[0] as From)) unsupportedSqlError()
const tableName = (ast.table[0] as From).table
const table = new NautilusTable(nautilus, tableName)
if (ast.where) parseWhere(ast.where).forEach((w) => table.where(w[0], w[1], w[2]))
const tableConfig = getIdlConfigsForTable(tableName)
const data = Object.fromEntries(ast.set.map((s) => {
if (s.column == tableConfig.primaryKey) immutablePrimaryKeyError()
return [s.column, s.value.value]
}))
return table.update(data)
} else {
return sqlMissingError("source table")
}
}
const unsupportedSqlError = () => {
throw Error("SQL operation error: Operation not supported")
}
const sqlMissingError = (missing: string) => {
throw Error(`SQL operation error: SQL missing the following information: ${missing}`)
}
const autoincrementBreachError = () => {
throw Error("You cannot provide a value for the primary key if autoincrement is enabled")
}
const immutablePrimaryKeyError = () => {
throw Error("You cannot change a primary key with an UPDATE operation")
}
| 0
|
solana_public_repos/nautilus-project/nautilus
|
solana_public_repos/nautilus-project/nautilus/tests/yarn.lock
|
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"@babel/runtime@^7.12.5", "@babel/runtime@^7.17.2":
version "7.20.13"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.20.13.tgz#7055ab8a7cff2b8f6058bf6ae45ff84ad2aded4b"
integrity sha512-gt3PKXs0DBoL9xCvOIIZ2NEqAGZqHjAnmVbfQtB620V0uReIQutpel14KcneZuer7UioY8ALKZ7iocavvzTNFA==
dependencies:
regenerator-runtime "^0.13.11"
"@metaplex-foundation/beet-solana@^0.3.1":
version "0.3.1"
resolved "https://registry.yarnpkg.com/@metaplex-foundation/beet-solana/-/beet-solana-0.3.1.tgz#4b37cda5c7f32ffd2bdd8b3164edc05c6463ab35"
integrity sha512-tgyEl6dvtLln8XX81JyBvWjIiEcjTkUwZbrM5dIobTmoqMuGewSyk9CClno8qsMsFdB5T3jC91Rjeqmu/6xk2g==
dependencies:
"@metaplex-foundation/beet" ">=0.1.0"
"@solana/web3.js" "^1.56.2"
bs58 "^5.0.0"
debug "^4.3.4"
"@metaplex-foundation/beet-solana@^0.4.0":
version "0.4.0"
resolved "https://registry.yarnpkg.com/@metaplex-foundation/beet-solana/-/beet-solana-0.4.0.tgz#52891e78674aaa54e0031f1bca5bfbc40de12e8d"
integrity sha512-B1L94N3ZGMo53b0uOSoznbuM5GBNJ8LwSeznxBxJ+OThvfHQ4B5oMUqb+0zdLRfkKGS7Q6tpHK9P+QK0j3w2cQ==
dependencies:
"@metaplex-foundation/beet" ">=0.1.0"
"@solana/web3.js" "^1.56.2"
bs58 "^5.0.0"
debug "^4.3.4"
"@metaplex-foundation/beet@>=0.1.0", "@metaplex-foundation/beet@^0.7.1":
version "0.7.1"
resolved "https://registry.yarnpkg.com/@metaplex-foundation/beet/-/beet-0.7.1.tgz#0975314211643f87b5f6f3e584fa31abcf4c612c"
integrity sha512-hNCEnS2WyCiYyko82rwuISsBY3KYpe828ubsd2ckeqZr7tl0WVLivGkoyA/qdiaaHEBGdGl71OpfWa2rqL3DiA==
dependencies:
ansicolors "^0.3.2"
bn.js "^5.2.0"
debug "^4.3.3"
"@metaplex-foundation/cusper@^0.0.2":
version "0.0.2"
resolved "https://registry.yarnpkg.com/@metaplex-foundation/cusper/-/cusper-0.0.2.tgz#dc2032a452d6c269e25f016aa4dd63600e2af975"
integrity sha512-S9RulC2fFCFOQraz61bij+5YCHhSO9llJegK8c8Y6731fSi6snUSQJdCUqYS8AIgR0TKbQvdvgSyIIdbDFZbBA==
"@metaplex-foundation/mpl-token-metadata@^2.9.1":
version "2.9.1"
resolved "https://registry.yarnpkg.com/@metaplex-foundation/mpl-token-metadata/-/mpl-token-metadata-2.9.1.tgz#79b548b60ac4065b438b78e28b0139751f16b186"
integrity sha512-QmeWBG7y2Uu9FyD1JiclPmJtkYA1sd/Vh9US9H9zTGNWnyogM60hqZ9yVcibvkO+aSsWd0ZJIsMXZlewXIx0IQ==
dependencies:
"@metaplex-foundation/beet" "^0.7.1"
"@metaplex-foundation/beet-solana" "^0.4.0"
"@metaplex-foundation/cusper" "^0.0.2"
"@solana/spl-token" "^0.3.6"
"@solana/web3.js" "^1.66.2"
bn.js "^5.2.0"
debug "^4.3.4"
"@metaplex-foundation/rustbin@^0.3.0":
version "0.3.1"
resolved "https://registry.yarnpkg.com/@metaplex-foundation/rustbin/-/rustbin-0.3.1.tgz#bbcd61e8699b73c0b062728c6f5e8d52e8145042"
integrity sha512-hWd2JPrnt2/nJzkBpZD3Y6ZfCUlJujv2K7qUfsxdS0jSwLrSrOvYwmNWFw6mc3lbULj6VP4WDyuy9W5/CHU/lQ==
dependencies:
debug "^4.3.3"
semver "^7.3.7"
text-table "^0.2.0"
toml "^3.0.0"
"@metaplex-foundation/solita@^0.19.4":
version "0.19.4"
resolved "https://registry.yarnpkg.com/@metaplex-foundation/solita/-/solita-0.19.4.tgz#d73fc3eea0424927c8cab2117177704bd8818681"
integrity sha512-5j7F2qKDc7Po6ye7fm/JsUcYMxPK5QkkGBJJfgY7dGhF5YQw8YPwqw95F7rSavuDrXOK9mhq/L8s+3ilvEk6CA==
dependencies:
"@metaplex-foundation/beet" "^0.7.1"
"@metaplex-foundation/beet-solana" "^0.3.1"
"@metaplex-foundation/rustbin" "^0.3.0"
"@solana/web3.js" "^1.56.2"
ansi-colors "^4.1.3"
camelcase "^6.2.1"
debug "^4.3.3"
js-sha256 "^0.9.0"
prettier "^2.5.1"
snake-case "^3.0.4"
spok "^1.4.3"
"@noble/ed25519@^1.7.0":
version "1.7.3"
resolved "https://registry.yarnpkg.com/@noble/ed25519/-/ed25519-1.7.3.tgz#57e1677bf6885354b466c38e2b620c62f45a7123"
integrity sha512-iR8GBkDt0Q3GyaVcIu7mSsVIqnFbkbRzGLWlvhwunacoLwt4J3swfKhfaM6rN6WY+TBGoYT1GtT1mIh2/jGbRQ==
"@noble/hashes@^1.1.2":
version "1.2.0"
resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.2.0.tgz#a3150eeb09cc7ab207ebf6d7b9ad311a9bdbed12"
integrity sha512-FZfhjEDbT5GRswV3C6uvLPHMiVD6lQBmpoX5+eSiPaMTXte/IKqI5dykDxzZB/WBeK/CDuQRBWarPdi3FNY2zQ==
"@noble/secp256k1@^1.6.3":
version "1.7.1"
resolved "https://registry.yarnpkg.com/@noble/secp256k1/-/secp256k1-1.7.1.tgz#b251c70f824ce3ca7f8dc3df08d58f005cc0507c"
integrity sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw==
"@solana/buffer-layout-utils@^0.2.0":
version "0.2.0"
resolved "https://registry.yarnpkg.com/@solana/buffer-layout-utils/-/buffer-layout-utils-0.2.0.tgz#b45a6cab3293a2eb7597cceb474f229889d875ca"
integrity sha512-szG4sxgJGktbuZYDg2FfNmkMi0DYQoVjN2h7ta1W1hPrwzarcFLBq9UpX1UjNXsNpT9dn+chgprtWGioUAr4/g==
dependencies:
"@solana/buffer-layout" "^4.0.0"
"@solana/web3.js" "^1.32.0"
bigint-buffer "^1.1.5"
bignumber.js "^9.0.1"
"@solana/buffer-layout@^4.0.0":
version "4.0.1"
resolved "https://registry.yarnpkg.com/@solana/buffer-layout/-/buffer-layout-4.0.1.tgz#b996235eaec15b1e0b5092a8ed6028df77fa6c15"
integrity sha512-E1ImOIAD1tBZFRdjeM4/pzTiTApC0AOBGwyAMS4fwIodCWArzJ3DWdoh8cKxeFM2fElkxBh2Aqts1BPC373rHA==
dependencies:
buffer "~6.0.3"
"@solana/spl-token@^0.3.6", "@solana/spl-token@^0.3.7":
version "0.3.7"
resolved "https://registry.yarnpkg.com/@solana/spl-token/-/spl-token-0.3.7.tgz#6f027f9ad8e841f792c32e50920d9d2e714fc8da"
integrity sha512-bKGxWTtIw6VDdCBngjtsGlKGLSmiu/8ghSt/IOYJV24BsymRbgq7r12GToeetpxmPaZYLddKwAz7+EwprLfkfg==
dependencies:
"@solana/buffer-layout" "^4.0.0"
"@solana/buffer-layout-utils" "^0.2.0"
buffer "^6.0.3"
"@solana/web3.js@^1.32.0", "@solana/web3.js@^1.66.2":
version "1.74.0"
resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.74.0.tgz#dbcbeabb830dd7cbbcf5e31404ca79c9785cbf2d"
integrity sha512-RKZyPqizPCxmpMGfpu4fuplNZEWCrhRBjjVstv5QnAJvgln1jgOfgui+rjl1ExnqDnWKg9uaZ5jtGROH/cwabg==
dependencies:
"@babel/runtime" "^7.12.5"
"@noble/ed25519" "^1.7.0"
"@noble/hashes" "^1.1.2"
"@noble/secp256k1" "^1.6.3"
"@solana/buffer-layout" "^4.0.0"
agentkeepalive "^4.2.1"
bigint-buffer "^1.1.5"
bn.js "^5.0.0"
borsh "^0.7.0"
bs58 "^4.0.1"
buffer "6.0.1"
fast-stable-stringify "^1.0.0"
jayson "^3.4.4"
node-fetch "^2.6.7"
rpc-websockets "^7.5.1"
superstruct "^0.14.2"
"@solana/web3.js@^1.56.2", "@solana/web3.js@^1.73.2":
version "1.73.3"
resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.73.3.tgz#60e6bd68f6f364d4be360b1e0a03a0a68468a029"
integrity sha512-vHRMo589XEIpoujpE2sZZ1aMZvfA1ImKfNxobzEFyMb+H5j6mRRUXfdgWD0qJ0sm11e5BcBC7HPeRXJB+7f3Lg==
dependencies:
"@babel/runtime" "^7.12.5"
"@noble/ed25519" "^1.7.0"
"@noble/hashes" "^1.1.2"
"@noble/secp256k1" "^1.6.3"
"@solana/buffer-layout" "^4.0.0"
agentkeepalive "^4.2.1"
bigint-buffer "^1.1.5"
bn.js "^5.0.0"
borsh "^0.7.0"
bs58 "^4.0.1"
buffer "6.0.1"
fast-stable-stringify "^1.0.0"
jayson "^3.4.4"
node-fetch "^2.6.7"
rpc-websockets "^7.5.1"
superstruct "^0.14.2"
"@types/chai@^4.3.4":
version "4.3.4"
resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.3.4.tgz#e913e8175db8307d78b4e8fa690408ba6b65dee4"
integrity sha512-KnRanxnpfpjUTqTCXslZSEdLfXExwgNxYPdiO2WGUj8+HDjFi8R3k5RVKPeSCzLjCcshCAtVO2QBbVuAV4kTnw==
"@types/connect@^3.4.33":
version "3.4.35"
resolved "https://registry.yarnpkg.com/@types/connect/-/connect-3.4.35.tgz#5fcf6ae445e4021d1fc2219a4873cc73a3bb2ad1"
integrity sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==
dependencies:
"@types/node" "*"
"@types/json5@^0.0.29":
version "0.0.29"
resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee"
integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==
"@types/mocha@^10.0.1":
version "10.0.1"
resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-10.0.1.tgz#2f4f65bb08bc368ac39c96da7b2f09140b26851b"
integrity sha512-/fvYntiO1GeICvqbQ3doGDIP97vWmvFt83GKguJ6prmQM2iXZfFcq6YE8KteFyRtX2/h5Hf91BYvPodJKFYv5Q==
"@types/node@*":
version "18.13.0"
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.13.0.tgz#0400d1e6ce87e9d3032c19eb6c58205b0d3f7850"
integrity sha512-gC3TazRzGoOnoKAhUx+Q0t8S9Tzs74z7m0ipwGpSqQrleP14hKxP4/JUeEQcD3W1/aIpnWl8pHowI7WokuZpXg==
"@types/node@^12.12.54":
version "12.20.55"
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.55.tgz#c329cbd434c42164f846b909bd6f85b5537f6240"
integrity sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==
"@types/node@^18.14.2":
version "18.14.2"
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.14.2.tgz#c076ed1d7b6095078ad3cf21dfeea951842778b1"
integrity sha512-1uEQxww3DaghA0RxqHx0O0ppVlo43pJhepY51OxuQIKHpjbnYLA7vcdwioNPzIqmC2u3I/dmylcqjlh0e7AyUA==
"@types/ws@^7.4.4":
version "7.4.7"
resolved "https://registry.yarnpkg.com/@types/ws/-/ws-7.4.7.tgz#f7c390a36f7a0679aa69de2d501319f4f8d9b702"
integrity sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==
dependencies:
"@types/node" "*"
JSONStream@^1.3.5:
version "1.3.5"
resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.5.tgz#3208c1f08d3a4d99261ab64f92302bc15e111ca0"
integrity sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==
dependencies:
jsonparse "^1.2.0"
through ">=2.2.7 <3"
agentkeepalive@^4.2.1:
version "4.2.1"
resolved "https://registry.yarnpkg.com/agentkeepalive/-/agentkeepalive-4.2.1.tgz#a7975cbb9f83b367f06c90cc51ff28fe7d499717"
integrity sha512-Zn4cw2NEqd+9fiSVWMscnjyQ1a8Yfoc5oBajLeo5w+YBHgDUcEBY2hS4YpTz6iN5f/2zQiktcuM6tS8x1p9dpA==
dependencies:
debug "^4.1.0"
depd "^1.1.2"
humanize-ms "^1.2.1"
ansi-colors@4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348"
integrity sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==
ansi-colors@^4.1.3:
version "4.1.3"
resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.3.tgz#37611340eb2243e70cc604cad35d63270d48781b"
integrity sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==
ansi-regex@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304"
integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==
ansi-styles@^4.0.0, ansi-styles@^4.1.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937"
integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==
dependencies:
color-convert "^2.0.1"
ansicolors@^0.3.2, ansicolors@~0.3.2:
version "0.3.2"
resolved "https://registry.yarnpkg.com/ansicolors/-/ansicolors-0.3.2.tgz#665597de86a9ffe3aa9bfbe6cae5c6ea426b4979"
integrity sha512-QXu7BPrP29VllRxH8GwB7x5iX5qWKAAMLqKQGWTeLWVlNHNOpVMJ91dsxQAIWXpjuW5wqvxu3Jd/nRjrJ+0pqg==
anymatch@~3.1.2:
version "3.1.3"
resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e"
integrity sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==
dependencies:
normalize-path "^3.0.0"
picomatch "^2.0.4"
argparse@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38"
integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==
arrify@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d"
integrity sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==
assertion-error@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.1.0.tgz#e60b6b0e8f301bd97e5375215bda406c85118c0b"
integrity sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==
balanced-match@^1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee"
integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==
base-x@^3.0.2:
version "3.0.9"
resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.9.tgz#6349aaabb58526332de9f60995e548a53fe21320"
integrity sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==
dependencies:
safe-buffer "^5.0.1"
base-x@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/base-x/-/base-x-4.0.0.tgz#d0e3b7753450c73f8ad2389b5c018a4af7b2224a"
integrity sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw==
base64-js@^1.3.1:
version "1.5.1"
resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a"
integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==
bigint-buffer@^1.1.5:
version "1.1.5"
resolved "https://registry.yarnpkg.com/bigint-buffer/-/bigint-buffer-1.1.5.tgz#d038f31c8e4534c1f8d0015209bf34b4fa6dd442"
integrity sha512-trfYco6AoZ+rKhKnxA0hgX0HAbVP/s808/EuDSe2JDzUnCp/xAsli35Orvk67UrTEcwuxZqYZDmfA2RXJgxVvA==
dependencies:
bindings "^1.3.0"
bignumber.js@^9.0.1:
version "9.1.1"
resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.1.tgz#c4df7dc496bd849d4c9464344c1aa74228b4dac6"
integrity sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig==
binary-extensions@^2.0.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d"
integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==
bindings@^1.3.0:
version "1.5.0"
resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.5.0.tgz#10353c9e945334bc0511a6d90b38fbc7c9c504df"
integrity sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==
dependencies:
file-uri-to-path "1.0.0"
bn.js@^5.0.0, bn.js@^5.2.0:
version "5.2.1"
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.1.tgz#0bc527a6a0d18d0aa8d5b0538ce4a77dccfa7b70"
integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==
borsh@^0.7.0:
version "0.7.0"
resolved "https://registry.yarnpkg.com/borsh/-/borsh-0.7.0.tgz#6e9560d719d86d90dc589bca60ffc8a6c51fec2a"
integrity sha512-CLCsZGIBCFnPtkNnieW/a8wmreDmfUtjU2m9yHrzPXIlNbqVs0AQrSatSG6vdNYUqdc83tkQi2eHfF98ubzQLA==
dependencies:
bn.js "^5.2.0"
bs58 "^4.0.0"
text-encoding-utf-8 "^1.0.2"
brace-expansion@^1.1.7:
version "1.1.11"
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==
dependencies:
balanced-match "^1.0.0"
concat-map "0.0.1"
brace-expansion@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae"
integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==
dependencies:
balanced-match "^1.0.0"
braces@~3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107"
integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==
dependencies:
fill-range "^7.0.1"
browser-stdout@1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60"
integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==
bs58@^4.0.0, bs58@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/bs58/-/bs58-4.0.1.tgz#be161e76c354f6f788ae4071f63f34e8c4f0a42a"
integrity sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==
dependencies:
base-x "^3.0.2"
bs58@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/bs58/-/bs58-5.0.0.tgz#865575b4d13c09ea2a84622df6c8cbeb54ffc279"
integrity sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ==
dependencies:
base-x "^4.0.0"
buffer-from@^1.0.0, buffer-from@^1.1.0:
version "1.1.2"
resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5"
integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==
buffer@6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.1.tgz#3cbea8c1463e5a0779e30b66d4c88c6ffa182ac2"
integrity sha512-rVAXBwEcEoYtxnHSO5iWyhzV/O1WMtkUYWlfdLS7FjU4PnSJJHEfHXi/uHPI5EwltmOA794gN3bm3/pzuctWjQ==
dependencies:
base64-js "^1.3.1"
ieee754 "^1.2.1"
buffer@^6.0.3, buffer@~6.0.3:
version "6.0.3"
resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.3.tgz#2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6"
integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==
dependencies:
base64-js "^1.3.1"
ieee754 "^1.2.1"
bufferutil@^4.0.1:
version "4.0.7"
resolved "https://registry.yarnpkg.com/bufferutil/-/bufferutil-4.0.7.tgz#60c0d19ba2c992dd8273d3f73772ffc894c153ad"
integrity sha512-kukuqc39WOHtdxtw4UScxF/WVnMFVSQVKhtx3AjZJzhd0RGZZldcrfSEbVsWWe6KNH253574cq5F+wpv0G9pJw==
dependencies:
node-gyp-build "^4.3.0"
camelcase@^6.0.0, camelcase@^6.2.1:
version "6.3.0"
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a"
integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==
chai@^4.3.7:
version "4.3.7"
resolved "https://registry.yarnpkg.com/chai/-/chai-4.3.7.tgz#ec63f6df01829088e8bf55fca839bcd464a8ec51"
integrity sha512-HLnAzZ2iupm25PlN0xFreAlBA5zaBSv3og0DdeGA4Ar6h6rJ3A0rolRUKJhSF2V10GZKDgWF/VmAEsNWjCRB+A==
dependencies:
assertion-error "^1.1.0"
check-error "^1.0.2"
deep-eql "^4.1.2"
get-func-name "^2.0.0"
loupe "^2.3.1"
pathval "^1.1.1"
type-detect "^4.0.5"
chalk@^4.1.0:
version "4.1.2"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01"
integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==
dependencies:
ansi-styles "^4.1.0"
supports-color "^7.1.0"
check-error@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82"
integrity sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA==
chokidar@3.5.3:
version "3.5.3"
resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd"
integrity sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==
dependencies:
anymatch "~3.1.2"
braces "~3.0.2"
glob-parent "~5.1.2"
is-binary-path "~2.1.0"
is-glob "~4.0.1"
normalize-path "~3.0.0"
readdirp "~3.6.0"
optionalDependencies:
fsevents "~2.3.2"
cliui@^7.0.2:
version "7.0.4"
resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f"
integrity sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==
dependencies:
string-width "^4.2.0"
strip-ansi "^6.0.0"
wrap-ansi "^7.0.0"
color-convert@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3"
integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==
dependencies:
color-name "~1.1.4"
color-name@~1.1.4:
version "1.1.4"
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
commander@^2.20.3:
version "2.20.3"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33"
integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==
concat-map@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==
debug@4.3.4, debug@^4.1.0, debug@^4.3.3, debug@^4.3.4:
version "4.3.4"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865"
integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==
dependencies:
ms "2.1.2"
decamelize@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-4.0.0.tgz#aa472d7bf660eb15f3494efd531cab7f2a709837"
integrity sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==
deep-eql@^4.1.2:
version "4.1.3"
resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-4.1.3.tgz#7c7775513092f7df98d8df9996dd085eb668cc6d"
integrity sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==
dependencies:
type-detect "^4.0.0"
delay@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/delay/-/delay-5.0.0.tgz#137045ef1b96e5071060dd5be60bf9334436bd1d"
integrity sha512-ReEBKkIfe4ya47wlPYf/gu5ib6yUG0/Aez0JQZQz94kiWtRQvZIQbTiehsnwHvLSWJnQdhVeqYue7Id1dKr0qw==
depd@^1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9"
integrity sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==
diff@5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/diff/-/diff-5.0.0.tgz#7ed6ad76d859d030787ec35855f5b1daf31d852b"
integrity sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==
diff@^3.1.0:
version "3.5.0"
resolved "https://registry.yarnpkg.com/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12"
integrity sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==
dot-case@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/dot-case/-/dot-case-3.0.4.tgz#9b2b670d00a431667a8a75ba29cd1b98809ce751"
integrity sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==
dependencies:
no-case "^3.0.4"
tslib "^2.0.3"
emoji-regex@^8.0.0:
version "8.0.0"
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37"
integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==
es6-promise@^4.0.3:
version "4.2.8"
resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.8.tgz#4eb21594c972bc40553d276e510539143db53e0a"
integrity sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==
es6-promisify@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/es6-promisify/-/es6-promisify-5.0.0.tgz#5109d62f3e56ea967c4b63505aef08291c8a5203"
integrity sha512-C+d6UdsYDk0lMebHNR4S2NybQMMngAOnOwYBQjTOiv0MkoJMP0Myw2mgpDLBcpfCmRLxyFqYhS/CfOENq4SJhQ==
dependencies:
es6-promise "^4.0.3"
escalade@^3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40"
integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==
escape-string-regexp@4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34"
integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==
eventemitter3@^4.0.7:
version "4.0.7"
resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f"
integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==
eyes@^0.1.8:
version "0.1.8"
resolved "https://registry.yarnpkg.com/eyes/-/eyes-0.1.8.tgz#62cf120234c683785d902348a800ef3e0cc20bc0"
integrity sha512-GipyPsXO1anza0AOZdy69Im7hGFCNB7Y/NGjDlZGJ3GJJLtwNSb2vrzYrTYJRrRloVx7pl+bhUaTB8yiccPvFQ==
fast-stable-stringify@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/fast-stable-stringify/-/fast-stable-stringify-1.0.0.tgz#5c5543462b22aeeefd36d05b34e51c78cb86d313"
integrity sha512-wpYMUmFu5f00Sm0cj2pfivpmawLZ0NKdviQ4w9zJeR8JVtOpOxHmLaJuj0vxvGqMJQWyP/COUkF75/57OKyRag==
file-uri-to-path@1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd"
integrity sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==
fill-range@^7.0.1:
version "7.0.1"
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40"
integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==
dependencies:
to-regex-range "^5.0.1"
find-up@5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc"
integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==
dependencies:
locate-path "^6.0.0"
path-exists "^4.0.0"
flat@^5.0.2:
version "5.0.2"
resolved "https://registry.yarnpkg.com/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241"
integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==
fs.realpath@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==
fsevents@~2.3.2:
version "2.3.2"
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a"
integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==
get-caller-file@^2.0.5:
version "2.0.5"
resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e"
integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==
get-func-name@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/get-func-name/-/get-func-name-2.0.0.tgz#ead774abee72e20409433a066366023dd6887a41"
integrity sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig==
glob-parent@~5.1.2:
version "5.1.2"
resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4"
integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==
dependencies:
is-glob "^4.0.1"
glob@7.2.0:
version "7.2.0"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023"
integrity sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==
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"
has-flag@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b"
integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==
he@1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f"
integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==
humanize-ms@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/humanize-ms/-/humanize-ms-1.2.1.tgz#c46e3159a293f6b896da29316d8b6fe8bb79bbed"
integrity sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==
dependencies:
ms "^2.0.0"
ieee754@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352"
integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==
inflight@^1.0.4:
version "1.0.6"
resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
integrity sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==
dependencies:
once "^1.3.0"
wrappy "1"
inherits@2:
version "2.0.4"
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
is-binary-path@~2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09"
integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==
dependencies:
binary-extensions "^2.0.0"
is-extglob@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2"
integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==
is-fullwidth-code-point@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d"
integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==
is-glob@^4.0.1, is-glob@~4.0.1:
version "4.0.3"
resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084"
integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==
dependencies:
is-extglob "^2.1.1"
is-number@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b"
integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==
is-plain-obj@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287"
integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==
is-unicode-supported@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz#3f26c76a809593b52bfa2ecb5710ed2779b522a7"
integrity sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==
isomorphic-ws@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz#55fd4cd6c5e6491e76dc125938dd863f5cd4f2dc"
integrity sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==
jayson@^3.4.4:
version "3.7.0"
resolved "https://registry.yarnpkg.com/jayson/-/jayson-3.7.0.tgz#b735b12d06d348639ae8230d7a1e2916cb078f25"
integrity sha512-tfy39KJMrrXJ+mFcMpxwBvFDetS8LAID93+rycFglIQM4kl3uNR3W4lBLE/FFhsoUCEox5Dt2adVpDm/XtebbQ==
dependencies:
"@types/connect" "^3.4.33"
"@types/node" "^12.12.54"
"@types/ws" "^7.4.4"
JSONStream "^1.3.5"
commander "^2.20.3"
delay "^5.0.0"
es6-promisify "^5.0.0"
eyes "^0.1.8"
isomorphic-ws "^4.0.1"
json-stringify-safe "^5.0.1"
lodash "^4.17.20"
uuid "^8.3.2"
ws "^7.4.5"
js-sha256@^0.9.0:
version "0.9.0"
resolved "https://registry.yarnpkg.com/js-sha256/-/js-sha256-0.9.0.tgz#0b89ac166583e91ef9123644bd3c5334ce9d0966"
integrity sha512-sga3MHh9sgQN2+pJ9VYZ+1LPwXOxuBJBA5nrR5/ofPfuiJBE2hnjsaN8se8JznOmGLN2p49Pe5U/ttafcs/apA==
js-yaml@4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602"
integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==
dependencies:
argparse "^2.0.1"
json-stringify-safe@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb"
integrity sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==
json5@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.2.tgz#63d98d60f21b313b77c4d6da18bfa69d80e1d593"
integrity sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==
dependencies:
minimist "^1.2.0"
jsonparse@^1.2.0:
version "1.3.1"
resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280"
integrity sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==
locate-path@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286"
integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==
dependencies:
p-locate "^5.0.0"
lodash@^4.17.20:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
log-symbols@4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.1.0.tgz#3fbdbb95b4683ac9fc785111e792e558d4abd503"
integrity sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==
dependencies:
chalk "^4.1.0"
is-unicode-supported "^0.1.0"
loupe@^2.3.1:
version "2.3.6"
resolved "https://registry.yarnpkg.com/loupe/-/loupe-2.3.6.tgz#76e4af498103c532d1ecc9be102036a21f787b53"
integrity sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA==
dependencies:
get-func-name "^2.0.0"
lower-case@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/lower-case/-/lower-case-2.0.2.tgz#6fa237c63dbdc4a82ca0fd882e4722dc5e634e28"
integrity sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==
dependencies:
tslib "^2.0.3"
lru-cache@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94"
integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==
dependencies:
yallist "^4.0.0"
make-error@^1.1.1:
version "1.3.6"
resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2"
integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==
minimatch@5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.0.1.tgz#fb9022f7528125187c92bd9e9b6366be1cf3415b"
integrity sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==
dependencies:
brace-expansion "^2.0.1"
minimatch@^3.0.4:
version "3.1.2"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b"
integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==
dependencies:
brace-expansion "^1.1.7"
minimist@^1.2.0, minimist@^1.2.6:
version "1.2.7"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.7.tgz#daa1c4d91f507390437c6a8bc01078e7000c4d18"
integrity sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==
mkdirp@^0.5.1:
version "0.5.6"
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.6.tgz#7def03d2432dcae4ba1d611445c48396062255f6"
integrity sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==
dependencies:
minimist "^1.2.6"
mocha@^10.2.0:
version "10.2.0"
resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.2.0.tgz#1fd4a7c32ba5ac372e03a17eef435bd00e5c68b8"
integrity sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==
dependencies:
ansi-colors "4.1.1"
browser-stdout "1.3.1"
chokidar "3.5.3"
debug "4.3.4"
diff "5.0.0"
escape-string-regexp "4.0.0"
find-up "5.0.0"
glob "7.2.0"
he "1.2.0"
js-yaml "4.1.0"
log-symbols "4.1.0"
minimatch "5.0.1"
ms "2.1.3"
nanoid "3.3.3"
serialize-javascript "6.0.0"
strip-json-comments "3.1.1"
supports-color "8.1.1"
workerpool "6.2.1"
yargs "16.2.0"
yargs-parser "20.2.4"
yargs-unparser "2.0.0"
ms@2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==
ms@2.1.3, ms@^2.0.0:
version "2.1.3"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2"
integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==
nanoid@3.3.3:
version "3.3.3"
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.3.tgz#fd8e8b7aa761fe807dba2d1b98fb7241bb724a25"
integrity sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w==
no-case@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/no-case/-/no-case-3.0.4.tgz#d361fd5c9800f558551a8369fc0dcd4662b6124d"
integrity sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==
dependencies:
lower-case "^2.0.2"
tslib "^2.0.3"
node-fetch@^2.6.7:
version "2.6.9"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.9.tgz#7c7f744b5cc6eb5fd404e0c7a9fec630a55657e6"
integrity sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==
dependencies:
whatwg-url "^5.0.0"
node-gyp-build@^4.3.0:
version "4.6.0"
resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.6.0.tgz#0c52e4cbf54bbd28b709820ef7b6a3c2d6209055"
integrity sha512-NTZVKn9IylLwUzaKjkas1e4u2DLNcV4rdYagA4PWdPwW87Bi7z+BznyKSRwS/761tV/lzCGXplWsiaMjLqP2zQ==
normalize-path@^3.0.0, normalize-path@~3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65"
integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==
once@^1.3.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==
dependencies:
wrappy "1"
p-limit@^3.0.2:
version "3.1.0"
resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b"
integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==
dependencies:
yocto-queue "^0.1.0"
p-locate@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834"
integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==
dependencies:
p-limit "^3.0.2"
path-exists@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3"
integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==
path-is-absolute@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==
pathval@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/pathval/-/pathval-1.1.1.tgz#8534e77a77ce7ac5a2512ea21e0fdb8fcf6c3d8d"
integrity sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==
picomatch@^2.0.4, picomatch@^2.2.1:
version "2.3.1"
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42"
integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==
prettier@^2.5.1:
version "2.8.4"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.4.tgz#34dd2595629bfbb79d344ac4a91ff948694463c3"
integrity sha512-vIS4Rlc2FNh0BySk3Wkd6xmwxB0FpOndW5fisM5H8hsZSxU2VWVB5CWIkIjWvrHjIhxk2g3bfMKM87zNTrZddw==
randombytes@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a"
integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==
dependencies:
safe-buffer "^5.1.0"
readdirp@~3.6.0:
version "3.6.0"
resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7"
integrity sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==
dependencies:
picomatch "^2.2.1"
regenerator-runtime@^0.13.11:
version "0.13.11"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz#f6dca3e7ceec20590d07ada785636a90cdca17f9"
integrity sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==
require-directory@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42"
integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==
rpc-websockets@^7.5.1:
version "7.5.1"
resolved "https://registry.yarnpkg.com/rpc-websockets/-/rpc-websockets-7.5.1.tgz#e0a05d525a97e7efc31a0617f093a13a2e10c401"
integrity sha512-kGFkeTsmd37pHPMaHIgN1LVKXMi0JD782v4Ds9ZKtLlwdTKjn+CxM9A9/gLT2LaOuEcEFGL98h1QWQtlOIdW0w==
dependencies:
"@babel/runtime" "^7.17.2"
eventemitter3 "^4.0.7"
uuid "^8.3.2"
ws "^8.5.0"
optionalDependencies:
bufferutil "^4.0.1"
utf-8-validate "^5.0.2"
safe-buffer@^5.0.1, safe-buffer@^5.1.0:
version "5.2.1"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6"
integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==
semver@^7.3.7:
version "7.3.8"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.8.tgz#07a78feafb3f7b32347d725e33de7e2a2df67798"
integrity sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==
dependencies:
lru-cache "^6.0.0"
serialize-javascript@6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.0.tgz#efae5d88f45d7924141da8b5c3a7a7e663fefeb8"
integrity sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==
dependencies:
randombytes "^2.1.0"
snake-case@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/snake-case/-/snake-case-3.0.4.tgz#4f2bbd568e9935abdfd593f34c691dadb49c452c"
integrity sha512-LAOh4z89bGQvl9pFfNF8V146i7o7/CqFPbqzYgP+yYzDIDeS9HaNFtXABamRW+AQzEVODcvE79ljJ+8a9YSdMg==
dependencies:
dot-case "^3.0.4"
tslib "^2.0.3"
source-map-support@^0.5.6:
version "0.5.21"
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f"
integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==
dependencies:
buffer-from "^1.0.0"
source-map "^0.6.0"
source-map@^0.6.0:
version "0.6.1"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
spok@^1.4.3:
version "1.4.3"
resolved "https://registry.yarnpkg.com/spok/-/spok-1.4.3.tgz#8516234e6bd8caf0e10567bd675e15fd03b5ceb8"
integrity sha512-5wFGctwrk638aDs+44u99kohxFNByUq2wo0uShQ9yqxSmsxqx7zKbMo1Busy4s7stZQXU+PhJ/BlVf2XWFEGIw==
dependencies:
ansicolors "~0.3.2"
string-width@^4.1.0, string-width@^4.2.0:
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.1"
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.1"
strip-bom@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3"
integrity sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==
strip-json-comments@3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006"
integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==
superstruct@^0.14.2:
version "0.14.2"
resolved "https://registry.yarnpkg.com/superstruct/-/superstruct-0.14.2.tgz#0dbcdf3d83676588828f1cf5ed35cda02f59025b"
integrity sha512-nPewA6m9mR3d6k7WkZ8N8zpTWfenFH3q9pA2PkuiZxINr9DKB2+40wEQf0ixn8VaGuJ78AB6iWOtStI+/4FKZQ==
supports-color@8.1.1:
version "8.1.1"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c"
integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==
dependencies:
has-flag "^4.0.0"
supports-color@^7.1.0:
version "7.2.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da"
integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==
dependencies:
has-flag "^4.0.0"
text-encoding-utf-8@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/text-encoding-utf-8/-/text-encoding-utf-8-1.0.2.tgz#585b62197b0ae437e3c7b5d0af27ac1021e10d13"
integrity sha512-8bw4MY9WjdsD2aMtO0OzOCY3pXGYNx2d2FfHRVUKkiCPDWjKuOlhLVASS+pD7VkLTVjW268LYJHwsnPFlBpbAg==
text-table@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4"
integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==
"through@>=2.2.7 <3":
version "2.3.8"
resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5"
integrity sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==
to-regex-range@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4"
integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==
dependencies:
is-number "^7.0.0"
toml@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/toml/-/toml-3.0.0.tgz#342160f1af1904ec9d204d03a5d61222d762c5ee"
integrity sha512-y/mWCZinnvxjTKYhJ+pYxwD0mRLVvOtdS2Awbgxln6iEnt4rk0yBxeSBHkGJcPucRiG0e55mwWp+g/05rsrd6w==
tr46@~0.0.3:
version "0.0.3"
resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a"
integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==
ts-mocha@^10.0.0:
version "10.0.0"
resolved "https://registry.yarnpkg.com/ts-mocha/-/ts-mocha-10.0.0.tgz#41a8d099ac90dbbc64b06976c5025ffaebc53cb9"
integrity sha512-VRfgDO+iiuJFlNB18tzOfypJ21xn2xbuZyDvJvqpTbWgkAgD17ONGr8t+Tl8rcBtOBdjXp5e/Rk+d39f7XBHRw==
dependencies:
ts-node "7.0.1"
optionalDependencies:
tsconfig-paths "^3.5.0"
ts-node@7.0.1:
version "7.0.1"
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-7.0.1.tgz#9562dc2d1e6d248d24bc55f773e3f614337d9baf"
integrity sha512-BVwVbPJRspzNh2yfslyT1PSbl5uIk03EZlb493RKHN4qej/D06n1cEhjlOJG69oFsE7OT8XjpTUcYf6pKTLMhw==
dependencies:
arrify "^1.0.0"
buffer-from "^1.1.0"
diff "^3.1.0"
make-error "^1.1.1"
minimist "^1.2.0"
mkdirp "^0.5.1"
source-map-support "^0.5.6"
yn "^2.0.0"
tsconfig-paths@^3.5.0:
version "3.14.1"
resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.14.1.tgz#ba0734599e8ea36c862798e920bcf163277b137a"
integrity sha512-fxDhWnFSLt3VuTwtvJt5fpwxBHg5AdKWMsgcPOOIilyjymcYVZoCQF8fvFRezCNfblEXmi+PcM1eYHeOAgXCOQ==
dependencies:
"@types/json5" "^0.0.29"
json5 "^1.0.1"
minimist "^1.2.6"
strip-bom "^3.0.0"
tslib@^2.0.3:
version "2.5.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.5.0.tgz#42bfed86f5787aeb41d031866c8f402429e0fddf"
integrity sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==
type-detect@^4.0.0, type-detect@^4.0.5:
version "4.0.8"
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c"
integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==
typescript@^4.9.5:
version "4.9.5"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a"
integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==
utf-8-validate@^5.0.2:
version "5.0.10"
resolved "https://registry.yarnpkg.com/utf-8-validate/-/utf-8-validate-5.0.10.tgz#d7d10ea39318171ca982718b6b96a8d2442571a2"
integrity sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==
dependencies:
node-gyp-build "^4.3.0"
uuid@^8.3.2:
version "8.3.2"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==
webidl-conversions@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871"
integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==
whatwg-url@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d"
integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==
dependencies:
tr46 "~0.0.3"
webidl-conversions "^3.0.0"
workerpool@6.2.1:
version "6.2.1"
resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.2.1.tgz#46fc150c17d826b86a008e5a4508656777e9c343"
integrity sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==
wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"
wrappy@1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==
ws@^7.4.5:
version "7.5.9"
resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.9.tgz#54fa7db29f4c7cec68b1ddd3a89de099942bb591"
integrity sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==
ws@^8.5.0:
version "8.12.0"
resolved "https://registry.yarnpkg.com/ws/-/ws-8.12.0.tgz#485074cc392689da78e1828a9ff23585e06cddd8"
integrity sha512-kU62emKIdKVeEIOIKVegvqpXMSTAMLJozpHZaJNDYqBjzlSYXQGviYwN1osDLJ9av68qHd4a2oSjd7yD4pacig==
y18n@^5.0.5:
version "5.0.8"
resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55"
integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==
yallist@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72"
integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==
yaml@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.2.1.tgz#3014bf0482dcd15147aa8e56109ce8632cd60ce4"
integrity sha512-e0WHiYql7+9wr4cWMx3TVQrNwejKaEe7/rHNmQmqRjazfOP5W8PB6Jpebb5o6fIapbz9o9+2ipcaTM2ZwDI6lw==
yargs-parser@20.2.4:
version "20.2.4"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.4.tgz#b42890f14566796f85ae8e3a25290d205f154a54"
integrity sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==
yargs-parser@^20.2.2:
version "20.2.9"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee"
integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==
yargs-unparser@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/yargs-unparser/-/yargs-unparser-2.0.0.tgz#f131f9226911ae5d9ad38c432fe809366c2325eb"
integrity sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==
dependencies:
camelcase "^6.0.0"
decamelize "^4.0.0"
flat "^5.0.2"
is-plain-obj "^2.1.0"
yargs@16.2.0:
version "16.2.0"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66"
integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==
dependencies:
cliui "^7.0.2"
escalade "^3.1.1"
get-caller-file "^2.0.5"
require-directory "^2.1.1"
string-width "^4.2.0"
y18n "^5.0.5"
yargs-parser "^20.2.2"
yn@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/yn/-/yn-2.0.0.tgz#e5adabc8acf408f6385fc76495684c88e6af689a"
integrity sha512-uTv8J/wiWTgUTg+9vLTi//leUl5vDQS6uii/emeTb2ssY7vl6QWf2fFbIIGjnhjvbdKlU0ed7QPgY1htTC86jQ==
yocto-queue@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b"
integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==
| 0
|
solana_public_repos/nautilus-project/nautilus
|
solana_public_repos/nautilus-project/nautilus/tests/package.json
|
{
"name": "program-nautilus",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"devDependencies": {
"@metaplex-foundation/solita": "^0.19.4",
"@types/chai": "^4.3.4",
"@types/mocha": "^10.0.1",
"@types/node": "^18.14.2",
"chai": "^4.3.7",
"mocha": "^10.2.0",
"ts-mocha": "^10.0.0",
"typescript": "^4.9.5"
},
"dependencies": {
"@metaplex-foundation/mpl-token-metadata": "^2.9.1",
"@solana/spl-token": "^0.3.7",
"@solana/web3.js": "^1.73.2",
"yaml": "^2.2.1"
},
"scripts": {
"test-wallets": "yarn run ts-mocha -p ./tests/tsconfig.test.json -t 1000000 ./tests/wallets/test.ts",
"test-tokens": "yarn run ts-mocha -p ./tests/tsconfig.test.json -t 1000000 ./tests/tokens/test.ts",
"test-records": "yarn run ts-mocha -p ./tests/tsconfig.test.json -t 1000000 ./tests/records/test.ts",
"test-accounts": "yarn run ts-mocha -p ./tests/tsconfig.test.json -t 1000000 ./tests/accounts/test.ts",
"all": "sh ./tests/all-tests.sh"
}
}
| 0
|
solana_public_repos/nautilus-project/nautilus/tests
|
solana_public_repos/nautilus-project/nautilus/tests/tests/const.ts
|
import { Connection, Keypair, clusterApiUrl } from '@solana/web3.js'
import fs from 'fs'
import os from 'os'
import { parse as yamlParse, stringify as yamlStringify } from 'yaml'
export const PAYER = loadKeypairFromFile(os.homedir() + '/.config/solana/id.json')
export const PROGRAM_WALLETS = loadKeypairFromFile('./programs/wallets/target/deploy/program_nautilus-keypair.json')
export const PROGRAM_TOKENS = loadKeypairFromFile('./programs/tokens/target/deploy/program_nautilus-keypair.json')
export const PROGRAM_RECORDS = loadKeypairFromFile('./programs/records/target/deploy/program_nautilus-keypair.json')
export const PROGRAM_ACCOUNTS = loadKeypairFromFile('./programs/accounts/target/deploy/program_nautilus-keypair.json')
function loadKeypairFromFile(path: string): Keypair {
return Keypair.fromSecretKey(
Buffer.from(JSON.parse(fs.readFileSync(path, "utf-8")))
)
}
const sleepSeconds = async (s: number) => await new Promise(f => setTimeout(f, s * 1000))
type TestConfigs = {
connection: Connection,
sleep: () => Promise<unknown>,
skipMetadata: boolean,
}
function getTestConfigs(): TestConfigs {
const config = yamlParse(
fs.readFileSync(os.homedir() + '/.config/solana/cli/config.yml', "utf-8")
)
const jsonRpcUrl: string = config['json_rpc_url']
const [timeDelay, skipMetadata] = jsonRpcUrl == "http://localhost:8899" ? [0 , true] : [10, false]
return {
connection: new Connection(jsonRpcUrl, "confirmed"),
sleep: () => sleepSeconds(timeDelay),
skipMetadata,
}
}
export const TEST_CONFIGS = getTestConfigs()
| 0
|
solana_public_repos/nautilus-project/nautilus/tests
|
solana_public_repos/nautilus-project/nautilus/tests/tests/tsconfig.test.json
|
{
"compilerOptions": {
"types": ["mocha", "chai"],
"typeRoots": ["./node_modules/@types"],
"lib": ["es2015"],
"module": "commonjs",
"target": "es6",
"esModuleInterop": true
}
}
| 0
|
solana_public_repos/nautilus-project/nautilus/tests
|
solana_public_repos/nautilus-project/nautilus/tests/tests/all-tests.sh
|
echo "\n\n================================================="
echo "\n Nautilus Program Tests"
echo "\n\n================================================="
sleep 2
echo "\nBuilding all test programs...\n"
sleep 5
cargo build-sbf --manifest-path="./programs/wallets/Cargo.toml"
cargo build-sbf --manifest-path="./programs/tokens/Cargo.toml"
cargo build-sbf --manifest-path="./programs/records/Cargo.toml"
cargo build-sbf --manifest-path="./programs/accounts/Cargo.toml"
echo "\nDeploying all test programs...\n"
solana program deploy ./programs/wallets/target/deploy/program_nautilus.so
solana program deploy ./programs/tokens/target/deploy/program_nautilus.so
solana program deploy ./programs/records/target/deploy/program_nautilus.so
solana program deploy ./programs/accounts/target/deploy/program_nautilus.so
echo "\nCommencing all tests...\n"
yarn
sleep 3
echo "\nLaunching test suite: Wallets\n"
yarn run test-wallets
sleep 5
echo "\nLaunching test suite: Tokens\n"
yarn run test-tokens
sleep 5
echo "\nLaunching test suite: Records\n"
yarn run test-records
sleep 5
echo "\nLaunching test suite: Accounts\n"
yarn run test-accounts
sleep 5
| 0
|
solana_public_repos/nautilus-project/nautilus/tests/tests
|
solana_public_repos/nautilus-project/nautilus/tests/tests/records/test.ts
|
import {
it,
describe,
} from 'mocha'
import {
Keypair,
LAMPORTS_PER_SOL,
sendAndConfirmTransaction,
Transaction,
TransactionInstruction,
} from '@solana/web3.js'
import { PAYER, PROGRAM_RECORDS, TEST_CONFIGS } from '../const'
import {
MyInstructions,
createCreateCarInstruction,
createCreateHomeInstruction,
createCreatePersonInstruction,
createFundCarInstruction,
createFundHomeInstruction,
createFundPersonInstruction,
createInitializeInstruction,
createReadCarInstruction,
createReadHomeInstruction,
createReadPersonInstruction,
createTransferFromCarInstruction,
createTransferFromHomeInstruction,
createTransferFromPersonInstruction,
} from './instructions'
describe("Nautilus Unit Tests: Create Records", async () => {
const connection = TEST_CONFIGS.connection
const payer = PAYER
const program = PROGRAM_RECORDS
const personName = "Joe"
const homeId = 1
const homeHouseNumber = 15
const homeStreet = "Solana St."
const carMake = "Chevrolet"
const carModel = "Corvette"
const fundTransferAmount = LAMPORTS_PER_SOL / 1000
async function test(ix: TransactionInstruction, signers: Keypair[]) {
TEST_CONFIGS.sleep()
let sx = await sendAndConfirmTransaction(
connection,
new Transaction().add(ix),
signers,
{skipPreflight: true}
)
console.log(`\n\n [INFO]: sig: ${sx}\n`)
}
it("Initialize Nautilus Index", async () => test(
createInitializeInstruction(payer.publicKey, program.publicKey),
[payer],
))
it("Create Person", async () => test(
await createCreatePersonInstruction(payer.publicKey, program.publicKey, personName, payer.publicKey),
[payer],
))
it("Read Person", async () => test(
await createReadPersonInstruction(program.publicKey),
[payer],
))
it("Create Home", async () => test(
createCreateHomeInstruction(payer.publicKey, program.publicKey, homeId, homeHouseNumber, homeStreet),
[payer],
))
it("Read Home", async () => test(
createReadHomeInstruction(program.publicKey, homeId),
[payer],
))
it("Create Car", async () => test(
await createCreateCarInstruction(payer.publicKey, program.publicKey, carMake, carModel, payer.publicKey, payer.publicKey),
[payer],
))
it("Read Car", async () => test(
await createReadCarInstruction(program.publicKey),
[payer],
))
it("Fund Person", async () => test(
await createFundPersonInstruction(payer.publicKey, program.publicKey, fundTransferAmount),
[payer],
))
it("Transfer from Person", async () => test(
await createTransferFromPersonInstruction(payer.publicKey, program.publicKey, fundTransferAmount),
[payer],
))
it("Fund Home", async () => test(
await createFundHomeInstruction(payer.publicKey, program.publicKey, fundTransferAmount, homeId),
[payer],
))
it("Transfer from Home", async () => test(
await createTransferFromHomeInstruction(payer.publicKey, program.publicKey, fundTransferAmount, homeId),
[payer],
))
it("Fund Car", async () => test(
await createFundCarInstruction(payer.publicKey, program.publicKey, fundTransferAmount),
[payer],
))
it("Transfer from Car", async () => test(
await createTransferFromCarInstruction(payer.publicKey, program.publicKey, fundTransferAmount),
[payer],
))
})
| 0
|
solana_public_repos/nautilus-project/nautilus/tests/tests/records
|
solana_public_repos/nautilus-project/nautilus/tests/tests/records/instructions/car.ts
|
import * as borsh from "borsh"
import { Buffer } from "buffer"
import {
PublicKey,
SystemProgram,
SYSVAR_RENT_PUBKEY,
TransactionInstruction
} from '@solana/web3.js'
import { createBaseInstruction, fetchIndex, MyInstructions } from "."
import assert from "assert"
class CreateCarInstructionData {
instruction: MyInstructions
make: string
model: string
purchase_authority: Uint8Array
operating_authority: Uint8Array
constructor(props: {
instruction: MyInstructions,
make: string,
model: string,
purchase_authority: PublicKey,
operating_authority: PublicKey,
}) {
this.instruction = props.instruction
this.make = props.make
this.model = props.model
this.purchase_authority = props.purchase_authority.toBuffer()
this.operating_authority = props.operating_authority.toBuffer()
}
toBuffer() {
return Buffer.from(borsh.serialize(CreateCarInstructionDataSchema, this))
}
}
const CreateCarInstructionDataSchema = new Map([
[ CreateCarInstructionData, {
kind: 'struct',
fields: [
['instruction', 'u8'],
['make', 'string'],
['model', 'string'],
['purchase_authority', [32]],
['operating_authority', [32]],
],
}]
])
export function deriveCarAddress(programId: PublicKey, id: number): PublicKey {
return PublicKey.findProgramAddressSync(
[Buffer.from("car"), Buffer.from(Uint8Array.of(id))],
programId
)[0]
}
function createInstruction(
index: PublicKey,
newRecord: PublicKey,
payer: PublicKey,
programId: PublicKey,
make: string,
model: string,
purchase_authority: PublicKey,
operating_authority: PublicKey,
): TransactionInstruction {
const myInstructionObject = new CreateCarInstructionData({
instruction: MyInstructions.CreateCar,
make,
model,
purchase_authority,
operating_authority,
})
const keys = [
{pubkey: index, isSigner: false, isWritable: true},
{pubkey: newRecord, isSigner: false, isWritable: true},
{pubkey: payer, isSigner: true, isWritable: true},
{pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
]
return new TransactionInstruction({
keys,
programId,
data: myInstructionObject.toBuffer(),
})
}
export async function createCreateCarInstruction(
payer: PublicKey,
programId: PublicKey,
make: string,
model: string,
purchase_authority: PublicKey,
operating_authority: PublicKey,
): Promise<TransactionInstruction> {
const index = await fetchIndex(programId)
const currentId = index[1].get("car");
assert(currentId != undefined)
const newRecord = deriveCarAddress(programId, currentId + 1)
return createInstruction(index[0], newRecord, payer, programId, make, model, purchase_authority, operating_authority)
}
export async function createReadCarInstruction(
programId: PublicKey,
): Promise<TransactionInstruction> {
const index = await fetchIndex(programId)
const currentId = index[1].get("car");
assert(currentId != undefined)
const record = deriveCarAddress(programId, currentId + 1) // TODO
return createBaseInstruction(
programId,
MyInstructions.ReadCar,
[
{pubkey: index[0], isSigner: false, isWritable: false},
{pubkey: record, isSigner: false, isWritable: false},
],
)
}
| 0
|
solana_public_repos/nautilus-project/nautilus/tests/tests/records
|
solana_public_repos/nautilus-project/nautilus/tests/tests/records/instructions/transfer.ts
|
import * as borsh from "borsh"
import { Buffer } from "buffer"
import {
PublicKey,
SystemProgram,
TransactionInstruction
} from '@solana/web3.js'
import { MyInstructions, deriveCarAddress, deriveHomeAddress, derivePersonAddress, fetchIndex } from "."
import assert from "assert"
class FundOrTransferInstructionData {
instruction: MyInstructions
amount: number
constructor(props: {
instruction: MyInstructions,
amount: number,
}) {
this.instruction = props.instruction
this.amount = props.amount
}
toBuffer() {
return Buffer.from(borsh.serialize(FundOrTransferInstructionDataSchema, this))
}
}
const FundOrTransferInstructionDataSchema = new Map([
[ FundOrTransferInstructionData, {
kind: 'struct',
fields: [
['instruction', 'u8'],
['amount', 'u64'],
],
}]
])
function createInstruction(
programId: PublicKey,
amount: number,
instruction: MyInstructions,
keys: {pubkey: PublicKey, isSigner: boolean, isWritable: boolean}[]
): TransactionInstruction {
const myInstructionObject = new FundOrTransferInstructionData({instruction, amount})
return new TransactionInstruction({
keys,
programId,
data: myInstructionObject.toBuffer(),
})
}
export async function createFundPersonInstruction(
payer: PublicKey,
programId: PublicKey,
amount: number,
): Promise<TransactionInstruction> {
const index = await fetchIndex(programId)
const currentId = index[1].get("person");
assert(currentId != undefined)
const record = derivePersonAddress(programId, currentId + 1)
const keys = [
{pubkey: index[0], isSigner: false, isWritable: true},
{pubkey: payer, isSigner: true, isWritable: true},
{pubkey: record, isSigner: false, isWritable: true},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
]
return createInstruction(programId, amount, MyInstructions.FundPerson, keys)
}
export async function createTransferFromPersonInstruction(
recipient: PublicKey,
programId: PublicKey,
amount: number,
): Promise<TransactionInstruction> {
const index = await fetchIndex(programId)
const currentId = index[1].get("person");
assert(currentId != undefined)
const record = derivePersonAddress(programId, currentId + 1)
const keys = [
{pubkey: index[0], isSigner: false, isWritable: true},
{pubkey: record, isSigner: false, isWritable: true},
{pubkey: recipient, isSigner: false, isWritable: true},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
]
return createInstruction(programId, amount, MyInstructions.TransferFromPerson, keys)
}
export async function createFundHomeInstruction(
payer: PublicKey,
programId: PublicKey,
amount: number,
homeId: number
): Promise<TransactionInstruction> {
const index = await fetchIndex(programId)
const record = deriveHomeAddress(programId, homeId)
const keys = [
{pubkey: index[0], isSigner: false, isWritable: true},
{pubkey: record, isSigner: false, isWritable: true},
{pubkey: payer, isSigner: true, isWritable: true},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
]
return createInstruction(programId, amount, MyInstructions.FundHome, keys)
}
export async function createTransferFromHomeInstruction(
recipient: PublicKey,
programId: PublicKey,
amount: number,
homeId: number,
): Promise<TransactionInstruction> {
const index = await fetchIndex(programId)
const record = deriveHomeAddress(programId, homeId)
const keys = [
{pubkey: index[0], isSigner: false, isWritable: true},
{pubkey: record, isSigner: false, isWritable: true},
{pubkey: recipient, isSigner: false, isWritable: true},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
]
return createInstruction(programId, amount, MyInstructions.TransferFromHome, keys)
}
export async function createFundCarInstruction(
payer: PublicKey,
programId: PublicKey,
amount: number,
): Promise<TransactionInstruction> {
const index = await fetchIndex(programId)
const currentId = index[1].get("car");
assert(currentId != undefined)
const record = deriveCarAddress(programId, currentId + 1)
const keys = [
{pubkey: index[0], isSigner: false, isWritable: true},
{pubkey: record, isSigner: false, isWritable: true},
{pubkey: payer, isSigner: true, isWritable: true},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
]
return createInstruction(programId, amount, MyInstructions.FundCar, keys)
}
export async function createTransferFromCarInstruction(
recipient: PublicKey,
programId: PublicKey,
amount: number,
): Promise<TransactionInstruction> {
const index = await fetchIndex(programId)
const currentId = index[1].get("car");
assert(currentId != undefined)
const record = deriveCarAddress(programId, currentId + 1)
const keys = [
{pubkey: index[0], isSigner: false, isWritable: true},
{pubkey: record, isSigner: false, isWritable: true},
{pubkey: recipient, isSigner: false, isWritable: true},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
]
return createInstruction(programId, amount, MyInstructions.TransferFromCar, keys)
}
| 0
|
solana_public_repos/nautilus-project/nautilus/tests/tests/records
|
solana_public_repos/nautilus-project/nautilus/tests/tests/records/instructions/index.ts
|
export * from './car'
export * from './home'
export * from './person'
export * from './transfer'
import { PublicKey, SYSVAR_RENT_PUBKEY, SystemProgram, TransactionInstruction } from '@solana/web3.js'
import * as borsh from "borsh"
import { Buffer } from "buffer"
import { TEST_CONFIGS } from '../../const'
export enum MyInstructions {
Initialize,
CreatePerson,
ReadPerson,
CreateHome,
ReadHome,
CreateCar,
ReadCar,
FundPerson,
TransferFromPerson,
FundHome,
TransferFromHome,
FundCar,
TransferFromCar,
}
export class BaseInstructionData {
instruction: MyInstructions
constructor(props: {
instruction: MyInstructions,
}) {
this.instruction = props.instruction
}
toBuffer() {
return Buffer.from(borsh.serialize(BaseInstructionDataSchema, this))
}
}
const BaseInstructionDataSchema = new Map([
[ BaseInstructionData, {
kind: 'struct',
fields: [
['instruction', 'u8'],
],
}]
])
export function createBaseInstruction(
programId: PublicKey,
instruction: MyInstructions,
keys: {pubkey: PublicKey, isSigner: boolean, isWritable: boolean}[],
): TransactionInstruction {
const myInstructionObject = new BaseInstructionData({instruction})
return new TransactionInstruction({
keys,
programId,
data: myInstructionObject.toBuffer(),
})
}
export function deriveIndexAddress(programId: PublicKey): PublicKey {
return PublicKey.findProgramAddressSync(
[Buffer.from("nautilus_index"), Buffer.from(Uint8Array.of(0))],
programId
)[0]
}
export async function fetchIndex(programId: PublicKey): Promise<[PublicKey, Map<string, number>]> {
const connection = TEST_CONFIGS.connection
const indexPubkey = deriveIndexAddress(programId)
const indexAccountInfo = await connection.getAccountInfo(indexPubkey)
return [indexPubkey ,new Map<string, number>([
["person", 0],
["home", 0],
["car", 0],
])] // TODO
}
export function createInitializeInstruction(payer: PublicKey, programId: PublicKey): TransactionInstruction {
const indexPubkey = deriveIndexAddress(programId)
console.log(` [INFO]: Index: ${indexPubkey.toBase58()}`)
return createBaseInstruction(
programId,
MyInstructions.Initialize,
[
{pubkey: indexPubkey, isSigner: false, isWritable: true},
{pubkey: payer, isSigner: true, isWritable: true},
{pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
],
)
}
| 0
|
solana_public_repos/nautilus-project/nautilus/tests/tests/records
|
solana_public_repos/nautilus-project/nautilus/tests/tests/records/instructions/home.ts
|
import * as borsh from "borsh"
import { Buffer } from "buffer"
import {
PublicKey,
SystemProgram,
SYSVAR_RENT_PUBKEY,
TransactionInstruction
} from '@solana/web3.js'
import { createBaseInstruction, deriveIndexAddress, fetchIndex, MyInstructions } from "."
class CreateHomeInstructionData {
instruction: MyInstructions
id: number
house_number: number
street: string
constructor(props: {
instruction: MyInstructions,
id: number,
house_number: number,
street: string,
}) {
this.instruction = props.instruction
this.id = props.id
this.house_number = props.house_number
this.street = props.street
}
toBuffer() {
return Buffer.from(borsh.serialize(CreateHomeInstructionDataSchema, this))
}
}
const CreateHomeInstructionDataSchema = new Map([
[ CreateHomeInstructionData, {
kind: 'struct',
fields: [
['instruction', 'u8'],
['id', 'u8'],
['house_number', 'u8'],
['street', 'string'],
],
}]
])
export function deriveHomeAddress(programId: PublicKey, id: number): PublicKey {
return PublicKey.findProgramAddressSync(
[Buffer.from("home"), Buffer.from(Uint8Array.of(id))],
programId
)[0]
}
function createInstruction(
index: PublicKey,
newRecord: PublicKey,
payer: PublicKey,
programId: PublicKey,
id: number,
house_number: number,
street: string,
): TransactionInstruction {
const myInstructionObject = new CreateHomeInstructionData({
instruction: MyInstructions.CreateHome,
id,
house_number,
street,
})
const keys = [
{pubkey: index, isSigner: false, isWritable: true},
{pubkey: newRecord, isSigner: false, isWritable: true},
{pubkey: payer, isSigner: true, isWritable: true},
{pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
]
return new TransactionInstruction({
keys,
programId,
data: myInstructionObject.toBuffer(),
})
}
export function createCreateHomeInstruction(
payer: PublicKey,
programId: PublicKey,
id: number,
house_number: number,
street: string,
): TransactionInstruction {
const index = deriveIndexAddress(programId)
const newRecord = deriveHomeAddress(programId, id)
return createInstruction(index, newRecord, payer, programId, id, house_number, street)
}
export function createReadHomeInstruction(
programId: PublicKey,
id: number,
): TransactionInstruction {
const index = deriveIndexAddress(programId)
const record = deriveHomeAddress(programId, id)
return createBaseInstruction(
programId,
MyInstructions.ReadHome,
[
{pubkey: index, isSigner: false, isWritable: false},
{pubkey: record, isSigner: false, isWritable: false},
],
)
}
| 0
|
solana_public_repos/nautilus-project/nautilus/tests/tests/records
|
solana_public_repos/nautilus-project/nautilus/tests/tests/records/instructions/person.ts
|
import * as borsh from "borsh"
import { Buffer } from "buffer"
import {
PublicKey,
SystemProgram,
SYSVAR_RENT_PUBKEY,
TransactionInstruction
} from '@solana/web3.js'
import { createBaseInstruction, fetchIndex, MyInstructions } from "."
import assert from "assert"
class CreatePersonInstructionData {
instruction: MyInstructions
name: string
authority: Uint8Array
constructor(props: {
instruction: MyInstructions,
name: string,
authority: PublicKey,
}) {
this.instruction = props.instruction
this.name = props.name
this.authority = props.authority.toBuffer()
}
toBuffer() {
return Buffer.from(borsh.serialize(CreatePersonInstructionDataSchema, this))
}
}
const CreatePersonInstructionDataSchema = new Map([
[ CreatePersonInstructionData, {
kind: 'struct',
fields: [
['instruction', 'u8'],
['name', 'string'],
['authority', [32]],
],
}]
])
export function derivePersonAddress(programId: PublicKey, id: number): PublicKey {
return PublicKey.findProgramAddressSync(
[Buffer.from("person"), Buffer.from(Uint8Array.of(id))],
programId
)[0]
}
function createInstruction(
index: PublicKey,
newRecord: PublicKey,
payer: PublicKey,
programId: PublicKey,
name: string,
authority: PublicKey,
): TransactionInstruction {
const myInstructionObject = new CreatePersonInstructionData({
instruction: MyInstructions.CreatePerson,
name,
authority,
})
const keys = [
{pubkey: index, isSigner: false, isWritable: true},
{pubkey: newRecord, isSigner: false, isWritable: true},
{pubkey: payer, isSigner: true, isWritable: true},
{pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
]
return new TransactionInstruction({
keys,
programId,
data: myInstructionObject.toBuffer(),
})
}
export async function createCreatePersonInstruction(
payer: PublicKey,
programId: PublicKey,
name: string,
authority: PublicKey,
): Promise<TransactionInstruction> {
const index = await fetchIndex(programId)
const currentId = index[1].get("person");
assert(currentId != undefined)
const newRecord = derivePersonAddress(programId, currentId + 1)
return createInstruction(index[0], newRecord, payer, programId, name, authority)
}
export async function createReadPersonInstruction(
programId: PublicKey,
): Promise<TransactionInstruction> {
const index = await fetchIndex(programId)
const currentId = index[1].get("person");
assert(currentId != undefined)
const record = derivePersonAddress(programId, currentId + 1) // TODO
return createBaseInstruction(
programId,
MyInstructions.ReadPerson,
[
{pubkey: index[0], isSigner: false, isWritable: false},
{pubkey: record, isSigner: false, isWritable: false},
],
)
}
| 0
|
solana_public_repos/nautilus-project/nautilus/tests/tests
|
solana_public_repos/nautilus-project/nautilus/tests/tests/records-2/test.ts
|
import {
it,
describe,
} from 'mocha'
import {
Keypair,
sendAndConfirmTransaction,
Transaction,
TransactionInstruction,
} from '@solana/web3.js'
import { PAYER, PROGRAM_RECORDS, TEST_CONFIGS } from '../const'
import {
createCreateCarInstruction,
createCreateHomeInstruction,
createCreatePersonInstruction,
createInitializeInstruction,
createReadCarInstruction,
createReadHomeInstruction,
createReadPersonInstruction,
} from './instructions'
describe("Nautilus Unit Tests: Create Records", async () => {
const connection = TEST_CONFIGS.connection
const payer = PAYER
const program = PROGRAM_RECORDS
const personName = "Joe"
const homeId = 1
const homeHouseNumber = 15
const homeStreet = "Solana St."
const carMake = "Chevrolet"
const carModel = "Corvette"
async function test(ix: TransactionInstruction, signers: Keypair[]) {
TEST_CONFIGS.sleep()
let sx = await sendAndConfirmTransaction(
connection,
new Transaction().add(ix),
signers,
{skipPreflight: true}
)
console.log(`\n\n [INFO]: sig: ${sx}\n`)
}
it("Initialize Nautilus Index", async () => test(
createInitializeInstruction(payer.publicKey, program.publicKey),
[payer],
))
it("Create Person", async () => test(
await createCreatePersonInstruction(payer.publicKey, program.publicKey, personName, payer.publicKey),
[payer],
))
it("Read Person", async () => test(
await createReadPersonInstruction(program.publicKey),
[payer],
))
it("Create Home", async () => test(
createCreateHomeInstruction(payer.publicKey, program.publicKey, homeId, homeHouseNumber, homeStreet),
[payer],
))
it("Read Home", async () => test(
createReadHomeInstruction(program.publicKey, homeId),
[payer],
))
it("Create Car", async () => test(
await createCreateCarInstruction(payer.publicKey, program.publicKey, carMake, carModel, payer.publicKey, payer.publicKey),
[payer],
))
it("Read Car", async () => test(
await createReadCarInstruction(program.publicKey),
[payer],
))
})
| 0
|
solana_public_repos/nautilus-project/nautilus/tests/tests/records-2
|
solana_public_repos/nautilus-project/nautilus/tests/tests/records-2/instructions/car.ts
|
import * as borsh from "borsh"
import { Buffer } from "buffer"
import {
PublicKey,
SystemProgram,
SYSVAR_RENT_PUBKEY,
TransactionInstruction
} from '@solana/web3.js'
import { createBaseInstruction, fetchIndex, MyInstructions } from "."
import assert from "assert"
class CreateCarInstructionData {
instruction: MyInstructions
make: string
model: string
purchase_authority: Uint8Array
operating_authority: Uint8Array
constructor(props: {
instruction: MyInstructions,
make: string,
model: string,
purchase_authority: PublicKey,
operating_authority: PublicKey,
}) {
this.instruction = props.instruction
this.make = props.make
this.model = props.model
this.purchase_authority = props.purchase_authority.toBuffer()
this.operating_authority = props.operating_authority.toBuffer()
}
toBuffer() {
return Buffer.from(borsh.serialize(CreateCarInstructionDataSchema, this))
}
}
const CreateCarInstructionDataSchema = new Map([
[ CreateCarInstructionData, {
kind: 'struct',
fields: [
['instruction', 'u8'],
['make', 'string'],
['model', 'string'],
['purchase_authority', [32]],
['operating_authority', [32]],
],
}]
])
function deriveCarAddress(programId: PublicKey, id: number): PublicKey {
return PublicKey.findProgramAddressSync(
[Buffer.from("car"), Buffer.from(Uint8Array.of(id))],
programId
)[0]
}
function createInstruction(
index: PublicKey,
newRecord: PublicKey,
payer: PublicKey,
programId: PublicKey,
make: string,
model: string,
purchase_authority: PublicKey,
operating_authority: PublicKey,
): TransactionInstruction {
const myInstructionObject = new CreateCarInstructionData({
instruction: MyInstructions.CreateCar,
make,
model,
purchase_authority,
operating_authority,
})
const keys = [
{pubkey: index, isSigner: false, isWritable: true},
{pubkey: newRecord, isSigner: false, isWritable: true},
{pubkey: payer, isSigner: true, isWritable: true},
{pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
]
return new TransactionInstruction({
keys,
programId,
data: myInstructionObject.toBuffer(),
})
}
export async function createCreateCarInstruction(
payer: PublicKey,
programId: PublicKey,
make: string,
model: string,
purchase_authority: PublicKey,
operating_authority: PublicKey,
): Promise<TransactionInstruction> {
const index = await fetchIndex(programId)
const currentId = index[1].get("car");
assert(currentId != undefined)
const newRecord = deriveCarAddress(programId, currentId + 1)
return createInstruction(index[0], newRecord, payer, programId, make, model, purchase_authority, operating_authority)
}
export async function createReadCarInstruction(
programId: PublicKey,
): Promise<TransactionInstruction> {
const index = await fetchIndex(programId)
const currentId = index[1].get("car");
assert(currentId != undefined)
const record = deriveCarAddress(programId, currentId + 1) // TODO
return createBaseInstruction(
programId,
MyInstructions.ReadCar,
[
{pubkey: index[0], isSigner: false, isWritable: false},
{pubkey: record, isSigner: false, isWritable: false},
],
)
}
| 0
|
solana_public_repos/nautilus-project/nautilus/tests/tests/records-2
|
solana_public_repos/nautilus-project/nautilus/tests/tests/records-2/instructions/index.ts
|
export * from './car'
export * from './home'
export * from './person'
import { PublicKey, SYSVAR_RENT_PUBKEY, SystemProgram, TransactionInstruction } from '@solana/web3.js'
import * as borsh from "borsh"
import { Buffer } from "buffer"
import { TEST_CONFIGS } from '../../const'
export enum MyInstructions {
Initialize,
CreatePerson,
ReadPerson,
CreateHome,
ReadHome,
CreateCar,
ReadCar,
}
export class BaseInstructionData {
instruction: MyInstructions
constructor(props: {
instruction: MyInstructions,
}) {
this.instruction = props.instruction
}
toBuffer() {
return Buffer.from(borsh.serialize(BaseInstructionDataSchema, this))
}
}
const BaseInstructionDataSchema = new Map([
[ BaseInstructionData, {
kind: 'struct',
fields: [
['instruction', 'u8'],
],
}]
])
export function createBaseInstruction(
programId: PublicKey,
instruction: MyInstructions,
keys: {pubkey: PublicKey, isSigner: boolean, isWritable: boolean}[],
): TransactionInstruction {
const myInstructionObject = new BaseInstructionData({instruction})
return new TransactionInstruction({
keys,
programId,
data: myInstructionObject.toBuffer(),
})
}
export function deriveIndexAddress(programId: PublicKey): PublicKey {
return PublicKey.findProgramAddressSync(
[Buffer.from("nautilus_index"), Buffer.from(Uint8Array.of(0))],
programId
)[0]
}
export async function fetchIndex(programId: PublicKey): Promise<[PublicKey, Map<string, number>]> {
const connection = TEST_CONFIGS.connection
const indexPubkey = deriveIndexAddress(programId)
const indexAccountInfo = await connection.getAccountInfo(indexPubkey)
return [indexPubkey ,new Map<string, number>([
["person", 0],
["home", 0],
["car", 0],
])] // TODO
}
export function createInitializeInstruction(payer: PublicKey, programId: PublicKey): TransactionInstruction {
const indexPubkey = deriveIndexAddress(programId)
console.log(` [INFO]: Index: ${indexPubkey.toBase58()}`)
return createBaseInstruction(
programId,
MyInstructions.Initialize,
[
{pubkey: indexPubkey, isSigner: false, isWritable: true},
{pubkey: payer, isSigner: true, isWritable: true},
{pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
],
)
}
| 0
|
solana_public_repos/nautilus-project/nautilus/tests/tests/records-2
|
solana_public_repos/nautilus-project/nautilus/tests/tests/records-2/instructions/home.ts
|
import * as borsh from "borsh"
import { Buffer } from "buffer"
import {
PublicKey,
SystemProgram,
SYSVAR_RENT_PUBKEY,
TransactionInstruction
} from '@solana/web3.js'
import { createBaseInstruction, deriveIndexAddress, fetchIndex, MyInstructions } from "."
class CreateHomeInstructionData {
instruction: MyInstructions
id: number
house_number: number
street: string
constructor(props: {
instruction: MyInstructions,
id: number,
house_number: number,
street: string,
}) {
this.instruction = props.instruction
this.id = props.id
this.house_number = props.house_number
this.street = props.street
}
toBuffer() {
return Buffer.from(borsh.serialize(CreateHomeInstructionDataSchema, this))
}
}
const CreateHomeInstructionDataSchema = new Map([
[ CreateHomeInstructionData, {
kind: 'struct',
fields: [
['instruction', 'u8'],
['id', 'u8'],
['house_number', 'u8'],
['street', 'string'],
],
}]
])
function deriveHomeAddress(programId: PublicKey, id: number): PublicKey {
return PublicKey.findProgramAddressSync(
[Buffer.from("home"), Buffer.from(Uint8Array.of(id))],
programId
)[0]
}
function createInstruction(
index: PublicKey,
newRecord: PublicKey,
payer: PublicKey,
programId: PublicKey,
id: number,
house_number: number,
street: string,
): TransactionInstruction {
const myInstructionObject = new CreateHomeInstructionData({
instruction: MyInstructions.CreateHome,
id,
house_number,
street,
})
const keys = [
{pubkey: index, isSigner: false, isWritable: true},
{pubkey: newRecord, isSigner: false, isWritable: true},
{pubkey: payer, isSigner: true, isWritable: true},
{pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
]
return new TransactionInstruction({
keys,
programId,
data: myInstructionObject.toBuffer(),
})
}
export function createCreateHomeInstruction(
payer: PublicKey,
programId: PublicKey,
id: number,
house_number: number,
street: string,
): TransactionInstruction {
const index = deriveIndexAddress(programId)
const newRecord = deriveHomeAddress(programId, id)
return createInstruction(index, newRecord, payer, programId, id, house_number, street)
}
export function createReadHomeInstruction(
programId: PublicKey,
id: number,
): TransactionInstruction {
const index = deriveIndexAddress(programId)
const record = deriveHomeAddress(programId, id)
return createBaseInstruction(
programId,
MyInstructions.ReadHome,
[
{pubkey: index, isSigner: false, isWritable: false},
{pubkey: record, isSigner: false, isWritable: false},
],
)
}
| 0
|
solana_public_repos/nautilus-project/nautilus/tests/tests/records-2
|
solana_public_repos/nautilus-project/nautilus/tests/tests/records-2/instructions/person.ts
|
import * as borsh from "borsh"
import { Buffer } from "buffer"
import {
PublicKey,
SystemProgram,
SYSVAR_RENT_PUBKEY,
TransactionInstruction
} from '@solana/web3.js'
import { createBaseInstruction, fetchIndex, MyInstructions } from "."
import assert from "assert"
class CreatePersonInstructionData {
instruction: MyInstructions
name: string
authority: Uint8Array
constructor(props: {
instruction: MyInstructions,
name: string,
authority: PublicKey,
}) {
this.instruction = props.instruction
this.name = props.name
this.authority = props.authority.toBuffer()
}
toBuffer() {
return Buffer.from(borsh.serialize(CreatePersonInstructionDataSchema, this))
}
}
const CreatePersonInstructionDataSchema = new Map([
[ CreatePersonInstructionData, {
kind: 'struct',
fields: [
['instruction', 'u8'],
['name', 'string'],
['authority', [32]],
],
}]
])
function derivePersonAddress(programId: PublicKey, id: number): PublicKey {
return PublicKey.findProgramAddressSync(
[Buffer.from("person"), Buffer.from(Uint8Array.of(id))],
programId
)[0]
}
function createInstruction(
index: PublicKey,
newRecord: PublicKey,
payer: PublicKey,
programId: PublicKey,
name: string,
authority: PublicKey,
): TransactionInstruction {
const myInstructionObject = new CreatePersonInstructionData({
instruction: MyInstructions.CreatePerson,
name,
authority,
})
const keys = [
{pubkey: index, isSigner: false, isWritable: true},
{pubkey: newRecord, isSigner: false, isWritable: true},
{pubkey: payer, isSigner: true, isWritable: true},
{pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
]
return new TransactionInstruction({
keys,
programId,
data: myInstructionObject.toBuffer(),
})
}
export async function createCreatePersonInstruction(
payer: PublicKey,
programId: PublicKey,
name: string,
authority: PublicKey,
): Promise<TransactionInstruction> {
const index = await fetchIndex(programId)
const currentId = index[1].get("person");
assert(currentId != undefined)
const newRecord = derivePersonAddress(programId, currentId + 1)
return createInstruction(index[0], newRecord, payer, programId, name, authority)
}
export async function createReadPersonInstruction(
programId: PublicKey,
): Promise<TransactionInstruction> {
const index = await fetchIndex(programId)
const currentId = index[1].get("person");
assert(currentId != undefined)
const record = derivePersonAddress(programId, currentId + 1) // TODO
return createBaseInstruction(
programId,
MyInstructions.ReadPerson,
[
{pubkey: index[0], isSigner: false, isWritable: false},
{pubkey: record, isSigner: false, isWritable: false},
],
)
}
| 0
|
solana_public_repos/nautilus-project/nautilus/tests/tests
|
solana_public_repos/nautilus-project/nautilus/tests/tests/accounts/test.ts
|
import {
it,
describe,
} from 'mocha'
import {
Keypair,
sendAndConfirmTransaction,
Transaction,
TransactionInstruction,
} from '@solana/web3.js'
import { PAYER, PROGRAM_ACCOUNTS, TEST_CONFIGS } from '../const'
import {
createCreateCarInstruction,
createCreateHomeInstruction,
createCreatePersonInstruction,
createReadCarInstruction,
createReadHomeInstruction,
createReadPersonInstruction,
} from './instructions'
describe("Nautilus Unit Tests: Create Accounts", async () => {
const connection = TEST_CONFIGS.connection
const payer = PAYER
const program = PROGRAM_ACCOUNTS
const personName = "Joe"
const personAuthority = Keypair.generate().publicKey
const homeHouseNumber = 15
const homeStreet = "Solana St."
const homeSomeRandomPubkey = Keypair.generate().publicKey
const carMake = "Chevrolet"
const carModel = "Corvette"
const carPurchaseAuthority = Keypair.generate().publicKey
const carOperatingAuthority = Keypair.generate().publicKey
async function test(ix: TransactionInstruction, signers: Keypair[]) {
TEST_CONFIGS.sleep()
let sx = await sendAndConfirmTransaction(
connection,
new Transaction().add(ix),
signers,
{skipPreflight: true}
)
console.log(`\n\n [INFO]: sig: ${sx}\n`)
}
it("Create Person", async () => test(
await createCreatePersonInstruction(payer.publicKey, program.publicKey, personName, personAuthority),
[payer],
))
it("Read Person", async () => test(
await createReadPersonInstruction(program.publicKey, personAuthority),
[payer],
))
it("Create Home", async () => test(
createCreateHomeInstruction(payer.publicKey, program.publicKey, homeHouseNumber, homeStreet, homeSomeRandomPubkey),
[payer],
))
it("Read Home", async () => test(
createReadHomeInstruction(program.publicKey, homeSomeRandomPubkey),
[payer],
))
it("Create Car", async () => test(
await createCreateCarInstruction(payer.publicKey, program.publicKey, carMake, carModel, carPurchaseAuthority, carOperatingAuthority),
[payer],
))
it("Read Car", async () => test(
await createReadCarInstruction(program.publicKey, carPurchaseAuthority, carOperatingAuthority),
[payer],
))
})
| 0
|
solana_public_repos/nautilus-project/nautilus/tests/tests/accounts
|
solana_public_repos/nautilus-project/nautilus/tests/tests/accounts/instructions/car.ts
|
import * as borsh from "borsh"
import { Buffer } from "buffer"
import {
PublicKey,
SystemProgram,
SYSVAR_RENT_PUBKEY,
TransactionInstruction
} from '@solana/web3.js'
import { createBaseInstruction, MyInstructions } from "."
import assert from "assert"
class CreateCarInstructionData {
instruction: MyInstructions
make: string
model: string
purchase_authority: Uint8Array
operating_authority: Uint8Array
constructor(props: {
instruction: MyInstructions,
make: string,
model: string,
purchase_authority: PublicKey,
operating_authority: PublicKey,
}) {
this.instruction = props.instruction
this.make = props.make
this.model = props.model
this.purchase_authority = props.purchase_authority.toBuffer()
this.operating_authority = props.operating_authority.toBuffer()
}
toBuffer() {
return Buffer.from(borsh.serialize(CreateCarInstructionDataSchema, this))
}
}
const CreateCarInstructionDataSchema = new Map([
[ CreateCarInstructionData, {
kind: 'struct',
fields: [
['instruction', 'u8'],
['make', 'string'],
['model', 'string'],
['purchase_authority', [32]],
['operating_authority', [32]],
],
}]
])
function deriveCarAddress(programId: PublicKey, purchaseAuthority: PublicKey, operatingAuthority: PublicKey): PublicKey {
return PublicKey.findProgramAddressSync(
[Buffer.from("car"), purchaseAuthority.toBuffer(), operatingAuthority.toBuffer()],
programId
)[0]
}
function createInstruction(
newRecord: PublicKey,
payer: PublicKey,
programId: PublicKey,
make: string,
model: string,
purchase_authority: PublicKey,
operating_authority: PublicKey,
): TransactionInstruction {
const myInstructionObject = new CreateCarInstructionData({
instruction: MyInstructions.CreateCar,
make,
model,
purchase_authority,
operating_authority,
})
const keys = [
{pubkey: newRecord, isSigner: false, isWritable: true},
{pubkey: payer, isSigner: true, isWritable: true},
{pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
]
return new TransactionInstruction({
keys,
programId,
data: myInstructionObject.toBuffer(),
})
}
export async function createCreateCarInstruction(
payer: PublicKey,
programId: PublicKey,
make: string,
model: string,
purchaseAuthority: PublicKey,
operatingAuthority: PublicKey,
): Promise<TransactionInstruction> {
const newRecord = deriveCarAddress(programId, purchaseAuthority, operatingAuthority)
return createInstruction(newRecord, payer, programId, make, model, purchaseAuthority, operatingAuthority)
}
export async function createReadCarInstruction(
programId: PublicKey,
purchaseAuthority: PublicKey,
operatingAuthority: PublicKey,
): Promise<TransactionInstruction> {
const record = deriveCarAddress(programId, purchaseAuthority, operatingAuthority) // TODO
return createBaseInstruction(
programId,
MyInstructions.ReadCar,
[
{pubkey: record, isSigner: false, isWritable: false},
],
)
}
| 0
|
solana_public_repos/nautilus-project/nautilus/tests/tests/accounts
|
solana_public_repos/nautilus-project/nautilus/tests/tests/accounts/instructions/index.ts
|
export * from './car'
export * from './home'
export * from './person'
import { PublicKey, SYSVAR_RENT_PUBKEY, SystemProgram, TransactionInstruction } from '@solana/web3.js'
import * as borsh from "borsh"
import { Buffer } from "buffer"
import { TEST_CONFIGS } from '../../const'
export enum MyInstructions {
CreatePerson,
ReadPerson,
CreateHome,
ReadHome,
CreateCar,
ReadCar,
}
export class BaseInstructionData {
instruction: MyInstructions
constructor(props: {
instruction: MyInstructions,
}) {
this.instruction = props.instruction
}
toBuffer() {
return Buffer.from(borsh.serialize(BaseInstructionDataSchema, this))
}
}
const BaseInstructionDataSchema = new Map([
[ BaseInstructionData, {
kind: 'struct',
fields: [
['instruction', 'u8'],
],
}]
])
export function createBaseInstruction(
programId: PublicKey,
instruction: MyInstructions,
keys: {pubkey: PublicKey, isSigner: boolean, isWritable: boolean}[],
): TransactionInstruction {
const myInstructionObject = new BaseInstructionData({instruction})
return new TransactionInstruction({
keys,
programId,
data: myInstructionObject.toBuffer(),
})
}
| 0
|
solana_public_repos/nautilus-project/nautilus/tests/tests/accounts
|
solana_public_repos/nautilus-project/nautilus/tests/tests/accounts/instructions/home.ts
|
import * as borsh from "borsh"
import { Buffer } from "buffer"
import {
PublicKey,
SystemProgram,
SYSVAR_RENT_PUBKEY,
TransactionInstruction
} from '@solana/web3.js'
import { createBaseInstruction, MyInstructions } from "."
class CreateHomeInstructionData {
instruction: MyInstructions
house_number: number
street: string
some_pubkey: Uint8Array
constructor(props: {
instruction: MyInstructions,
house_number: number,
street: string,
some_pubkey: PublicKey,
}) {
this.instruction = props.instruction
this.house_number = props.house_number
this.street = props.street
this.some_pubkey = props.some_pubkey.toBuffer()
}
toBuffer() {
return Buffer.from(borsh.serialize(CreateHomeInstructionDataSchema, this))
}
}
const CreateHomeInstructionDataSchema = new Map([
[ CreateHomeInstructionData, {
kind: 'struct',
fields: [
['instruction', 'u8'],
['house_number', 'u8'],
['street', 'string'],
['some_pubkey', [32]],
],
}]
])
function deriveHomeAddress(programId: PublicKey, somePubkey: PublicKey): PublicKey {
return PublicKey.findProgramAddressSync(
[Buffer.from("home"), somePubkey.toBuffer()],
programId
)[0]
}
function createInstruction(
newAccount: PublicKey,
payer: PublicKey,
programId: PublicKey,
house_number: number,
street: string,
some_pubkey: PublicKey,
): TransactionInstruction {
const myInstructionObject = new CreateHomeInstructionData({
instruction: MyInstructions.CreateHome,
house_number,
street,
some_pubkey,
})
const keys = [
{pubkey: newAccount, isSigner: false, isWritable: true},
{pubkey: payer, isSigner: true, isWritable: true},
{pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
]
return new TransactionInstruction({
keys,
programId,
data: myInstructionObject.toBuffer(),
})
}
export function createCreateHomeInstruction(
payer: PublicKey,
programId: PublicKey,
house_number: number,
street: string,
somePubkey: PublicKey,
): TransactionInstruction {
const newAccount = deriveHomeAddress(programId, somePubkey)
return createInstruction(newAccount, payer, programId, house_number, street, somePubkey)
}
export function createReadHomeInstruction(
programId: PublicKey,
somePubkey: PublicKey,
): TransactionInstruction {
const account = deriveHomeAddress(programId, somePubkey)
return createBaseInstruction(
programId,
MyInstructions.ReadHome,
[
{pubkey: account, isSigner: false, isWritable: false},
],
)
}
| 0
|
solana_public_repos/nautilus-project/nautilus/tests/tests/accounts
|
solana_public_repos/nautilus-project/nautilus/tests/tests/accounts/instructions/person.ts
|
import * as borsh from "borsh"
import { Buffer } from "buffer"
import {
PublicKey,
SystemProgram,
SYSVAR_RENT_PUBKEY,
TransactionInstruction
} from '@solana/web3.js'
import { createBaseInstruction, MyInstructions } from "."
import assert from "assert"
class CreatePersonInstructionData {
instruction: MyInstructions
name: string
authority: Uint8Array
constructor(props: {
instruction: MyInstructions,
name: string,
authority: PublicKey,
}) {
this.instruction = props.instruction
this.name = props.name
this.authority = props.authority.toBuffer()
}
toBuffer() {
return Buffer.from(borsh.serialize(CreatePersonInstructionDataSchema, this))
}
}
const CreatePersonInstructionDataSchema = new Map([
[ CreatePersonInstructionData, {
kind: 'struct',
fields: [
['instruction', 'u8'],
['name', 'string'],
['authority', [32]],
],
}]
])
function derivePersonAddress(programId: PublicKey, authority: PublicKey): PublicKey {
return PublicKey.findProgramAddressSync(
[Buffer.from("person"), authority.toBuffer()],
programId
)[0]
}
function createInstruction(
newAccount: PublicKey,
payer: PublicKey,
programId: PublicKey,
name: string,
authority: PublicKey,
): TransactionInstruction {
const myInstructionObject = new CreatePersonInstructionData({
instruction: MyInstructions.CreatePerson,
name,
authority,
})
const keys = [
{pubkey: newAccount, isSigner: false, isWritable: true},
{pubkey: payer, isSigner: true, isWritable: true},
{pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
]
return new TransactionInstruction({
keys,
programId,
data: myInstructionObject.toBuffer(),
})
}
export async function createCreatePersonInstruction(
payer: PublicKey,
programId: PublicKey,
name: string,
authority: PublicKey,
): Promise<TransactionInstruction> {
const newAccount = derivePersonAddress(programId, authority)
return createInstruction(newAccount, payer, programId, name, authority)
}
export async function createReadPersonInstruction(
programId: PublicKey,
authority: PublicKey,
): Promise<TransactionInstruction> {
const account = derivePersonAddress(programId, authority) // TODO
return createBaseInstruction(
programId,
MyInstructions.ReadPerson,
[
{pubkey: account, isSigner: false, isWritable: false},
],
)
}
| 0
|
solana_public_repos/nautilus-project/nautilus/tests/tests
|
solana_public_repos/nautilus-project/nautilus/tests/tests/wallets/test.ts
|
import {
it,
describe,
} from 'mocha'
import {
Keypair,
LAMPORTS_PER_SOL,
PublicKey,
sendAndConfirmTransaction,
Transaction,
TransactionInstruction,
} from '@solana/web3.js'
import { PAYER, PROGRAM_WALLETS, TEST_CONFIGS } from '../const'
import {
createAllocateWalletInstruction,
createComplexInstruction,
createCreateWalletInstruction,
createCreateWalletWithPayerInstruction,
createReadWalletInstruction,
createTransferInstruction,
} from './instructions'
import { createAssignInstruction } from './instructions/assign'
describe("Nautilus Unit Tests: Wallets", async () => {
const connection = TEST_CONFIGS.connection
const payer = PAYER
const program = PROGRAM_WALLETS
const rent_payer = Keypair.generate()
const newWallet = Keypair.generate()
const newWalletToBeAllocated = Keypair.generate()
const newWalletToBeAssignedAway = Keypair.generate()
const newWalletWithPayer = Keypair.generate()
const transferAmount = LAMPORTS_PER_SOL / 1000
// Complex instruction
const compAuthority1 = Keypair.generate()
const compAuthority2 = Keypair.generate()
const compRentPayer1 = Keypair.generate()
const compRentPayer2 = Keypair.generate()
const compTransferRecipient = Keypair.generate()
const compWalletToAllocate = Keypair.generate()
const compWalletToCreate = Keypair.generate()
const compWalletToCreateWithTransferSafe = Keypair.generate()
const compWalletToCreateWithTransferUnsafe = Keypair.generate()
const compFundAmount = LAMPORTS_PER_SOL / 1000
const compTransferAmount = LAMPORTS_PER_SOL / 1000
async function initAccount(publicKey: PublicKey) {
await TEST_CONFIGS.sleep()
connection.confirmTransaction(
await connection.requestAirdrop(publicKey, LAMPORTS_PER_SOL / 100)
)
}
async function initTestAccounts() {
initAccount(rent_payer.publicKey)
initAccount(compRentPayer1.publicKey)
initAccount(compRentPayer2.publicKey)
initAccount(compAuthority2.publicKey)
}
async function test(ix: TransactionInstruction, signers: Keypair[]) {
await TEST_CONFIGS.sleep()
let sx = await sendAndConfirmTransaction(
connection,
new Transaction().add(ix),
signers,
{skipPreflight: true}
)
console.log(`\n\n [INFO]: sig: ${sx}\n`)
}
before(async () => {
await TEST_CONFIGS.sleep()
initTestAccounts()
})
// Wallets
it("Allocate Wallet", async () => test(
createAllocateWalletInstruction(newWalletToBeAllocated.publicKey, payer.publicKey, program.publicKey),
[payer, newWalletToBeAllocated],
))
it("Create Wallet to be assigned away", async () => test(
createCreateWalletInstruction(newWalletToBeAssignedAway.publicKey, payer.publicKey, program.publicKey),
[payer, newWalletToBeAssignedAway],
))
it("Assign away Wallet", async () => test(
createAssignInstruction(newWalletToBeAssignedAway.publicKey, program.publicKey, program.publicKey),
[payer, newWalletToBeAssignedAway],
))
it("Create Wallet", async () => test(
createCreateWalletInstruction(newWallet.publicKey, payer.publicKey, program.publicKey),
[payer, newWallet],
))
it("Read Wallet", async () => test(
createReadWalletInstruction(newWallet.publicKey, program.publicKey),
[payer],
))
it("Create Wallet with Payer", async () => test(
createCreateWalletWithPayerInstruction(newWalletWithPayer.publicKey, payer.publicKey, program.publicKey),
[payer, newWalletWithPayer],
))
it("Read Wallet Created With Payer", async () => test(
createReadWalletInstruction(newWalletWithPayer.publicKey, program.publicKey),
[payer],
))
it("Transfer", async () => test(
createTransferInstruction(payer.publicKey, newWallet.publicKey, program.publicKey, transferAmount),
[payer],
))
it("Complex", async () => test(
createComplexInstruction(
compAuthority1.publicKey,
compAuthority2.publicKey,
compRentPayer1.publicKey,
compRentPayer2.publicKey,
compTransferRecipient.publicKey,
compWalletToAllocate.publicKey,
compWalletToCreate.publicKey,
compWalletToCreateWithTransferSafe.publicKey,
compWalletToCreateWithTransferUnsafe.publicKey,
payer.publicKey,
program.publicKey,
compFundAmount,
compTransferAmount,
),
[
payer,
compAuthority1,
compAuthority2,
compRentPayer1,
compRentPayer2,
compWalletToAllocate,
compWalletToCreate,
],
))
})
| 0
|
solana_public_repos/nautilus-project/nautilus/tests/tests/wallets
|
solana_public_repos/nautilus-project/nautilus/tests/tests/wallets/instructions/wallet.ts
|
import {
PublicKey,
SystemProgram,
SYSVAR_RENT_PUBKEY,
TransactionInstruction
} from '@solana/web3.js'
import { MyInstructions, createBaseInstruction } from "."
export function createAllocateWalletInstruction(
newWallet: PublicKey,
payer: PublicKey,
programId: PublicKey,
): TransactionInstruction {
return createBaseInstruction(
programId,
MyInstructions.Allocate,
[
{pubkey: newWallet, isSigner: true, isWritable: true},
{pubkey: payer, isSigner: true, isWritable: true},
{pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
],
)
}
export function createCreateWalletInstruction(
newWallet: PublicKey,
payer: PublicKey,
programId: PublicKey,
): TransactionInstruction {
return createBaseInstruction(
programId,
MyInstructions.Create,
[
{pubkey: newWallet, isSigner: true, isWritable: true},
{pubkey: payer, isSigner: true, isWritable: true},
{pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
],
)
}
export function createReadWalletInstruction(
newWallet: PublicKey,
programId: PublicKey,
): TransactionInstruction {
return createBaseInstruction(
programId,
MyInstructions.Read,
[
{pubkey: newWallet, isSigner: false, isWritable: false},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
],
)
}
export function createCreateWalletWithPayerInstruction(
newWallet: PublicKey,
payer: PublicKey,
programId: PublicKey,
): TransactionInstruction {
return createBaseInstruction(
programId,
MyInstructions.CreateWithPayer,
[
{pubkey: newWallet, isSigner: true, isWritable: true},
{pubkey: payer, isSigner: true, isWritable: true},
{pubkey: payer, isSigner: true, isWritable: true},
{pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
]
)
}
| 0
|
solana_public_repos/nautilus-project/nautilus/tests/tests/wallets
|
solana_public_repos/nautilus-project/nautilus/tests/tests/wallets/instructions/complex.ts
|
import * as borsh from "borsh"
import { Buffer } from "buffer"
import {
PublicKey,
SYSVAR_RENT_PUBKEY,
SystemProgram,
TransactionInstruction
} from '@solana/web3.js'
import { MyInstructions } from "."
class ComplexInstructionData {
instruction: MyInstructions
amount_to_fund: number
amount_to_transfer: number
constructor(props: {
instruction: MyInstructions,
amount_to_fund: number,
amount_to_transfer: number,
}) {
this.instruction = props.instruction
this.amount_to_fund = props.amount_to_fund
this.amount_to_transfer = props.amount_to_transfer
}
toBuffer() {
return Buffer.from(borsh.serialize(ComplexInstructionDataSchema, this))
}
}
const ComplexInstructionDataSchema = new Map([
[ ComplexInstructionData, {
kind: 'struct',
fields: [
['instruction', 'u8'],
['amount_to_fund', 'u64'],
['amount_to_transfer', 'u64'],
],
}]
])
function createInstruction(
authority1: PublicKey,
authority2: PublicKey,
rentPayer1: PublicKey,
rentPayer2: PublicKey,
transferRecipient: PublicKey,
walletAllocate: PublicKey,
walletCreate: PublicKey,
walletCreateWithTransferSafe: PublicKey,
walletCreateWithTransferUnsafe: PublicKey,
payer: PublicKey,
programId: PublicKey,
amount_to_fund: number,
amount_to_transfer: number,
instruction: MyInstructions,
): TransactionInstruction {
const myInstructionObject = new ComplexInstructionData({instruction, amount_to_fund, amount_to_transfer})
const keys = [
{pubkey: authority1, isSigner: true, isWritable: true},
{pubkey: authority2, isSigner: true, isWritable: true},
{pubkey: rentPayer1, isSigner: true, isWritable: true},
{pubkey: rentPayer2, isSigner: true, isWritable: true},
{pubkey: transferRecipient, isSigner: false, isWritable: true},
{pubkey: walletAllocate, isSigner: true, isWritable: true},
{pubkey: walletCreate, isSigner: true, isWritable: true},
{pubkey: walletCreateWithTransferSafe, isSigner: false, isWritable: true},
{pubkey: walletCreateWithTransferUnsafe, isSigner: false, isWritable: true},
{pubkey: payer, isSigner: true, isWritable: true},
{pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
]
return new TransactionInstruction({
keys,
programId,
data: myInstructionObject.toBuffer(),
})
}
export function createComplexInstruction(
authority1: PublicKey,
authority2: PublicKey,
rentPayer1: PublicKey,
rentPayer2: PublicKey,
transferRecipient: PublicKey,
walletAllocate: PublicKey,
walletCreate: PublicKey,
walletCreateWithTransferSafe: PublicKey,
walletCreateWithTransferUnsafe: PublicKey,
payer: PublicKey,
programId: PublicKey,
amountToFund: number,
amountToTransfer: number,
): TransactionInstruction {
return createInstruction(
authority1,
authority2,
rentPayer1,
rentPayer2,
transferRecipient,
walletAllocate,
walletCreate,
walletCreateWithTransferSafe,
walletCreateWithTransferUnsafe,
payer,
programId,
amountToFund,
amountToTransfer,
MyInstructions.Complex,
)
}
| 0
|
solana_public_repos/nautilus-project/nautilus/tests/tests/wallets
|
solana_public_repos/nautilus-project/nautilus/tests/tests/wallets/instructions/assign.ts
|
import * as borsh from "borsh"
import { Buffer } from "buffer"
import {
PublicKey,
SystemProgram,
TransactionInstruction
} from '@solana/web3.js'
import { MyInstructions } from "."
class AssignInstructionData {
instruction: MyInstructions
owner: Uint8Array
constructor(props: {
instruction: MyInstructions,
owner: PublicKey,
}) {
this.instruction = props.instruction
this.owner = props.owner.toBuffer()
}
toBuffer() {
return Buffer.from(borsh.serialize(AssignInstructionDataSchema, this))
}
}
const AssignInstructionDataSchema = new Map([
[ AssignInstructionData, {
kind: 'struct',
fields: [
['instruction', 'u8'],
['owner', [32]],
],
}]
])
function createInstruction(
wallet: PublicKey,
programId: PublicKey,
owner: PublicKey,
instruction: MyInstructions,
): TransactionInstruction {
const myInstructionObject = new AssignInstructionData({instruction, owner})
const keys = [
{pubkey: wallet, isSigner: true, isWritable: true},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
]
return new TransactionInstruction({
keys,
programId,
data: myInstructionObject.toBuffer(),
})
}
export function createAssignInstruction(
wallet: PublicKey,
programId: PublicKey,
owner: PublicKey,
): TransactionInstruction {
return createInstruction(wallet, programId, owner, MyInstructions.Assign)
}
| 0
|
solana_public_repos/nautilus-project/nautilus/tests/tests/wallets
|
solana_public_repos/nautilus-project/nautilus/tests/tests/wallets/instructions/transfer.ts
|
import * as borsh from "borsh"
import { Buffer } from "buffer"
import {
PublicKey,
SystemProgram,
TransactionInstruction
} from '@solana/web3.js'
import { MyInstructions } from "."
class TransferInstructionData {
instruction: MyInstructions
amount: number
constructor(props: {
instruction: MyInstructions,
amount: number,
}) {
this.instruction = props.instruction
this.amount = props.amount
}
toBuffer() {
return Buffer.from(borsh.serialize(TransferInstructionDataSchema, this))
}
}
const TransferInstructionDataSchema = new Map([
[ TransferInstructionData, {
kind: 'struct',
fields: [
['instruction', 'u8'],
['amount', 'u64'],
],
}]
])
function createInstruction(
from: PublicKey,
to: PublicKey,
programId: PublicKey,
amount: number,
instruction: MyInstructions,
): TransactionInstruction {
const myInstructionObject = new TransferInstructionData({instruction, amount})
const keys = [
{pubkey: from, isSigner: true, isWritable: true},
{pubkey: to, isSigner: false, isWritable: true},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
]
return new TransactionInstruction({
keys,
programId,
data: myInstructionObject.toBuffer(),
})
}
export function createTransferInstruction(
from: PublicKey,
to: PublicKey,
programId: PublicKey,
amount: number,
): TransactionInstruction {
return createInstruction(from, to, programId, amount, MyInstructions.Transfer)
}
| 0
|
solana_public_repos/nautilus-project/nautilus/tests/tests/wallets
|
solana_public_repos/nautilus-project/nautilus/tests/tests/wallets/instructions/index.ts
|
export * from './complex'
export * from './transfer'
export * from './wallet'
import { PublicKey, TransactionInstruction } from '@solana/web3.js'
import * as borsh from "borsh"
import { Buffer } from "buffer"
export enum MyInstructions {
Allocate,
Assign,
Create,
CreateWithPayer,
Read,
Transfer,
Complex,
}
export class BaseInstructionData {
instruction: MyInstructions
constructor(props: {
instruction: MyInstructions,
}) {
this.instruction = props.instruction
}
toBuffer() {
return Buffer.from(borsh.serialize(BaseInstructionDataSchema, this))
}
}
const BaseInstructionDataSchema = new Map([
[ BaseInstructionData, {
kind: 'struct',
fields: [
['instruction', 'u8'],
],
}]
])
export function createBaseInstruction(
programId: PublicKey,
instruction: MyInstructions,
keys: {pubkey: PublicKey, isSigner: boolean, isWritable: boolean}[],
): TransactionInstruction {
const myInstructionObject = new BaseInstructionData({instruction})
return new TransactionInstruction({
keys,
programId,
data: myInstructionObject.toBuffer(),
})
}
| 0
|
solana_public_repos/nautilus-project/nautilus/tests/tests
|
solana_public_repos/nautilus-project/nautilus/tests/tests/tokens/test.ts
|
import {
it,
describe,
} from 'mocha'
import {
Keypair,
LAMPORTS_PER_SOL,
PublicKey,
sendAndConfirmTransaction,
Transaction,
TransactionInstruction,
} from '@solana/web3.js'
import { PAYER, PROGRAM_TOKENS, TEST_CONFIGS } from '../const'
import {
MyInstructions,
createBurnTokensInstruction,
createCreateAssociatedTokenInstruction,
createCreateAssociatedTokenWithPayerInstruction,
createCreateMetadataInstruction,
createCreateMetadataWithPayerInstruction,
createCreateMintInstruction,
createCreateMintWithPayerInstruction,
createCreateNftInstruction,
createCreateNftWithPayerInstruction,
createCreateTokenInstruction,
createCreateTokenWithPayerInstruction,
createFreezeAssociatedTokenInstruction,
createMintDisableMintingInstruction,
createMintMintToInstruction,
createNftMintToInstruction,
createReadAssociatedTokenInstruction,
createReadMetadataInstruction,
createReadMintInstruction,
createReadNftInstruction,
createReadTokenInstruction,
createThawAssociatedTokenInstruction,
createTokenDisableMintingInstruction,
createTokenMintToInstruction,
createTransferTokensInstruction,
} from './instructions'
describe("Nautilus Unit Tests: Tokens", async () => {
const skipMetadata = TEST_CONFIGS.skipMetadata // `true` for localnet
const connection = TEST_CONFIGS.connection
const payer = PAYER
const program = PROGRAM_TOKENS
const rent_payer = Keypair.generate()
const testWallet1 = Keypair.generate()
const testWallet2 = Keypair.generate()
const newMint = Keypair.generate()
const newMintWithPayer = Keypair.generate()
const mintMintAmount = 20
const mintTransferAmount = 5
const mintBurnAmount = 5
const newTokenMint = Keypair.generate()
const newTokenMintWithPayer = Keypair.generate()
const tokenMintAmount = 20
const tokenTransferAmount = 5
const tokenBurnAmount = 5
const tokenDecimals = 9
const tokenTitle = "Nautilus Token"
const tokenSymbol = "NTLS"
const tokenUri = "NTLS"
const newNftMint = Keypair.generate()
const newNftMintWithPayer = Keypair.generate()
const nftTitle = "Nautilus NFT"
const nftSymbol = "NTLS"
const nftUri = "NTLS"
async function initAccount(publicKey: PublicKey) {
await TEST_CONFIGS.sleep()
connection.confirmTransaction(
await connection.requestAirdrop(publicKey, LAMPORTS_PER_SOL / 100)
)
}
async function initTestAccounts() {
initAccount(rent_payer.publicKey)
initAccount(testWallet1.publicKey)
initAccount(testWallet2.publicKey)
}
async function test(ix: TransactionInstruction, signers: Keypair[]) {
await TEST_CONFIGS.sleep()
let sx = await sendAndConfirmTransaction(
connection,
new Transaction().add(ix),
signers,
{skipPreflight: true}
)
console.log(`\n\n [INFO]: sig: ${sx}\n`)
}
before(async () => {
if (skipMetadata) console.log(" [WARN]: `skipMetadata` is set to `true`, so tests for Metadata and Token will not execute & will automatically pass.")
await TEST_CONFIGS.sleep()
initTestAccounts()
})
// Mints
it("Create Mint", async () => test(
createCreateMintInstruction(newMint.publicKey, payer.publicKey, program.publicKey, tokenDecimals),
[payer, newMint],
))
it("Read Mint", async () => test(
createReadMintInstruction(newMint.publicKey, program.publicKey),
[payer],
))
it("Create Mint with Payer", async () => test(
createCreateMintWithPayerInstruction(newMintWithPayer.publicKey, payer.publicKey, program.publicKey, tokenDecimals),
[payer, newMintWithPayer],
))
it("Read Mint Created With Payer", async () => test(
createReadMintInstruction(newMintWithPayer.publicKey, program.publicKey),
[payer],
))
// Metadatas
it("Create Metadata", async () => {if (!skipMetadata) return test(
createCreateMetadataInstruction(newMint.publicKey, payer.publicKey, program.publicKey, tokenTitle, tokenSymbol, tokenUri),
[payer],
)})
it("Read Metadata", async () => {if (!skipMetadata) return test(
createReadMetadataInstruction(newMint.publicKey, program.publicKey),
[payer],
)})
it("Create Metadata with Payer", async () => {if (!skipMetadata) return test(
createCreateMetadataWithPayerInstruction(newMintWithPayer.publicKey, payer.publicKey, program.publicKey, tokenTitle, tokenSymbol, tokenUri),
[payer],
)})
it("Read Metadata Created With Payer", async () => {if (!skipMetadata) return test(
createReadMetadataInstruction(newMintWithPayer.publicKey, program.publicKey),
[payer],
)})
// Associated Token Accounts
it("Create Associated Token", async () => test(
createCreateAssociatedTokenInstruction(newMint.publicKey, testWallet1.publicKey, payer.publicKey, program.publicKey),
[payer],
))
it("Read Associated Token", async () => test(
createReadAssociatedTokenInstruction(newMint.publicKey, testWallet1.publicKey, program.publicKey),
[payer],
))
it("Freeze Associated Token", async () => test(
createFreezeAssociatedTokenInstruction(newMint.publicKey, testWallet1.publicKey, payer.publicKey, program.publicKey),
[payer],
))
it("Thaw Associated Token", async () => test(
createThawAssociatedTokenInstruction(newMint.publicKey, testWallet1.publicKey, payer.publicKey, program.publicKey),
[payer],
))
it("Create Associated Token with Payer", async () => test(
createCreateAssociatedTokenWithPayerInstruction(newMintWithPayer.publicKey, testWallet1.publicKey, payer.publicKey, program.publicKey),
[payer],
))
it("Read Associated Token Created With Payer", async () => test(
createReadAssociatedTokenInstruction(newMintWithPayer.publicKey, testWallet1.publicKey, program.publicKey),
[payer],
))
// Tokens
it("Create Token", async () => {if (!skipMetadata) return test(
createCreateTokenInstruction(newTokenMint.publicKey, payer.publicKey, program.publicKey, tokenDecimals, tokenTitle, tokenSymbol, tokenUri),
[payer, newTokenMint],
)})
it("Read Token", async () => {if (!skipMetadata) return test(
createReadTokenInstruction(newTokenMint.publicKey, program.publicKey),
[payer],
)})
it("Create Token with Payer", async () => {if (!skipMetadata) return test(
createCreateTokenWithPayerInstruction(newTokenMintWithPayer.publicKey, payer.publicKey, program.publicKey, tokenDecimals, tokenTitle, tokenSymbol, tokenUri),
[payer, newTokenMintWithPayer],
)})
it("Read Token Created With Payer", async () => {if (!skipMetadata) return test(
createReadTokenInstruction(newTokenMintWithPayer.publicKey, program.publicKey),
[payer],
)})
// NFTs
it("Create NFT", async () => {if (!skipMetadata) return test(
createCreateNftInstruction(newNftMint.publicKey, payer.publicKey, program.publicKey, nftTitle, nftSymbol, nftUri),
[payer, newNftMint],
)})
it("Read NFT", async () => {if (!skipMetadata) return test(
createReadNftInstruction(newNftMint.publicKey, program.publicKey),
[payer],
)})
it("Create NFT with Payer", async () => {if (!skipMetadata) return test(
createCreateNftWithPayerInstruction(newNftMintWithPayer.publicKey, payer.publicKey, program.publicKey, nftTitle, nftSymbol, nftUri),
[payer, newNftMintWithPayer],
)})
it("Read NFT Created With Payer", async () => {if (!skipMetadata) return test(
createReadNftInstruction(newTokenMintWithPayer.publicKey, program.publicKey),
[payer],
)})
// Minting & Transferring
it("Mint: Mint To", async () => test(
createMintMintToInstruction(newMint.publicKey, testWallet1.publicKey, payer.publicKey, program.publicKey, mintMintAmount),
[payer],
))
it("Mint: Burn", async () => test(
createBurnTokensInstruction(newMint.publicKey, testWallet1.publicKey, program.publicKey, mintBurnAmount),
[payer, testWallet1],
))
it("Mint: Create Associated Token For Transfer", async () => test(
createCreateAssociatedTokenInstruction(newMint.publicKey, testWallet2.publicKey, payer.publicKey, program.publicKey),
[payer],
))
it("Mint: Transfer", async () => test(
createTransferTokensInstruction(newMint.publicKey, testWallet1.publicKey, testWallet2.publicKey, program.publicKey, mintTransferAmount),
[payer, testWallet1],
))
it("Mint: Disable Minting", async () => test(
createMintDisableMintingInstruction(MyInstructions.MintDisableMinting, newMint.publicKey, payer.publicKey, program.publicKey),
[payer],
))
it("Token: Create Associated Token For MintTo", async () => {if (!skipMetadata) return test(
createCreateAssociatedTokenInstruction(newTokenMint.publicKey, testWallet1.publicKey, payer.publicKey, program.publicKey),
[payer],
)})
it("Token: Mint To", async () => {if (!skipMetadata) return test(
createTokenMintToInstruction(newTokenMint.publicKey, testWallet1.publicKey, payer.publicKey, program.publicKey, tokenMintAmount),
[payer],
)})
it("Token: Burn", async () => {if (!skipMetadata) return test(
createBurnTokensInstruction(newTokenMint.publicKey, testWallet1.publicKey, program.publicKey, tokenBurnAmount),
[payer, testWallet1],
)})
it("Token: Create Associated Token For Transfer", async () => {if (!skipMetadata) return test(
createCreateAssociatedTokenInstruction(newTokenMint.publicKey, testWallet2.publicKey, payer.publicKey, program.publicKey),
[payer],
)})
it("Token: Transfer", async () => {if (!skipMetadata) return test(
createTransferTokensInstruction(newTokenMint.publicKey, testWallet1.publicKey, testWallet2.publicKey, program.publicKey, tokenTransferAmount),
[payer, testWallet1],
)})
it("Token: Disable Minting", async () => {if (!skipMetadata) return test(
createTokenDisableMintingInstruction(MyInstructions.TokenDisableMinting, newTokenMint.publicKey, payer.publicKey, program.publicKey),
[payer],
)})
it("NFT: Create Associated Token For MintTo", async () => {if (!skipMetadata) return test(
createCreateAssociatedTokenInstruction(newNftMint.publicKey, testWallet1.publicKey, payer.publicKey, program.publicKey),
[payer],
)})
it("NFT: Mint To", async () => {if (!skipMetadata) return test(
createNftMintToInstruction(newNftMint.publicKey, testWallet1.publicKey, payer.publicKey, program.publicKey),
[payer],
)})
})
| 0
|
solana_public_repos/nautilus-project/nautilus/tests/tests/tokens
|
solana_public_repos/nautilus-project/nautilus/tests/tests/tokens/instructions/mint.ts
|
import * as borsh from "borsh"
import { Buffer } from "buffer"
import { ASSOCIATED_TOKEN_PROGRAM_ID, getAssociatedTokenAddressSync, TOKEN_PROGRAM_ID } from '@solana/spl-token'
import {
PublicKey,
SystemProgram,
SYSVAR_RENT_PUBKEY,
TransactionInstruction
} from '@solana/web3.js'
import { createBaseInstruction, MyInstructions } from "."
// Create
class CreateMintInstructionData {
instruction: MyInstructions
decimals: number
constructor(props: {
instruction: MyInstructions,
decimals: number,
}) {
this.instruction = props.instruction
this.decimals = props.decimals
}
toBuffer() {
return Buffer.from(borsh.serialize(CreateMintInstructionDataSchema, this))
}
}
const CreateMintInstructionDataSchema = new Map([
[ CreateMintInstructionData, {
kind: 'struct',
fields: [
['instruction', 'u8'],
['decimals', 'u8'],
],
}]
])
function createCreateInstruction(
newMint: PublicKey,
payer: PublicKey,
programId: PublicKey,
decimals: number,
instruction: MyInstructions,
): TransactionInstruction {
const myInstructionObject = new CreateMintInstructionData({instruction, decimals})
function deriveKeys(instruction: MyInstructions) {
if (instruction === MyInstructions.CreateMint) return [
{pubkey: payer, isSigner: true, isWritable: true},
{pubkey: newMint, isSigner: true, isWritable: true},
{pubkey: payer, isSigner: true, isWritable: true},
{pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
{pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false},
]
else if (instruction === MyInstructions.CreateMintWithPayer) return [
{pubkey: payer, isSigner: true, isWritable: true},
{pubkey: newMint, isSigner: true, isWritable: true},
{pubkey: payer, isSigner: true, isWritable: true},
{pubkey: payer, isSigner: true, isWritable: true},
{pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
{pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false},
]
return []
}
const keys = deriveKeys(instruction)
return new TransactionInstruction({
keys,
programId,
data: myInstructionObject.toBuffer(),
})
}
export function createCreateMintInstruction(
newMint: PublicKey,
payer: PublicKey,
programId: PublicKey,
decimals: number,
): TransactionInstruction {
return createCreateInstruction(newMint, payer, programId, decimals, MyInstructions.CreateMint)
}
export function createCreateMintWithPayerInstruction(
newMint: PublicKey,
payer: PublicKey,
programId: PublicKey,
decimals: number,
): TransactionInstruction {
return createCreateInstruction(newMint, payer, programId, decimals, MyInstructions.CreateMintWithPayer)
}
// Mint To
class MintMintToInstructionData {
instruction: MyInstructions
amount: number
constructor(props: {
instruction: MyInstructions,
amount: number,
}) {
this.instruction = props.instruction
this.amount = props.amount
}
toBuffer() {
return Buffer.from(borsh.serialize(MintMintToInstructionDataSchema, this))
}
}
const MintMintToInstructionDataSchema = new Map([
[ MintMintToInstructionData, {
kind: 'struct',
fields: [
['instruction', 'u8'],
['amount', 'u64'],
],
}]
])
export function createMintMintToInstruction(
mint: PublicKey,
recipient: PublicKey,
authority: PublicKey,
programId: PublicKey,
amount: number,
): TransactionInstruction {
const myInstructionObject = new MintMintToInstructionData({
instruction: MyInstructions.MintMintTo,
amount,
})
const recipientAssociatedToken = getAssociatedTokenAddressSync(mint, recipient)
const keys = [
{pubkey: authority, isSigner: true, isWritable: true},
{pubkey: mint, isSigner: false, isWritable: true},
{pubkey: recipientAssociatedToken, isSigner: false, isWritable: true},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
{pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false},
{pubkey: ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false},
]
return new TransactionInstruction({
keys,
programId,
data: myInstructionObject.toBuffer(),
})
}
// Disable Minting
export function createMintDisableMintingInstruction(
instruction: MyInstructions,
mint: PublicKey,
authority: PublicKey,
programId: PublicKey,
): TransactionInstruction {
return createBaseInstruction(
programId,
instruction,
[
{pubkey: authority, isSigner: true, isWritable: true},
{pubkey: mint, isSigner: false, isWritable: true},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
{pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false},
],
)
}
// Read
export function createReadMintInstruction(
newMint: PublicKey,
programId: PublicKey,
): TransactionInstruction {
return createBaseInstruction(
programId,
MyInstructions.ReadMint,
[
{pubkey: newMint, isSigner: false, isWritable: false},
{pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false},
],
)
}
| 0
|
solana_public_repos/nautilus-project/nautilus/tests/tests/tokens
|
solana_public_repos/nautilus-project/nautilus/tests/tests/tokens/instructions/associated-token.ts
|
import * as borsh from "borsh"
import { Buffer } from "buffer"
import {
PublicKey,
SystemProgram,
SYSVAR_RENT_PUBKEY,
TransactionInstruction
} from '@solana/web3.js'
import { createBaseInstruction, MyInstructions } from "."
import { ASSOCIATED_TOKEN_PROGRAM_ID, getAssociatedTokenAddressSync, TOKEN_PROGRAM_ID } from "@solana/spl-token"
// Create
class CreateAssociatedTokenInstructionData {
instruction: MyInstructions
constructor(props: {
instruction: MyInstructions,
}) {
this.instruction = props.instruction
}
toBuffer() {
return Buffer.from(borsh.serialize(CreateAssociatedTokenInstructionDataSchema, this))
}
}
const CreateAssociatedTokenInstructionDataSchema = new Map([
[ CreateAssociatedTokenInstructionData, {
kind: 'struct',
fields: [
['instruction', 'u8'],
],
}]
])
function createInstruction(
mint: PublicKey,
owner: PublicKey,
payer: PublicKey,
programId: PublicKey,
instruction: MyInstructions,
): TransactionInstruction {
const myInstructionObject = new CreateAssociatedTokenInstructionData({instruction})
const newAssociatedToken = getAssociatedTokenAddressSync(mint, owner)
function deriveKeys(instruction: MyInstructions) {
if (instruction === MyInstructions.CreateAssociatedToken) return [
{pubkey: mint, isSigner: false, isWritable: false},
{pubkey: newAssociatedToken, isSigner: false, isWritable: true},
{pubkey: owner, isSigner: false, isWritable: false},
{pubkey: payer, isSigner: true, isWritable: true},
{pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
{pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false},
{pubkey: ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false},
]
else if (instruction === MyInstructions.CreateAssociatedTokenWithPayer) return [
{pubkey: mint, isSigner: false, isWritable: false},
{pubkey: newAssociatedToken, isSigner: false, isWritable: true},
{pubkey: owner, isSigner: false, isWritable: false},
{pubkey: payer, isSigner: true, isWritable: true},
{pubkey: payer, isSigner: true, isWritable: true},
{pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
{pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false},
{pubkey: ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false},
]
return []
}
const keys = deriveKeys(instruction)
return new TransactionInstruction({
keys,
programId,
data: myInstructionObject.toBuffer(),
})
}
export function createCreateAssociatedTokenInstruction(
mint: PublicKey,
owner: PublicKey,
payer: PublicKey,
programId: PublicKey,
): TransactionInstruction {
return createInstruction(mint, owner, payer, programId, MyInstructions.CreateAssociatedToken)
}
export function createCreateAssociatedTokenWithPayerInstruction(
mint: PublicKey,
owner: PublicKey,
payer: PublicKey,
programId: PublicKey,
): TransactionInstruction {
return createInstruction(mint, owner, payer, programId, MyInstructions.CreateAssociatedTokenWithPayer)
}
// Burn
class BurnTokensInstructionData {
instruction: MyInstructions
amount: number
constructor(props: {
instruction: MyInstructions,
amount: number,
}) {
this.instruction = props.instruction
this.amount = props.amount
}
toBuffer() {
return Buffer.from(borsh.serialize(BurnTokensInstructionDataSchema, this))
}
}
const BurnTokensInstructionDataSchema = new Map([
[ BurnTokensInstructionData, {
kind: 'struct',
fields: [
['instruction', 'u8'],
['amount', 'u64'],
],
}]
])
export function createBurnTokensInstruction(
mint: PublicKey,
from: PublicKey,
programId: PublicKey,
amount: number,
): TransactionInstruction {
const myInstructionObject = new BurnTokensInstructionData({
instruction: MyInstructions.BurnTokens,
amount,
})
const fromAssociatedToken = getAssociatedTokenAddressSync(mint, from)
const keys = [
{pubkey: from, isSigner: true, isWritable: true},
{pubkey: fromAssociatedToken, isSigner: false, isWritable: true},
{pubkey: mint, isSigner: false, isWritable: true},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
{pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false},
{pubkey: ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false},
]
return new TransactionInstruction({
keys,
programId,
data: myInstructionObject.toBuffer(),
})
}
// Transfer
class TransferTokensInstructionData {
instruction: MyInstructions
amount: number
constructor(props: {
instruction: MyInstructions,
amount: number,
}) {
this.instruction = props.instruction
this.amount = props.amount
}
toBuffer() {
return Buffer.from(borsh.serialize(TransferTokensInstructionDataSchema, this))
}
}
const TransferTokensInstructionDataSchema = new Map([
[ TransferTokensInstructionData, {
kind: 'struct',
fields: [
['instruction', 'u8'],
['amount', 'u64'],
],
}]
])
export function createTransferTokensInstruction(
mint: PublicKey,
from: PublicKey,
to: PublicKey,
programId: PublicKey,
amount: number,
): TransactionInstruction {
const myInstructionObject = new TransferTokensInstructionData({
instruction: MyInstructions.TransferTokens,
amount,
})
const fromAssociatedToken = getAssociatedTokenAddressSync(mint, from)
const toAssociatedToken = getAssociatedTokenAddressSync(mint, to)
const keys = [
{pubkey: from, isSigner: true, isWritable: true},
{pubkey: fromAssociatedToken, isSigner: false, isWritable: true},
{pubkey: toAssociatedToken, isSigner: false, isWritable: true},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
{pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false},
{pubkey: ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false},
]
return new TransactionInstruction({
keys,
programId,
data: myInstructionObject.toBuffer(),
})
}
// Freeze
export function createFreezeAssociatedTokenInstruction(
mint: PublicKey,
owner: PublicKey,
authority: PublicKey,
programId: PublicKey,
): TransactionInstruction {
const associatedToken = getAssociatedTokenAddressSync(mint, owner)
return createBaseInstruction(
programId,
MyInstructions.FreezeAccount,
[
{pubkey: associatedToken, isSigner: false, isWritable: true},
{pubkey: authority, isSigner: true, isWritable: true},
{pubkey: mint, isSigner: false, isWritable: false},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
{pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false},
{pubkey: ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false},
],
)
}
// Thaw
export function createThawAssociatedTokenInstruction(
mint: PublicKey,
owner: PublicKey,
authority: PublicKey,
programId: PublicKey,
): TransactionInstruction {
const associatedToken = getAssociatedTokenAddressSync(mint, owner)
return createBaseInstruction(
programId,
MyInstructions.ThawAccount,
[
{pubkey: associatedToken, isSigner: false, isWritable: true},
{pubkey: authority, isSigner: true, isWritable: true},
{pubkey: mint, isSigner: false, isWritable: false},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
{pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false},
{pubkey: ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false},
],
)
}
// Read
export function createReadAssociatedTokenInstruction(
mint: PublicKey,
owner: PublicKey,
programId: PublicKey,
): TransactionInstruction {
const newAssociatedToken = getAssociatedTokenAddressSync(mint, owner)
return createBaseInstruction(
programId,
MyInstructions.ReadAssociatedToken,
[
{pubkey: newAssociatedToken, isSigner: false, isWritable: false},
{pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false},
{pubkey: ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false},
],
)
}
| 0
|
solana_public_repos/nautilus-project/nautilus/tests/tests/tokens
|
solana_public_repos/nautilus-project/nautilus/tests/tests/tokens/instructions/nft.ts
|
import * as borsh from "borsh"
import { Buffer } from "buffer"
import { PROGRAM_ID as METADATA_PROGRAM_ID } from '@metaplex-foundation/mpl-token-metadata'
import { ASSOCIATED_TOKEN_PROGRAM_ID, getAssociatedTokenAddressSync, TOKEN_PROGRAM_ID } from '@solana/spl-token'
import {
PublicKey,
SystemProgram,
SYSVAR_RENT_PUBKEY,
TransactionInstruction
} from '@solana/web3.js'
import { createBaseInstruction, MyInstructions } from "."
// Create
class CreateNftInstructionData {
instruction: MyInstructions
title: string
symbol: string
uri: string
constructor(props: {
instruction: MyInstructions,
title: string,
symbol: string,
uri: string,
}) {
this.instruction = props.instruction
this.title = props.title
this.symbol = props.symbol
this.uri = props.uri
}
toBuffer() {
return Buffer.from(borsh.serialize(CreateNftInstructionDataSchema, this))
}
}
const CreateNftInstructionDataSchema = new Map([
[ CreateNftInstructionData, {
kind: 'struct',
fields: [
['instruction', 'u8'],
['title', 'string'],
['symbol', 'string'],
['uri', 'string'],
],
}]
])
function getMetadataAddress(mint: PublicKey): PublicKey {
return PublicKey.findProgramAddressSync(
[
Buffer.from("metadata"),
METADATA_PROGRAM_ID.toBuffer(),
mint.toBuffer(),
],
METADATA_PROGRAM_ID,
)[0]
}
function createCreateInstruction(
newMint: PublicKey,
payer: PublicKey,
programId: PublicKey,
title: string,
symbol: string,
uri: string,
instruction: MyInstructions,
): TransactionInstruction {
const myInstructionObject = new CreateNftInstructionData({instruction, title, symbol, uri})
const newMetadata = getMetadataAddress(newMint)
function deriveKeys(instruction: MyInstructions) {
if (instruction === MyInstructions.CreateNft) return [
{pubkey: payer, isSigner: true, isWritable: true},
{pubkey: newMint, isSigner: true, isWritable: true},
{pubkey: newMetadata, isSigner: false, isWritable: true},
{pubkey: payer, isSigner: true, isWritable: true},
{pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
{pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false},
{pubkey: METADATA_PROGRAM_ID, isSigner: false, isWritable: false},
]
else if (instruction === MyInstructions.CreateNftWithPayer) return [
{pubkey: payer, isSigner: true, isWritable: true},
{pubkey: newMint, isSigner: true, isWritable: true},
{pubkey: payer, isSigner: true, isWritable: true},
{pubkey: newMetadata, isSigner: false, isWritable: true},
{pubkey: payer, isSigner: true, isWritable: true},
{pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
{pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false},
{pubkey: METADATA_PROGRAM_ID, isSigner: false, isWritable: false},
]
return []
}
const keys = deriveKeys(instruction)
return new TransactionInstruction({
keys,
programId,
data: myInstructionObject.toBuffer(),
})
}
export function createCreateNftInstruction(
newMint: PublicKey,
payer: PublicKey,
programId: PublicKey,
title: string,
symbol: string,
uri: string,
): TransactionInstruction {
return createCreateInstruction(newMint, payer, programId, title, symbol, uri, MyInstructions.CreateNft)
}
export function createCreateNftWithPayerInstruction(
newMint: PublicKey,
payer: PublicKey,
programId: PublicKey,
title: string,
symbol: string,
uri: string,
): TransactionInstruction {
return createCreateInstruction(newMint, payer, programId, title, symbol, uri, MyInstructions.CreateNftWithPayer)
}
// Mint To
export function createNftMintToInstruction(
mint: PublicKey,
recipient: PublicKey,
authority: PublicKey,
programId: PublicKey,
): TransactionInstruction {
const metadata = getMetadataAddress(mint)
const recipientAssociatedToken = getAssociatedTokenAddressSync(mint, recipient)
return createBaseInstruction(
programId,
MyInstructions.NftMintTo,
[
{pubkey: authority, isSigner: true, isWritable: true},
{pubkey: mint, isSigner: false, isWritable: true},
{pubkey: recipientAssociatedToken, isSigner: false, isWritable: true},
{pubkey: metadata, isSigner: false, isWritable: true},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
{pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false},
{pubkey: ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false},
{pubkey: METADATA_PROGRAM_ID, isSigner: false, isWritable: false},
],
)
}
// Read
export function createReadNftInstruction(
mint: PublicKey,
programId: PublicKey,
): TransactionInstruction {
const newMetadata = getMetadataAddress(mint)
return createBaseInstruction(
programId,
MyInstructions.ReadNft,
[
{pubkey: mint, isSigner: false, isWritable: false},
{pubkey: newMetadata, isSigner: false, isWritable: false},
{pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false},
{pubkey: METADATA_PROGRAM_ID, isSigner: false, isWritable: false},
],
)
}
| 0
|
solana_public_repos/nautilus-project/nautilus/tests/tests/tokens
|
solana_public_repos/nautilus-project/nautilus/tests/tests/tokens/instructions/index.ts
|
export * from './associated-token'
export * from './mint'
export * from './metadata'
export * from './nft'
export * from './token'
import { TOKEN_PROGRAM_ID } from '@solana/spl-token'
import { PublicKey, SystemProgram, TransactionInstruction } from '@solana/web3.js'
import * as borsh from "borsh"
import { Buffer } from "buffer"
export enum MyInstructions {
CreateMint,
CreateMintWithPayer,
MintMintTo,
MintDisableMinting,
ReadMint,
CreateMetadata,
CreateMetadataWithPayer,
ReadMetadata,
CreateAssociatedToken,
CreateAssociatedTokenWithPayer,
ReadAssociatedToken,
BurnTokens,
TransferTokens,
FreezeAccount,
ThawAccount,
CreateToken,
CreateTokenWithPayer,
TokenMintTo,
TokenDisableMinting,
ReadToken,
CreateNft,
CreateNftWithPayer,
NftMintTo,
ReadNft,
}
export class BaseInstructionData {
instruction: MyInstructions
constructor(props: {
instruction: MyInstructions,
}) {
this.instruction = props.instruction
}
toBuffer() {
return Buffer.from(borsh.serialize(BaseInstructionDataSchema, this))
}
}
const BaseInstructionDataSchema = new Map([
[ BaseInstructionData, {
kind: 'struct',
fields: [
['instruction', 'u8'],
],
}]
])
export function createBaseInstruction(
programId: PublicKey,
instruction: MyInstructions,
keys: {pubkey: PublicKey, isSigner: boolean, isWritable: boolean}[],
): TransactionInstruction {
const myInstructionObject = new BaseInstructionData({instruction})
return new TransactionInstruction({
keys,
programId,
data: myInstructionObject.toBuffer(),
})
}
| 0
|
solana_public_repos/nautilus-project/nautilus/tests/tests/tokens
|
solana_public_repos/nautilus-project/nautilus/tests/tests/tokens/instructions/metadata.ts
|
import * as borsh from "borsh"
import { Buffer } from "buffer"
import { PROGRAM_ID as METADATA_PROGRAM_ID } from '@metaplex-foundation/mpl-token-metadata'
import { TOKEN_PROGRAM_ID } from '@solana/spl-token'
import {
PublicKey,
SystemProgram,
SYSVAR_RENT_PUBKEY,
TransactionInstruction
} from '@solana/web3.js'
import { createBaseInstruction, MyInstructions } from "."
class CreateMetadataInstructionData {
instruction: MyInstructions
title: string
symbol: string
uri: string
constructor(props: {
instruction: MyInstructions,
title: string,
symbol: string,
uri: string,
}) {
this.instruction = props.instruction
this.title = props.title
this.symbol = props.symbol
this.uri = props.uri
}
toBuffer() {
return Buffer.from(borsh.serialize(CreateMetadataInstructionDataSchema, this))
}
}
const CreateMetadataInstructionDataSchema = new Map([
[ CreateMetadataInstructionData, {
kind: 'struct',
fields: [
['instruction', 'u8'],
['title', 'string'],
['symbol', 'string'],
['uri', 'string'],
],
}]
])
function getMetadataAddress(mint: PublicKey): PublicKey {
return PublicKey.findProgramAddressSync(
[
Buffer.from("metadata"),
METADATA_PROGRAM_ID.toBuffer(),
mint.toBuffer(),
],
METADATA_PROGRAM_ID,
)[0]
}
function createInstruction(
mint: PublicKey,
payer: PublicKey,
programId: PublicKey,
title: string,
symbol: string,
uri: string,
instruction: MyInstructions,
): TransactionInstruction {
const myInstructionObject = new CreateMetadataInstructionData({instruction, title, symbol, uri})
const newMetadata = getMetadataAddress(mint)
function deriveKeys(instruction: MyInstructions) {
if (instruction === MyInstructions.CreateMetadata) return [
{pubkey: mint, isSigner: false, isWritable: false},
{pubkey: payer, isSigner: true, isWritable: true},
{pubkey: newMetadata, isSigner: false, isWritable: true},
{pubkey: payer, isSigner: true, isWritable: true},
{pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
{pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false},
{pubkey: METADATA_PROGRAM_ID, isSigner: false, isWritable: false},
]
else if (instruction === MyInstructions.CreateMetadataWithPayer) return [
{pubkey: mint, isSigner: false, isWritable: false},
{pubkey: payer, isSigner: true, isWritable: true},
{pubkey: newMetadata, isSigner: false, isWritable: true},
{pubkey: payer, isSigner: true, isWritable: true},
{pubkey: payer, isSigner: true, isWritable: true},
{pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
{pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false},
{pubkey: METADATA_PROGRAM_ID, isSigner: false, isWritable: false},
]
return []
}
const keys = deriveKeys(instruction)
return new TransactionInstruction({
keys,
programId,
data: myInstructionObject.toBuffer(),
})
}
export function createCreateMetadataInstruction(
mint: PublicKey,
payer: PublicKey,
programId: PublicKey,
title: string,
symbol: string,
uri: string,
): TransactionInstruction {
return createInstruction(mint, payer, programId, title, symbol, uri, MyInstructions.CreateMetadata)
}
export function createReadMetadataInstruction(
mint: PublicKey,
programId: PublicKey,
): TransactionInstruction {
const newMetadata = getMetadataAddress(mint)
return createBaseInstruction(
programId,
MyInstructions.ReadMetadata,
[
{pubkey: newMetadata, isSigner: false, isWritable: false},
{pubkey: METADATA_PROGRAM_ID, isSigner: false, isWritable: false},
],
)
}
export function createCreateMetadataWithPayerInstruction(
mint: PublicKey,
payer: PublicKey,
programId: PublicKey,
title: string,
symbol: string,
uri: string,
): TransactionInstruction {
return createInstruction(mint, payer, programId, title, symbol, uri, MyInstructions.CreateMetadataWithPayer)
}
export function createReadMetadataCreatedWithPayerInstruction(
mint: PublicKey,
programId: PublicKey,
): TransactionInstruction {
const newMetadata = getMetadataAddress(mint)
return createBaseInstruction(
programId,
MyInstructions.ReadMetadataCreatedWithPayer,
[
{pubkey: newMetadata, isSigner: false, isWritable: false},
{pubkey: METADATA_PROGRAM_ID, isSigner: false, isWritable: false},
],
)
}
| 0
|
solana_public_repos/nautilus-project/nautilus/tests/tests/tokens
|
solana_public_repos/nautilus-project/nautilus/tests/tests/tokens/instructions/token.ts
|
import * as borsh from "borsh"
import { Buffer } from "buffer"
import { PROGRAM_ID as METADATA_PROGRAM_ID } from '@metaplex-foundation/mpl-token-metadata'
import { ASSOCIATED_TOKEN_PROGRAM_ID, getAssociatedTokenAddressSync, TOKEN_PROGRAM_ID } from '@solana/spl-token'
import {
PublicKey,
SystemProgram,
SYSVAR_RENT_PUBKEY,
TransactionInstruction
} from '@solana/web3.js'
import { createBaseInstruction, MyInstructions } from "."
// Create
class CreateTokenInstructionData {
instruction: MyInstructions
decimals: number
title: string
symbol: string
uri: string
constructor(props: {
instruction: MyInstructions,
decimals: number
title: string,
symbol: string,
uri: string,
}) {
this.instruction = props.instruction
this.decimals = props.decimals
this.title = props.title
this.symbol = props.symbol
this.uri = props.uri
}
toBuffer() {
return Buffer.from(borsh.serialize(CreateTokenInstructionDataSchema, this))
}
}
const CreateTokenInstructionDataSchema = new Map([
[ CreateTokenInstructionData, {
kind: 'struct',
fields: [
['instruction', 'u8'],
['decimals', 'u8'],
['title', 'string'],
['symbol', 'string'],
['uri', 'string'],
],
}]
])
function getMetadataAddress(mint: PublicKey): PublicKey {
return PublicKey.findProgramAddressSync(
[
Buffer.from("metadata"),
METADATA_PROGRAM_ID.toBuffer(),
mint.toBuffer(),
],
METADATA_PROGRAM_ID,
)[0]
}
function createCreateInstruction(
newMint: PublicKey,
payer: PublicKey,
programId: PublicKey,
decimals: number,
title: string,
symbol: string,
uri: string,
instruction: MyInstructions,
): TransactionInstruction {
const myInstructionObject = new CreateTokenInstructionData({instruction, decimals, title, symbol, uri})
const newMetadata = getMetadataAddress(newMint)
function deriveKeys(instruction: MyInstructions) {
if (instruction === MyInstructions.CreateToken) return [
{pubkey: payer, isSigner: true, isWritable: true},
{pubkey: newMint, isSigner: true, isWritable: true},
{pubkey: newMetadata, isSigner: false, isWritable: true},
{pubkey: payer, isSigner: true, isWritable: true},
{pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
{pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false},
{pubkey: METADATA_PROGRAM_ID, isSigner: false, isWritable: false},
]
else if (instruction === MyInstructions.CreateTokenWithPayer) return [
{pubkey: payer, isSigner: true, isWritable: true},
{pubkey: newMint, isSigner: true, isWritable: true},
{pubkey: payer, isSigner: true, isWritable: true},
{pubkey: newMetadata, isSigner: false, isWritable: true},
{pubkey: payer, isSigner: true, isWritable: true},
{pubkey: SYSVAR_RENT_PUBKEY, isSigner: false, isWritable: false},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
{pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false},
{pubkey: METADATA_PROGRAM_ID, isSigner: false, isWritable: false},
]
return []
}
const keys = deriveKeys(instruction)
return new TransactionInstruction({
keys,
programId,
data: myInstructionObject.toBuffer(),
})
}
export function createCreateTokenInstruction(
newMint: PublicKey,
payer: PublicKey,
programId: PublicKey,
decimals: number,
title: string,
symbol: string,
uri: string,
): TransactionInstruction {
return createCreateInstruction(newMint, payer, programId, decimals, title, symbol, uri, MyInstructions.CreateToken)
}
export function createCreateTokenWithPayerInstruction(
newMint: PublicKey,
payer: PublicKey,
programId: PublicKey,
decimals: number,
title: string,
symbol: string,
uri: string,
): TransactionInstruction {
return createCreateInstruction(newMint, payer, programId, decimals, title, symbol, uri, MyInstructions.CreateTokenWithPayer)
}
// Mint To
class TokenMintToInstructionData {
instruction: MyInstructions
amount: number
constructor(props: {
instruction: MyInstructions,
amount: number,
}) {
this.instruction = props.instruction
this.amount = props.amount
}
toBuffer() {
return Buffer.from(borsh.serialize(TokenMintToInstructionDataSchema, this))
}
}
const TokenMintToInstructionDataSchema = new Map([
[ TokenMintToInstructionData, {
kind: 'struct',
fields: [
['instruction', 'u8'],
['amount', 'u64'],
],
}]
])
export function createTokenMintToInstruction(
mint: PublicKey,
recipient: PublicKey,
authority: PublicKey,
programId: PublicKey,
amount: number,
): TransactionInstruction {
const myInstructionObject = new TokenMintToInstructionData({
instruction: MyInstructions.TokenMintTo,
amount,
})
const metadata = getMetadataAddress(mint)
const recipientAssociatedToken = getAssociatedTokenAddressSync(mint, recipient)
const keys = [
{pubkey: authority, isSigner: true, isWritable: true},
{pubkey: recipientAssociatedToken, isSigner: false, isWritable: true},
{pubkey: mint, isSigner: false, isWritable: true},
{pubkey: metadata, isSigner: false, isWritable: true},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
{pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false},
{pubkey: ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false},
{pubkey: METADATA_PROGRAM_ID, isSigner: false, isWritable: false},
]
return new TransactionInstruction({
keys,
programId,
data: myInstructionObject.toBuffer(),
})
}
// Disable Minting
export function createTokenDisableMintingInstruction(
instruction: MyInstructions,
mint: PublicKey,
authority: PublicKey,
programId: PublicKey,
): TransactionInstruction {
const metadata = getMetadataAddress(mint)
return createBaseInstruction(
programId,
instruction,
[
{pubkey: authority, isSigner: true, isWritable: true},
{pubkey: mint, isSigner: false, isWritable: true},
{pubkey: metadata, isSigner: false, isWritable: true},
{pubkey: SystemProgram.programId, isSigner: false, isWritable: false},
{pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false},
{pubkey: METADATA_PROGRAM_ID, isSigner: false, isWritable: false},
],
)
}
// Read
export function createReadTokenInstruction(
mint: PublicKey,
programId: PublicKey,
): TransactionInstruction {
const newMetadata = getMetadataAddress(mint)
return createBaseInstruction(
programId,
MyInstructions.ReadToken,
[
{pubkey: mint, isSigner: false, isWritable: false},
{pubkey: newMetadata, isSigner: false, isWritable: false},
{pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false},
{pubkey: METADATA_PROGRAM_ID, isSigner: false, isWritable: false},
],
)
}
| 0
|
solana_public_repos/nautilus-project/nautilus/tests/programs
|
solana_public_repos/nautilus-project/nautilus/tests/programs/records/Cargo.toml
|
[package]
name = "program-nautilus"
version = "0.1.0"
edition = "2021"
[lib]
crate-type = ["cdylib", "lib"]
[dependencies]
nautilus = { path = "../../../solana", version = "0.0.1" }
| 0
|
solana_public_repos/nautilus-project/nautilus/tests/programs/records
|
solana_public_repos/nautilus-project/nautilus/tests/programs/records/src/lib.rs
|
//! Testing data records (PDAs).
use nautilus::splogger::{info, Splog};
use nautilus::*;
#[nautilus]
mod program_nautilus {
// Right now, the Nautilus Index must be initialized ahead of time.
// Perhaps we can do this with the CLI.
fn initialize<'a>(mut nautilus_index: Create<'a, NautilusIndex<'a>>) -> ProgramResult {
info!("Index size: {}", nautilus_index.span()?);
//
// /* Business Logic */
//
nautilus_index.create()?;
//
Ok(())
}
fn create_person<'a>(
mut new_person: Create<'a, Record<'a, Person>>,
name: String,
authority: Pubkey,
) -> ProgramResult {
info!("-- New Person: {}", &new_person.key());
info!("-- Authority: {}", &authority);
//
// /* Business Logic */
//
new_person.create(name, authority)?;
//
new_person.self_account.print();
Ok(())
}
fn read_person<'a>(person: Record<'a, Person>) -> ProgramResult {
person.print();
//
// /* Business Logic */
//
Ok(())
}
fn create_home<'a>(
mut new_home: Create<'a, Record<'a, Home>>,
id: u8,
house_number: u8,
street: String,
) -> ProgramResult {
info!("-- New Home: {}", &new_home.key());
//
// /* Business Logic */
//
new_home.create(id, house_number, street)?;
//
new_home.self_account.print();
Ok(())
}
fn read_home<'a>(home: Record<'a, Home>) -> ProgramResult {
home.print();
//
// /* Business Logic */
//
Ok(())
}
fn create_car<'a>(
mut new_car: Create<'a, Record<'a, Car>>,
make: String,
model: String,
purchase_authority: Pubkey,
operating_authority: Pubkey,
) -> ProgramResult {
info!("-- New Car: {}", &new_car.key());
//
// /* Business Logic */
//
new_car.create(make, model, purchase_authority, operating_authority)?;
//
new_car.self_account.print();
Ok(())
}
fn read_car<'a>(car: Record<'a, Car>) -> ProgramResult {
car.print();
//
// /* Business Logic */
//
Ok(())
}
fn fund_person<'a>(
person: Mut<Record<'a, Person>>,
payer: Signer<Wallet<'a>>,
amount: u64,
) -> ProgramResult {
payer.transfer_lamports(person, amount)
}
fn transfer_from_person<'a>(
person: Mut<Record<'a, Person>>,
recipient: Mut<Wallet<'a>>,
amount: u64,
) -> ProgramResult {
person.transfer_lamports(recipient, amount)
}
fn fund_home<'a>(
home: Mut<Record<'a, Home>>,
payer: Signer<Wallet<'a>>,
amount: u64,
) -> ProgramResult {
payer.transfer_lamports(home, amount)
}
fn transfer_from_home<'a>(
home: Mut<Record<'a, Home>>,
recipient: Mut<Wallet<'a>>,
amount: u64,
) -> ProgramResult {
home.transfer_lamports(recipient, amount)
}
fn fund_car<'a>(
car: Mut<Record<'a, Car>>,
payer: Signer<Wallet<'a>>,
amount: u64,
) -> ProgramResult {
payer.transfer_lamports(car, amount)
}
fn transfer_from_car<'a>(
car: Mut<Record<'a, Car>>,
recipient: Mut<Wallet<'a>>,
amount: u64,
) -> ProgramResult {
car.transfer_lamports(recipient, amount)
}
}
#[derive(Table)]
struct Person {
#[primary_key(autoincrement = true)]
id: u8,
name: String,
#[authority]
authority: Pubkey,
}
#[derive(Table)]
struct Home {
#[primary_key(autoincrement = false)]
id: u8,
house_number: u8,
street: String,
}
#[derive(Table)]
#[default_instructions(Create, Delete, Update)]
struct Car {
#[primary_key(autoincrement = true)]
id: u8,
make: String,
model: String,
#[authority]
purchase_authority: Pubkey,
#[authority]
operating_authority: Pubkey,
}
//
pub trait TestPrint {
fn print(&self);
}
impl TestPrint for Record<'_, Person> {
fn print(&self) {
info!("-- Person: {}", self.key());
info!(" ID: {}", self.data.id);
info!(" Name: {}", self.data.name);
info!(" Authority: {}", self.data.authority);
}
}
impl TestPrint for Record<'_, Home> {
fn print(&self) {
info!("-- Home: {}", self.key());
info!(" ID: {}", self.data.id);
info!(" House Number: {}", self.data.house_number);
info!(" Street: {}", self.data.street);
}
}
impl TestPrint for Record<'_, Car> {
fn print(&self) {
info!("-- Car: {}", self.key());
info!(" ID: {}", self.data.id);
info!(" Make: {}", self.data.make);
info!(" Model: {}", self.data.model);
info!(" Purchase Auth: {}", self.data.purchase_authority);
info!(" Operating Auth: {}", self.data.operating_authority);
}
}
| 0
|
solana_public_repos/nautilus-project/nautilus/tests/programs
|
solana_public_repos/nautilus-project/nautilus/tests/programs/accounts/Cargo.toml
|
[package]
name = "program-nautilus"
version = "0.1.0"
edition = "2021"
[lib]
crate-type = ["cdylib", "lib"]
[dependencies]
nautilus = { path = "../../../solana", version = "0.0.1" }
| 0
|
solana_public_repos/nautilus-project/nautilus/tests/programs/accounts
|
solana_public_repos/nautilus-project/nautilus/tests/programs/accounts/src/lib.rs
|
//! Testing non-record data accounts (PDAs).
use nautilus::splogger::{info, Splog};
use nautilus::*;
#[nautilus]
mod program_nautilus {
fn create_person<'a>(
mut new_person: Create<'a, Account<'a, Person>>,
name: String,
authority: Pubkey,
) -> ProgramResult {
info!(" * New Person: {}", &new_person.key());
info!(" * Authority: {}", &authority);
//
// /* Business Logic */
//
new_person.create(name, authority)?;
//
new_person.self_account.print();
Ok(())
}
fn read_person<'a>(person: Account<'a, Person>) -> ProgramResult {
person.print();
//
// /* Business Logic */
//
Ok(())
}
fn create_home<'a>(
mut new_home: Create<'a, Account<'a, Home>>,
house_number: u8,
street: String,
some_pubkey: Pubkey,
) -> ProgramResult {
info!(" * New Home: {}", &new_home.key());
//
// /* Business Logic */
//
new_home.create(house_number, street, (some_pubkey,))?; // Seed parameter required
//
new_home.self_account.print();
Ok(())
}
fn read_home<'a>(home: Account<'a, Home>) -> ProgramResult {
home.print();
//
// /* Business Logic */
//
Ok(())
}
fn create_car<'a>(
mut new_car: Create<'a, Account<'a, Car>>,
make: String,
model: String,
purchase_authority: Pubkey,
operating_authority: Pubkey,
) -> ProgramResult {
info!(" * New Car: {}", &new_car.key());
//
// /* Business Logic */
//
new_car.create(make, model, purchase_authority, operating_authority)?;
//
new_car.self_account.print();
Ok(())
}
fn read_car<'a>(car: Account<'a, Car>) -> ProgramResult {
car.print();
//
// /* Business Logic */
//
Ok(())
}
}
#[derive(State)]
#[seeds(
"person", // Literal seed
authority, // Self-referencing seed
)]
struct Person {
name: String,
#[authority]
authority: Pubkey,
}
#[derive(State)]
#[seeds(
"home", // Literal seed
some_pubkey: Pubkey, // Parameter seed
)]
struct Home {
house_number: u8,
street: String,
}
#[derive(State)]
#[seeds(
"car", // Literal seed
purchase_authority, // Self-referencing seed
operating_authority, // Self-referencing seed
)]
struct Car {
make: String,
model: String,
#[authority]
purchase_authority: Pubkey,
#[authority]
operating_authority: Pubkey,
}
//
pub trait TestPrint {
fn print(&self);
}
impl TestPrint for Account<'_, Person> {
fn print(&self) {
info!(" * Person: {}", self.key());
info!(" Name: {}", self.data.name);
info!(" Authority: {}", self.data.authority);
}
}
impl TestPrint for Account<'_, Home> {
fn print(&self) {
info!(" * Home: {}", self.key());
info!(" House Number: {}", self.data.house_number);
info!(" Street: {}", self.data.street);
}
}
impl TestPrint for Account<'_, Car> {
fn print(&self) {
info!(" * Car: {}", self.key());
info!(" Make: {}", self.data.make);
info!(" Model: {}", self.data.model);
info!(" Purchase Auth: {}", self.data.purchase_authority);
info!(" Operating Auth: {}", self.data.operating_authority);
}
}
| 0
|
solana_public_repos/nautilus-project/nautilus/tests/programs
|
solana_public_repos/nautilus-project/nautilus/tests/programs/wallets/Cargo.toml
|
[package]
name = "program-nautilus"
version = "0.1.0"
edition = "2021"
[lib]
crate-type = ["cdylib", "lib"]
[dependencies]
nautilus = { path = "../../../solana", version = "0.0.1" }
| 0
|
solana_public_repos/nautilus-project/nautilus/tests/programs/wallets
|
solana_public_repos/nautilus-project/nautilus/tests/programs/wallets/src/lib.rs
|
//! Testing system accounts.
use nautilus::splogger::{info, Splog};
use nautilus::*;
#[nautilus]
mod program_nautilus {
fn allocate<'a>(new_wallet: Create<'a, Wallet<'a>>) -> ProgramResult {
print_wallet_details(&new_wallet, "Allocate acct pre-allocate");
//
// /* Business Logic */
//
new_wallet.allocate()?;
//
print_wallet_details(&new_wallet, "Allocate acct post-allocate");
Ok(())
}
fn assign<'a>(wallet: Signer<Wallet<'a>>, new_owner: Pubkey) -> ProgramResult {
print_wallet_details(&wallet, "Assign acct pre-assign");
//
// /* Business Logic */
//
wallet.assign(new_owner)?;
//
print_wallet_details(&wallet, "Assign acct post-assign");
Ok(())
}
fn create<'a>(mut new_wallet: Create<'a, Wallet<'a>>) -> ProgramResult {
print_wallet_details(&new_wallet, "Create acct pre-create");
//
// /* Business Logic */
//
new_wallet.create()?;
//
print_wallet_details(&new_wallet, "Create acct post-create");
Ok(())
}
fn create_with_payer<'a>(
mut new_wallet: Create<'a, Wallet<'a>>,
rent_payer: Signer<Wallet<'a>>,
) -> ProgramResult {
print_wallet_details(&new_wallet, "Create acct pre-create");
print_wallet_details(&rent_payer, "Rent payer pre-create");
//
// /* Business Logic */
//
new_wallet.create_with_payer(rent_payer.clone())?; // Cloning so we can ref later
//
print_wallet_details(&new_wallet, "Create acct post-create");
print_wallet_details(&rent_payer, "Rent payer post-create");
Ok(())
}
fn read(wallet: Wallet) -> ProgramResult {
print_wallet_details(&wallet, "Read");
//
// /* Business Logic */
//
Ok(())
}
fn transfer<'a>(from: Signer<Wallet<'a>>, to: Mut<Wallet<'a>>, amount: u64) -> ProgramResult {
print_wallet_details(&from, "From acct pre-transfer");
print_wallet_details(&to, "To acct pre-transfer");
info!(
"Transferring {} From: {} to: {}",
amount,
from.key(),
to.key()
);
//
// /* Business Logic */
//
from.transfer_lamports(to.clone(), amount)?; // Cloning so we can ref later
//
print_wallet_details(&from, "From acct post-transfer");
print_wallet_details(&to, "To acct post-transfer");
Ok(())
}
/// A simluated "complex" program instruction to test Nautilus.
/// The logic herein is just for example.
fn complex<'a>(
_authority1: Signer<Wallet<'a>>, // Marking this as `Signer` will ensure it's a signer on the tx.
authority2: Signer<Wallet<'a>>,
rent_payer1: Signer<Wallet<'a>>,
rent_payer2: Signer<Wallet<'a>>,
wallet_to_allocate: Create<'a, Wallet<'a>>, // Marking this as `Create` will ensure it hasn't been created.
mut wallet_to_create: Create<'a, Wallet<'a>>,
wallet_to_create_with_transfer_safe: Create<'a, Wallet<'a>>,
wallet_to_create_with_transfer_unsafe: Mut<Wallet<'a>>,
some_other_transfer_recipient: Mut<Wallet<'a>>,
amount_to_fund: u64,
amount_to_transfer: u64,
) -> ProgramResult {
//
// /* Business Logic */
//
// Some random checks to simulate how custom checks might look.
assert!(rent_payer1
.owner()
.eq(&nautilus::solana_program::system_program::ID));
assert!(rent_payer2
.owner()
.eq(&nautilus::solana_program::system_program::ID));
// Even though the check will be applied via `Signer` in the function sig, you can still
// check yourself if you choose to.
assert!(authority2.is_signer());
// Even though the check will be applied via `Create` in the function sig, you can still
// check yourself if you choose to.
assert!(wallet_to_allocate.lamports() == 0);
assert!(wallet_to_allocate.is_writable());
wallet_to_allocate.allocate()?;
assert!(wallet_to_create.lamports() == 0);
assert!(wallet_to_create.is_writable());
wallet_to_create.create()?;
// Safe - checked at entry with `Create`.
rent_payer1.transfer_lamports(wallet_to_create_with_transfer_safe, amount_to_fund)?;
// Unsafe - not marked with `Create`.
rent_payer2.transfer_lamports(wallet_to_create_with_transfer_unsafe, amount_to_fund)?;
// Transfer with balance assertions
let from_beg_balance = authority2.lamports();
let to_beg_balance = some_other_transfer_recipient.lamports();
authority2.transfer_lamports(some_other_transfer_recipient.clone(), amount_to_transfer)?;
let from_end_balance = authority2.lamports();
let to_end_balance = some_other_transfer_recipient.lamports();
assert!(from_beg_balance - from_end_balance == amount_to_transfer);
assert!(to_end_balance - to_beg_balance == amount_to_transfer);
//
Ok(())
}
}
fn print_wallet_details<'a>(wallet: &impl NautilusAccountInfo<'a>, desc: &str) {
info!(" * Wallet info for: {}:", desc);
info!(" Address: {}", wallet.key());
info!(" Owner: {}", wallet.owner());
info!(" Size: {}", wallet.size().unwrap());
info!(" Lamports: {}", wallet.lamports());
}
| 0
|
solana_public_repos/nautilus-project/nautilus/tests/programs
|
solana_public_repos/nautilus-project/nautilus/tests/programs/tokens/Cargo.toml
|
[package]
name = "program-nautilus"
version = "0.1.0"
edition = "2021"
[lib]
crate-type = ["cdylib", "lib"]
[dependencies]
nautilus = { path = "../../../solana", version = "0.0.1" }
| 0
|
solana_public_repos/nautilus-project/nautilus/tests/programs/tokens
|
solana_public_repos/nautilus-project/nautilus/tests/programs/tokens/src/lib.rs
|
//! Testing token-related objects.
use nautilus::spl_token::instruction::AuthorityType;
use nautilus::splogger::{info, Splog};
use nautilus::*;
#[nautilus]
mod program_nautilus {
// Mints
fn create_mint<'a>(
mut new_mint: Create<'a, Mint<'a>>,
decimals: u8,
mint_authority: Signer<Wallet<'a>>,
) -> ProgramResult {
info!(" * New Mint Public Key: {}", &new_mint.key());
//
// /* Business Logic */
//
new_mint.create(decimals, mint_authority.clone(), Some(mint_authority))?;
//
print_mint_data(&new_mint.self_account.data, "Create");
Ok(())
}
fn create_mint_with_payer<'a>(
mut new_mint: Create<'a, Mint<'a>>,
decimals: u8,
mint_authority: Signer<Wallet<'a>>,
rent_payer: Signer<Wallet<'a>>,
) -> ProgramResult {
info!(" * New Mint Public Key: {}", &new_mint.key());
info!(" * Rent Payer Public Key: {}", &rent_payer.key());
//
// /* Business Logic */
//
new_mint.create_with_payer(
decimals,
mint_authority.clone(),
Some(mint_authority),
rent_payer,
)?;
//
print_mint_data(&new_mint.self_account.data, "Create with payer");
Ok(())
}
fn mint_mint_to<'a>(
mint: Mut<Mint<'a>>,
to: Mut<AssociatedTokenAccount<'a>>,
authority: Signer<Wallet<'a>>,
amount: u64,
) -> ProgramResult {
print_associated_token_data(&to.self_account.data, "To acct pre-mint");
info!(" * Mint Public Key: {}", &mint.key());
print_mint_data(&mint.self_account.data, "MintTo");
info!("Minting {} tokens to: {}", amount, to.key());
//
// /* Business Logic */
//
mint.mint_to(to.clone(), authority, amount)?; // Cloning so we can ref later
//
print_associated_token_data(&to.self_account.data, "To acct post-mint");
Ok(())
}
fn mint_disable_minting<'a>(
mint: Mut<Mint<'a>>,
authority: Signer<Wallet<'a>>,
) -> ProgramResult {
info!(" * Mint Public Key: {}", &mint.key());
print_mint_data(&mint.self_account.data, "Mint pre-disabling");
//
// /* Business Logic */
//
mint.set_authority(None, AuthorityType::MintTokens, authority)?;
//
print_mint_data(&mint.self_account.data, "Mint post-disabling");
Ok(())
}
fn read_mint(mint: Mint) -> ProgramResult {
info!(" * Mint Public Key: {}", &mint.key());
print_mint_data(&mint.data, "Read");
//
// /* Business Logic */
//
Ok(())
}
// Metadatas
fn create_metadata<'a>(
mut new_metadata: Create<'a, Metadata<'a>>,
mint: Mint<'a>,
title: String,
symbol: String,
uri: String,
mint_authority: Signer<Wallet<'a>>,
) -> ProgramResult {
info!(" * New Metadata Public Key: {}", &new_metadata.key());
info!(" * Mint Public Key: {}", &mint.key());
//
// /* Business Logic */
//
new_metadata.create(
title,
symbol,
uri,
mint,
mint_authority.clone(),
mint_authority,
)?;
//
print_metadata_data(&new_metadata.self_account.data, "Create");
Ok(())
}
fn create_metadata_with_payer<'a>(
mut new_metadata: Create<'a, Metadata<'a>>,
mint: Mint<'a>,
title: String,
symbol: String,
uri: String,
mint_authority: Signer<Wallet<'a>>,
rent_payer: Signer<Wallet<'a>>,
) -> ProgramResult {
info!(" * New Metadata Public Key: {}", &new_metadata.key());
info!(" * Mint Public Key: {}", &mint.key());
info!(" * Rent Payer Public Key: {}", &rent_payer.key());
//
// /* Business Logic */
//
new_metadata.create_with_payer(
title,
symbol,
uri,
mint,
mint_authority.clone(),
mint_authority,
rent_payer,
)?;
//
print_metadata_data(&new_metadata.self_account.data, "Create with payer");
Ok(())
}
fn read_metadata(metadata: Metadata) -> ProgramResult {
info!(" * Metadata Public Key: {}", &metadata.key());
print_metadata_data(&metadata.data, "Read");
//
// /* Business Logic */
//
Ok(())
}
// Associated Token Accounts
fn create_associated_token<'a>(
mut new_associated_token: Create<'a, AssociatedTokenAccount<'a>>,
mint: Mint<'a>,
owner: Wallet<'a>,
) -> ProgramResult {
info!(
" * New AssociatedTokenAccount Public Key: {}",
&new_associated_token.key()
);
info!(" * Mint Public Key: {}", &mint.key());
info!(" * Owner Public Key: {}", &owner.key());
//
// /* Business Logic */
//
new_associated_token.create(mint, owner)?;
//
print_associated_token_data(&new_associated_token.self_account.data, "Create");
Ok(())
}
fn create_associated_token_with_payer<'a>(
mut new_associated_token: Create<'a, AssociatedTokenAccount<'a>>,
mint: Mint<'a>,
owner: Wallet<'a>,
rent_payer: Signer<Wallet<'a>>,
) -> ProgramResult {
info!(
" * New AssociatedTokenAccount Public Key: {}",
&new_associated_token.key()
);
info!(" * Mint Public Key: {}", &mint.key());
info!(" * Owner Public Key: {}", &owner.key());
info!(" * Rent Payer Public Key: {}", &rent_payer.key());
//
// /* Business Logic */
//
new_associated_token.create_with_payer(mint, owner, rent_payer)?;
//
print_associated_token_data(&new_associated_token.self_account.data, "Create with payer");
Ok(())
}
fn read_associated_token(associated_token: AssociatedTokenAccount) -> ProgramResult {
info!(
" * AssociatedTokenAccount Public Key: {}",
&associated_token.key()
);
print_associated_token_data(&associated_token.data, "Read");
//
// /* Business Logic */
//
Ok(())
}
fn burn_tokens<'a>(
mint: Mint<'a>,
from: Mut<AssociatedTokenAccount<'a>>,
authority: Signer<Wallet<'a>>,
amount: u64,
) -> ProgramResult {
print_associated_token_data(&from.self_account.data, "From acct pre-burn");
info!("Burning {} tokens from: {} ", amount, from.key(),);
//
// /* Business Logic */
//
from.burn(mint, authority, amount)?; // Cloning so we can ref later
//
print_associated_token_data(&from.self_account.data, "From acct post-burn");
Ok(())
}
fn transfer_tokens<'a>(
from: Mut<AssociatedTokenAccount<'a>>,
to: Mut<AssociatedTokenAccount<'a>>,
authority: Signer<Wallet<'a>>,
amount: u64,
) -> ProgramResult {
print_associated_token_data(&from.self_account.data, "From acct pre-transfer");
print_associated_token_data(&to.self_account.data, "To acct pre-transfer");
info!(
"Transferring {} tokens from: {} to: {}",
amount,
from.key(),
to.key()
);
//
// /* Business Logic */
//
from.transfer(to.clone(), authority, amount)?; // Cloning so we can ref later
//
print_associated_token_data(&from.self_account.data, "From acct post-transfer");
print_associated_token_data(&to.self_account.data, "To acct post-transfer");
Ok(())
}
fn freeze_account<'a>(
mint: Mint<'a>,
account: Mut<AssociatedTokenAccount<'a>>,
authority: Signer<Wallet<'a>>,
) -> ProgramResult {
info!(" * AssociatedTokenAccount Public Key: {}", &account.key());
print_associated_token_data(&account.self_account.data, "Freeze (pre)");
//
// /* Business Logic */
//
account.freeze(mint, authority)?; // Cloning so we can ref later
//
print_associated_token_data(&account.self_account.data, "Freeze (post)");
Ok(())
}
fn thaw_account<'a>(
mint: Mint<'a>,
account: Mut<AssociatedTokenAccount<'a>>,
authority: Signer<Wallet<'a>>,
) -> ProgramResult {
info!(" * AssociatedTokenAccount Public Key: {}", &account.key());
print_associated_token_data(&account.self_account.data, "Thaw (pre)");
//
// /* Business Logic */
//
account.thaw(mint, authority)?; // Cloning so we can ref later
//
print_associated_token_data(&account.self_account.data, "Thaw (post)");
Ok(())
}
// Tokens
fn create_token<'a>(
mut new_token: Create<'a, Token<'a>>,
decimals: u8,
title: String,
symbol: String,
uri: String,
mint_authority: Signer<Wallet<'a>>,
) -> ProgramResult {
info!(" * New Token Public Key: {}", &new_token.key());
//
// /* Business Logic */
//
new_token.create(
decimals,
title,
symbol,
uri,
mint_authority.clone(),
mint_authority.clone(),
Some(mint_authority),
)?;
//
print_mint_data(&new_token.self_account.mint.data, "Create");
print_metadata_data(&new_token.self_account.metadata.data, "Create");
Ok(())
}
fn create_token_with_payer<'a>(
mut new_token: Create<'a, Token<'a>>,
decimals: u8,
title: String,
symbol: String,
uri: String,
mint_authority: Signer<Wallet<'a>>,
rent_payer: Signer<Wallet<'a>>,
) -> ProgramResult {
info!(" * New Token Public Key: {}", &new_token.key());
info!(" * Rent Payer Public Key: {}", &rent_payer.key());
//
// /* Business Logic */
//
new_token.create_with_payer(
decimals,
title,
symbol,
uri,
mint_authority.clone(),
mint_authority.clone(),
Some(mint_authority),
rent_payer,
)?;
//
print_mint_data(&new_token.self_account.mint.data, "Create with payer");
print_metadata_data(&new_token.self_account.metadata.data, "Create with payer");
Ok(())
}
fn token_mint_to<'a>(
token: Mut<Token<'a>>,
to: Mut<AssociatedTokenAccount<'a>>,
authority: Signer<Wallet<'a>>,
amount: u64,
) -> ProgramResult {
print_associated_token_data(&to.self_account.data, "To acct pre-mint");
info!(" * Token Public Key: {}", &token.key());
print_mint_data(&token.self_account.mint.data, "MintTo");
info!("Minting {} tokens to: {}", amount, to.key());
//
// /* Business Logic */
//
token.mint_to(to.clone(), authority, amount)?; // Cloning so we can ref later
//
print_associated_token_data(&to.self_account.data, "To acct post-mint");
Ok(())
}
fn token_disable_minting<'a>(
token: Mut<Token<'a>>,
authority: Signer<Wallet<'a>>,
) -> ProgramResult {
info!(" * Mint Public Key: {}", &token.key());
print_mint_data(&token.self_account.mint.data, "Token mint pre-disabling");
//
// /* Business Logic */
//
token.set_authority(None, AuthorityType::MintTokens, authority)?;
//
print_mint_data(&token.self_account.mint.data, "token mint post-disabling");
Ok(())
}
fn read_token(token: Token) -> ProgramResult {
info!(" * Token Public Key: {}", &token.key());
print_mint_data(&token.mint.data, "Read");
print_metadata_data(&token.metadata.data, "Read");
//
// /* Business Logic */
//
Ok(())
}
// NFTs
fn create_nft<'a>(
mut new_nft: Create<'a, Nft<'a>>,
title: String,
symbol: String,
uri: String,
mint_authority: Signer<Wallet<'a>>,
) -> ProgramResult {
info!(" * New NFT Public Key: {}", &new_nft.key());
//
// /* Business Logic */
//
new_nft.create(
title,
symbol,
uri,
mint_authority.clone(),
mint_authority.clone(),
Some(mint_authority),
)?;
//
print_mint_data(&new_nft.self_account.mint.data, "Create");
print_metadata_data(&new_nft.self_account.metadata.data, "Create");
Ok(())
}
fn create_nft_with_payer<'a>(
mut new_nft: Create<'a, Nft<'a>>,
title: String,
symbol: String,
uri: String,
mint_authority: Signer<Wallet<'a>>,
rent_payer: Signer<Wallet<'a>>,
) -> ProgramResult {
info!(" * New NFT Public Key: {}", &new_nft.key());
info!(" * Rent Payer Public Key: {}", &rent_payer.key());
//
// /* Business Logic */
//
new_nft.create_with_payer(
title,
symbol,
uri,
mint_authority.clone(),
mint_authority.clone(),
Some(mint_authority),
rent_payer,
)?;
//
print_mint_data(&new_nft.self_account.mint.data, "Create with payer");
print_metadata_data(&new_nft.self_account.metadata.data, "Create with payer");
Ok(())
}
fn nft_mint_to<'a>(
nft: Mut<Nft<'a>>,
to: Mut<AssociatedTokenAccount<'a>>,
authority: Signer<Wallet<'a>>,
) -> ProgramResult {
print_associated_token_data(&to.self_account.data, "To acct pre-mint");
info!(" * NFT Public Key: {}", &nft.key());
print_mint_data(&nft.self_account.mint.data, "MintTo");
info!("Minting NFT to: {}", to.key());
//
// /* Business Logic */
//
nft.mint_to(to.clone(), authority)?; // Cloning so we can ref later
//
print_associated_token_data(&to.self_account.data, "To acct post-mint");
Ok(())
}
fn read_nft(nft: Nft) -> ProgramResult {
info!(" * NFT Public Key: {}", &nft.key());
print_mint_data(&nft.mint.data, "Read");
print_metadata_data(&nft.metadata.data, "Read");
//
// /* Business Logic */
//
Ok(())
}
}
fn print_mint_data(data: &MintState, desc: &str) {
info!(" * Mint Data for: {}:", desc);
info!(" Mint Authority: {:#?}", data.mint_authority);
info!(" Supply: {}", data.supply);
info!(" Decimals: {}", data.decimals);
info!(" Is Initialized: {}", data.is_initialized);
info!(" Freeze Authority: {:#?}", data.freeze_authority);
}
fn print_metadata_data(data: &MetadataState, desc: &str) {
info!(" * Metadata Data for: {}:", desc);
info!(" Mint: {:#?}", data.mint);
info!(
" Primary Sale Happened: {}",
data.primary_sale_happened
);
info!(" Is Mutable: {}", data.is_mutable);
info!(" Edition Nonce: {:#?}", data.edition_nonce);
info!(" Title: {}", data.data.name);
info!(" Symbol: {}", data.data.symbol);
info!(" URI: {}", data.data.uri);
}
fn print_associated_token_data(data: &AssociatedTokenAccountState, desc: &str) {
info!(" * Associated Token Data for: {}:", desc);
info!(" Mint: {:#?}", data.mint);
info!(" Owner: {:#?}", data.owner);
info!(" Amount: {}", data.amount);
info!(" Delegate: {:#?}", data.delegate);
info!(" Is Native: {:#?}", data.is_native);
info!(" Delegated Amount: {}", data.delegated_amount);
info!(" Close Authority: {:#?}", data.close_authority);
}
| 0
|
solana_public_repos/nautilus-project/nautilus
|
solana_public_repos/nautilus-project/nautilus/solana/Cargo.toml
|
[package]
name = "nautilus"
version = "0.0.1"
authors = ["Joe Caulfield <jcaulfield135@gmail.com>"]
repository = "https://github.com/nautilus-project/nautilus"
license = "Apache-2.0"
description = "SQL-native Solana program framework"
rust-version = "1.59"
edition = "2021"
[dependencies]
borsh = "0.9.3"
borsh-derive = "0.9.3"
mpl-token-metadata = { version = "1.9.1", features = ["no-entrypoint"] }
nautilus-derive = { path = "./derive", version = "0.0.1" }
num-traits = "0.2.15"
solana-program = "1.15.2"
spl-associated-token-account = "1.1.3"
spl-token = "3.5.0"
spl-token-2022 = "0.6.1"
splogger = { git = "https://github.com/nautilus-project/splogger", branch = "main", version = "0.0.1" }
thiserror = "1.0.40"
winnow = "=0.4.1"
| 0
|
solana_public_repos/nautilus-project/nautilus
|
solana_public_repos/nautilus-project/nautilus/solana/rustfmt.toml
|
comment_width = 80
wrap_comments = true
| 0
|
solana_public_repos/nautilus-project/nautilus/solana
|
solana_public_repos/nautilus-project/nautilus/solana/idl/Cargo.toml
|
[package]
name = "nautilus-idl"
version = "0.0.1"
authors = ["Joe Caulfield <jcaulfield135@gmail.com>"]
repository = "https://github.com/nautilus-project/nautilus"
license = "Apache-2.0"
description = "Generates an IDL for a Nautilus program"
rust-version = "1.59"
edition = "2021"
[dependencies]
borsh = "0.10.2"
borsh-derive = "0.10.2"
serde = { version = "1.0.152", features = ["derive"] }
serde_json = "1.0.93"
syn = { version = "1.0", features = ["extra-traits", "full"] }
toml = "0.7.2"
| 0
|
solana_public_repos/nautilus-project/nautilus/solana/idl
|
solana_public_repos/nautilus-project/nautilus/solana/idl/tests/idl.rs
|
use nautilus_idl::*;
#[test]
fn idl() {
let (name, version) = parse_cargo_toml("Cargo.toml").unwrap();
let metadata = IdlMetadata::new("some-program-id");
let types = vec![IdlType::new(
"CustomArgs",
IdlTypeType::new(
"struct",
vec![
IdlTypeTypeField::new("string1", "string"),
IdlTypeTypeField::new("string2", "string"),
],
),
)];
let accounts = vec![
IdlAccount::new(
"Hero",
IdlTypeType::new(
"struct",
vec![
IdlTypeTypeField::new("id", "u8"),
IdlTypeTypeField::new("name", "string"),
IdlTypeTypeField::new("authority", "publicKey"),
],
),
),
IdlAccount::new(
"Villain",
IdlTypeType::new(
"struct",
vec![
IdlTypeTypeField::new("id", "u8"),
IdlTypeTypeField::new("name", "string"),
IdlTypeTypeField::new("authority", "publicKey"),
],
),
),
];
let instructions = vec![
IdlInstruction::new(
"CreateHero",
vec![
IdlInstructionAccount::new(
"autoincAccount",
true,
false,
"The autoincrement account.",
),
IdlInstructionAccount::new("newAccount", true, false, "The account to be created."),
IdlInstructionAccount::new(
"authority",
true,
true,
"One of the authorities specified for this account.",
),
IdlInstructionAccount::new("feePayer", true, true, "Fee payer"),
IdlInstructionAccount::new("systemProgram", false, false, "The System Program"),
],
vec![IdlInstructionArg::new(
"hero",
IdlInstructionArgType::new("Hero"),
)],
IdlInstructionDiscriminant::new(0),
),
IdlInstruction::new(
"DeleteHero",
vec![
IdlInstructionAccount::new(
"targetAccount",
true,
false,
"The account to be deleted.",
),
IdlInstructionAccount::new(
"authority",
true,
true,
"One of the authorities specified for this account.",
),
IdlInstructionAccount::new("feePayer", true, true, "Fee payer"),
],
vec![],
IdlInstructionDiscriminant::new(1),
),
IdlInstruction::new(
"UpdateHero",
vec![
IdlInstructionAccount::new(
"targetAccount",
true,
false,
"The account to be updated.",
),
IdlInstructionAccount::new(
"authority",
true,
true,
"One of the authorities specified for this account.",
),
IdlInstructionAccount::new("feePayer", true, true, "Fee payer"),
IdlInstructionAccount::new("systemProgram", false, false, "The System Program"),
],
vec![IdlInstructionArg::new(
"hero",
IdlInstructionArgType::new("Hero"),
)],
IdlInstructionDiscriminant::new(2),
),
IdlInstruction::new(
"CreateVillain",
vec![
IdlInstructionAccount::new(
"autoincAccount",
true,
false,
"The autoincrement account.",
),
IdlInstructionAccount::new("newAccount", true, false, "The account to be created."),
IdlInstructionAccount::new(
"authority",
true,
true,
"One of the authorities specified for this account.",
),
IdlInstructionAccount::new("feePayer", true, true, "Fee payer"),
IdlInstructionAccount::new("systemProgram", false, false, "The System Program"),
],
vec![IdlInstructionArg::new(
"villain",
IdlInstructionArgType::new("Villain"),
)],
IdlInstructionDiscriminant::new(3),
),
IdlInstruction::new(
"DeleteVillain",
vec![
IdlInstructionAccount::new(
"targetAccount",
true,
false,
"The account to be deleted.",
),
IdlInstructionAccount::new(
"authority",
true,
true,
"One of the authorities specified for this account.",
),
IdlInstructionAccount::new("feePayer", true, true, "Fee payer"),
],
vec![],
IdlInstructionDiscriminant::new(4),
),
IdlInstruction::new(
"UpdateVillain",
vec![
IdlInstructionAccount::new(
"targetAccount",
true,
false,
"The account to be updated.",
),
IdlInstructionAccount::new(
"authority",
true,
true,
"One of the authorities specified for this account.",
),
IdlInstructionAccount::new("feePayer", true, true, "Fee payer"),
IdlInstructionAccount::new("systemProgram", false, false, "The System Program"),
],
vec![IdlInstructionArg::new(
"villain",
IdlInstructionArgType::new("Villain"),
)],
IdlInstructionDiscriminant::new(5),
),
IdlInstruction::new(
"CustomInstruction",
vec![
IdlInstructionAccount::new(
"targetAccount",
true,
false,
"The account to be used as a test.",
),
IdlInstructionAccount::new(
"authority",
true,
true,
"One of the authorities specified for this account.",
),
IdlInstructionAccount::new("feePayer", true, true, "Fee payer"),
IdlInstructionAccount::new("systemProgram", false, false, "The System Program"),
],
vec![IdlInstructionArg::new(
"customArgs",
IdlInstructionArgType::new("CustomArgs"),
)],
IdlInstructionDiscriminant::new(6),
),
];
let idl = Idl::new(&version, &name, instructions, accounts, types, metadata);
idl.write_to_json("./target/idl");
}
| 0
|
solana_public_repos/nautilus-project/nautilus/solana/idl
|
solana_public_repos/nautilus-project/nautilus/solana/idl/src/util.rs
|
use super::{idl_metadata::IdlMetadata, Idl};
pub fn load_idl_from_json(idl_path: &str) -> std::io::Result<Idl> {
let file = std::fs::File::open(idl_path)?;
let idl: Idl = serde_json::from_reader(file)?;
Ok(idl)
}
pub fn update_program_id(idl_path: &str, program_id: &str) -> std::io::Result<()> {
let mut idl: Idl = load_idl_from_json(idl_path)?;
idl.metadata = IdlMetadata::new(program_id);
idl.write_to_json(idl_path)?;
Ok(())
}
| 0
|
solana_public_repos/nautilus-project/nautilus/solana/idl
|
solana_public_repos/nautilus-project/nautilus/solana/idl/src/idl_instruction.rs
|
use serde::{Deserialize, Serialize};
use super::idl_type::IdlType;
/// An IDL instruction.
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct IdlInstruction {
pub name: String,
pub accounts: Vec<IdlInstructionAccount>,
pub args: Vec<IdlInstructionArg>,
pub discriminant: IdlInstructionDiscriminant,
}
impl IdlInstruction {
pub fn new(
name: &str,
accounts: Vec<IdlInstructionAccount>,
args: Vec<IdlInstructionArg>,
discriminant: IdlInstructionDiscriminant,
) -> Self {
Self {
name: name.to_string(),
accounts,
args,
discriminant,
}
}
}
/// An account listed in an IDL instruction.
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct IdlInstructionAccount {
pub name: String,
pub is_mut: bool,
pub is_signer: bool,
#[serde(rename = "type")]
pub account_type: String,
pub desc: String,
}
impl IdlInstructionAccount {
pub fn new(
name: String,
is_mut: bool,
is_signer: bool,
account_type: String,
desc: String,
) -> Self {
Self {
name,
is_mut,
is_signer,
account_type,
desc,
}
}
}
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct IdlInstructionArg {
pub name: String,
#[serde(rename = "type")]
pub arg_type: IdlType,
}
impl IdlInstructionArg {
pub fn new(name: String, arg_type: IdlType) -> Self {
Self { name, arg_type }
}
}
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct IdlInstructionDiscriminant {
#[serde(rename = "type")]
pub discriminant_type: IdlType,
pub value: u8,
}
impl IdlInstructionDiscriminant {
pub fn new(value: u8) -> Self {
Self {
discriminant_type: IdlType::U8,
value,
}
}
}
| 0
|
solana_public_repos/nautilus-project/nautilus/solana/idl
|
solana_public_repos/nautilus-project/nautilus/solana/idl/src/lib.rs
|
//
//
// ----------------------------------------------------------------
// Nautilus IDL
// ----------------------------------------------------------------
//
// Much of this IDL crate is inspired by or borrowed directly from Metaplex's
// Shank.
//
// Nautilus and its contributors intend to introduce a shared, dynamic IDL crate
// to be used by anyone across the Solana community.
//
// All credit to contributors at Metaplex for anything borrowed in this crate.
//
// Shank: https://github.com/metaplex-foundation/shank
//
//
use std::{
fs::{self, File},
io::Write,
path::Path,
};
use serde::{Deserialize, Serialize};
use self::{idl_instruction::IdlInstruction, idl_metadata::IdlMetadata, idl_type_def::IdlTypeDef};
pub mod converters;
pub mod idl_instruction;
pub mod idl_metadata;
pub mod idl_nautilus_config;
pub mod idl_type;
pub mod idl_type_def;
pub mod util;
/// The entire IDL itself.
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Idl {
pub version: String,
pub name: String,
#[serde(skip_serializing_if = "Vec::is_empty")]
pub instructions: Vec<IdlInstruction>,
#[serde(skip_serializing_if = "Vec::is_empty")]
pub accounts: Vec<IdlTypeDef>,
#[serde(skip_serializing_if = "Vec::is_empty")]
pub types: Vec<IdlTypeDef>,
pub metadata: IdlMetadata,
}
impl Idl {
pub fn new(
version: String,
name: String,
instructions: Vec<IdlInstruction>,
accounts: Vec<IdlTypeDef>,
types: Vec<IdlTypeDef>,
metadata: IdlMetadata,
) -> Self {
Self {
version,
name,
instructions,
accounts,
types,
metadata,
}
}
pub fn write_to_json(&self, dir_path: &str) -> std::io::Result<()> {
if dir_path != "." {
fs::create_dir_all(dir_path)?;
}
let idl_path = Path::join(Path::new(dir_path), &format!("{}.json", &self.name));
let mut file = File::create(idl_path)?;
let json_string = serde_json::to_string(&self)?;
file.write_all(json_string.as_bytes())?;
Ok(())
}
}
| 0
|
solana_public_repos/nautilus-project/nautilus/solana/idl
|
solana_public_repos/nautilus-project/nautilus/solana/idl/src/idl_type_def.rs
|
use serde::{Deserialize, Serialize};
use super::{idl_nautilus_config::IdlTypeDefNautilusConfig, idl_type::IdlType};
/// An IDL type definition.
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct IdlTypeDef {
pub name: String,
#[serde(rename = "type")]
pub idl_type: IdlTypeDefType,
#[serde(skip_serializing_if = "Option::is_none")]
pub config: Option<IdlTypeDefNautilusConfig>,
}
impl IdlTypeDef {
pub fn new(
name: String,
idl_type: IdlTypeDefType,
config: Option<IdlTypeDefNautilusConfig>,
) -> Self {
Self {
name,
idl_type,
config,
}
}
}
impl From<&syn::ItemStruct> for IdlTypeDef {
fn from(value: &syn::ItemStruct) -> Self {
Self {
name: value.ident.to_string(),
idl_type: IdlTypeDefType::Struct {
fields: value.fields.iter().map(|f| f.into()).collect(),
},
config: None,
}
}
}
impl From<&syn::ItemEnum> for IdlTypeDef {
fn from(value: &syn::ItemEnum) -> Self {
Self {
name: value.ident.to_string(),
idl_type: IdlTypeDefType::Enum {
variants: value.variants.iter().map(|v| v.into()).collect(),
},
config: None,
}
}
}
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "lowercase", tag = "kind")]
pub enum IdlTypeDefType {
Struct { fields: Vec<IdlTypeStructField> },
Enum { variants: Vec<IdlTypeEnumVariant> },
}
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct IdlTypeStructField {
pub name: String,
#[serde(rename = "type")]
pub field_data_type: IdlType,
}
impl IdlTypeStructField {
pub fn new(name: String, field_data_type: IdlType) -> Self {
Self {
name,
field_data_type,
}
}
}
impl From<&syn::Field> for IdlTypeStructField {
fn from(value: &syn::Field) -> Self {
let name = match &value.ident {
Some(ident) => ident.to_string(),
None => panic!("Expected named field."),
};
let ty = &value.ty;
Self {
name,
field_data_type: ty.into(),
}
}
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct IdlTypeEnumVariant {
pub name: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub fields: Option<IdlTypeEnumFields>,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(untagged)]
pub enum IdlTypeEnumFields {
Named(Vec<IdlTypeStructField>),
}
impl From<&syn::Variant> for IdlTypeEnumVariant {
fn from(value: &syn::Variant) -> Self {
let fields = match &value.fields {
syn::Fields::Named(named_fields) => {
let fields = named_fields
.named
.iter()
.map(|field| field.into())
.collect();
Some(IdlTypeEnumFields::Named(fields))
}
syn::Fields::Unit => None,
syn::Fields::Unnamed(_) => panic!("Expected named fields in enum variant."),
};
Self {
name: value.ident.to_string(),
fields,
}
}
}
| 0
|
solana_public_repos/nautilus-project/nautilus/solana/idl
|
solana_public_repos/nautilus-project/nautilus/solana/idl/src/idl_metadata.rs
|
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct IdlMetadata {
pub origin: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub address: Option<String>,
}
impl IdlMetadata {
pub fn new(address: &str) -> Self {
Self {
origin: "nautilus".to_string(),
address: Some(address.to_string()),
}
}
pub fn new_with_no_id() -> Self {
Self {
origin: "nautilus".to_string(),
address: None,
}
}
}
| 0
|
solana_public_repos/nautilus-project/nautilus/solana/idl
|
solana_public_repos/nautilus-project/nautilus/solana/idl/src/idl_type.rs
|
use serde::{Deserialize, Serialize};
/// An IDL type enum for converting from Rust types to IDL type.
///
/// Copied from Shank: https://github.com/metaplex-foundation/shank
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub enum IdlType {
Array(Box<IdlType>, usize),
Bool,
Bytes,
Defined(String),
I128,
I16,
I32,
I64,
I8,
Option(Box<IdlType>),
Tuple(Vec<IdlType>),
PublicKey,
String,
U128,
U16,
U32,
U64,
U8,
Vec(Box<IdlType>),
HashMap(Box<IdlType>, Box<IdlType>),
BTreeMap(Box<IdlType>, Box<IdlType>),
HashSet(Box<IdlType>),
BTreeSet(Box<IdlType>),
}
impl From<&syn::Type> for IdlType {
fn from(value: &syn::Type) -> Self {
match value {
syn::Type::Path(type_path) => {
let ident = &type_path.path.segments.last().unwrap().ident;
let arguments = &type_path.path.segments.last().unwrap().arguments;
match ident.to_string().as_str() {
"Vec" => {
if let syn::PathArguments::AngleBracketed(args) = arguments {
if args.args.len() == 1 {
let inner_type = args.args.first().unwrap();
if let syn::GenericArgument::Type(inner_type) = inner_type {
return IdlType::Vec(Box::new(Self::from(inner_type)));
}
}
}
panic!("Expected Vec<T>.");
}
"bool" => IdlType::Bool,
"u8" => IdlType::U8,
"u16" => IdlType::U16,
"u32" => IdlType::U32,
"u64" => IdlType::U64,
"u128" => IdlType::U128,
"i8" => IdlType::I8,
"i16" => IdlType::I16,
"i32" => IdlType::I32,
"i64" => IdlType::I64,
"i128" => IdlType::I128,
"String" => IdlType::String,
"Pubkey" => IdlType::PublicKey,
"Bytes" => IdlType::Bytes,
_ => IdlType::Defined(ident.to_string()),
}
}
syn::Type::Array(array_type) => {
let size = match &array_type.len {
syn::Expr::Lit(lit) => {
if let syn::Lit::Int(int_lit) = &lit.lit {
int_lit.base10_parse().unwrap()
} else {
panic!("Expected array length as an integer literal.");
}
}
_ => panic!("Expected array length as an integer literal."),
};
IdlType::Array(Box::new(Self::from(&*array_type.elem)), size)
}
syn::Type::Tuple(tuple_type) => {
let types = tuple_type
.elems
.iter()
.map(|elem| Self::from(elem))
.collect();
IdlType::Tuple(types)
}
syn::Type::Reference(type_reference) => {
if let syn::Type::Slice(slice_type) = &*type_reference.elem {
if let syn::Type::Path(ref_type_path) = &*slice_type.elem {
let ident = &ref_type_path.path.segments.last().unwrap().ident;
if ident == "u8" {
IdlType::Bytes
} else {
panic!("Expected &[u8].");
}
} else {
panic!("Expected &[u8].");
}
} else {
Self::from(&*type_reference.elem)
}
}
syn::Type::Paren(paren_type) => Self::from(&*paren_type.elem),
_ => panic!("Unsupported type."),
}
}
}
| 0
|
solana_public_repos/nautilus-project/nautilus/solana/idl
|
solana_public_repos/nautilus-project/nautilus/solana/idl/src/idl_nautilus_config.rs
|
use serde::{Deserialize, Serialize};
use crate::idl_type::IdlType;
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub enum IdlSeed {
Lit { value: String },
Field { key: String },
Param { key: String, value: IdlType },
}
/// Additional Nautilus-specific IDL configurations.
///
/// These configurations are additional (and mostly optional) configs for the
/// client to use to perform certain actions such as SQL queries and
/// autoincrement.
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct IdlTypeDefNautilusConfig {
#[serde(skip_serializing_if = "Option::is_none")]
pub discrminator_str: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub table_name: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub primary_key: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub autoincrement: Option<bool>,
pub authorities: Vec<String>,
#[serde(skip_serializing_if = "Vec::is_empty")]
pub default_instructions: Vec<IdlTypeDefNautilusConfigDefaultInstruction>,
#[serde(skip_serializing_if = "Vec::is_empty")]
pub seeds: Vec<IdlSeed>,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub enum IdlTypeDefNautilusConfigDefaultInstruction {
Create(String),
Delete(String),
Update(String),
}
| 0
|
solana_public_repos/nautilus-project/nautilus/solana/idl/src
|
solana_public_repos/nautilus-project/nautilus/solana/idl/src/converters/py.rs
|
//! Converts a JSON IDL to Python bindings.
use std::{
fs::{self, File},
io::Write,
path::Path,
};
use crate::{
idl_instruction::IdlInstruction,
idl_type::IdlType,
idl_type_def::{IdlTypeDef, IdlTypeDefType},
Idl,
};
pub trait PythonIdlWrite {
fn write_to_py(&self, dir_path: &str) -> std::io::Result<()>;
}
pub trait PythonConverter {
fn to_python_string(&self) -> String;
}
impl PythonIdlWrite for Idl {
fn write_to_py(&self, dir_path: &str) -> std::io::Result<()> {
if dir_path != "." {
fs::create_dir_all(dir_path)?;
}
let py_idl_path = Path::join(Path::new(dir_path), &format!("{}.py", &self.name));
let mut file = File::create(py_idl_path)?;
let python_string = self.to_python_string();
file.write_all(python_string.as_bytes())?;
Ok(())
}
}
impl PythonConverter for Idl {
fn to_python_string(&self) -> String {
// TODO: Lay down schema and add instructions/configs:
let mut all_types = self.accounts.clone();
all_types.extend(self.types.clone());
let all_types_strings: Vec<String> =
all_types.iter().map(|t| t.to_python_string()).collect();
let res = all_types_strings.join("\n");
res
}
}
impl PythonConverter for IdlInstruction {
fn to_python_string(&self) -> String {
todo!()
}
}
impl PythonConverter for IdlTypeDef {
fn to_python_string(&self) -> String {
match &self.idl_type {
IdlTypeDefType::Struct { fields } => {
let fields_str = fields
.iter()
.map(|field| {
format!(
" {}: {}",
field.name,
field.field_data_type.to_python_string()
)
})
.collect::<Vec<String>>()
.join("\n");
format!("class {}:\n{}\n", self.name, fields_str)
}
IdlTypeDefType::Enum { .. } => String::new(), // TODO: Python enums not supported yet
}
}
}
impl PythonConverter for IdlType {
fn to_python_string(&self) -> String {
match self {
IdlType::Array(inner_type, size) => {
format!("[{}; {}]", inner_type.to_python_string(), size)
}
IdlType::Bool => "bool".to_string(),
IdlType::Bytes => "bytes".to_string(),
IdlType::Defined(name) => name.clone(),
IdlType::I128 => "int".to_string(),
IdlType::I16 => "int".to_string(),
IdlType::I32 => "int".to_string(),
IdlType::I64 => "int".to_string(),
IdlType::I8 => "int".to_string(),
IdlType::Option(inner_type) => format!("Optional[{}]", inner_type.to_python_string()),
IdlType::Tuple(types) => format!(
"Tuple[{}]",
types
.iter()
.map(|t| t.to_python_string())
.collect::<Vec<String>>()
.join(", ")
),
IdlType::PublicKey => "PublicKey".to_string(),
IdlType::String => "str".to_string(),
IdlType::U128 => "int".to_string(),
IdlType::U16 => "int".to_string(),
IdlType::U32 => "int".to_string(),
IdlType::U64 => "int".to_string(),
IdlType::U8 => "int".to_string(),
IdlType::Vec(inner_type) => format!("List[{}]", inner_type.to_python_string()),
IdlType::HashMap(key_type, value_type) => format!(
"Dict[{}, {}]",
key_type.to_python_string(),
value_type.to_python_string()
),
IdlType::BTreeMap(key_type, value_type) => format!(
"Dict[{}, {}]",
key_type.to_python_string(),
value_type.to_python_string()
),
IdlType::HashSet(value_type) => format!("Set[{}]", value_type.to_python_string()),
IdlType::BTreeSet(value_type) => format!("Set[{}]", value_type.to_python_string()),
}
}
}
| 0
|
solana_public_repos/nautilus-project/nautilus/solana/idl/src
|
solana_public_repos/nautilus-project/nautilus/solana/idl/src/converters/mod.rs
|
pub mod py;
pub mod ts;
| 0
|
solana_public_repos/nautilus-project/nautilus/solana/idl/src
|
solana_public_repos/nautilus-project/nautilus/solana/idl/src/converters/ts.rs
|
//! Converts a JSON IDL to TypeScript bindings.
use std::{
fs::{self, File},
io::Write,
path::Path,
};
use crate::{
idl_instruction::IdlInstruction,
idl_type::IdlType,
idl_type_def::{IdlTypeDef, IdlTypeDefType, IdlTypeEnumFields},
Idl,
};
pub trait TypeScriptIdlWrite {
fn write_to_ts(&self, dir_path: &str) -> std::io::Result<()>;
}
pub trait TypeScriptConverter {
fn to_typescript_string(&self) -> String;
}
impl TypeScriptIdlWrite for Idl {
fn write_to_ts(&self, dir_path: &str) -> std::io::Result<()> {
if dir_path != "." {
fs::create_dir_all(dir_path)?;
}
let ts_idl_path = Path::join(Path::new(dir_path), &format!("{}.ts", &self.name));
let mut file = File::create(ts_idl_path)?;
let typescript_string = self.to_typescript_string();
file.write_all(typescript_string.as_bytes())?;
Ok(())
}
}
impl TypeScriptConverter for Idl {
fn to_typescript_string(&self) -> String {
// TODO: Lay down schema and add instructions/configs:
let mut all_types = self.accounts.clone();
all_types.extend(self.types.clone());
let all_types_strings: Vec<String> =
all_types.iter().map(|t| t.to_typescript_string()).collect();
let res = all_types_strings.join("\n");
res
}
}
impl TypeScriptConverter for IdlInstruction {
fn to_typescript_string(&self) -> String {
todo!()
}
}
impl TypeScriptConverter for IdlTypeDef {
fn to_typescript_string(&self) -> String {
match &self.idl_type {
IdlTypeDefType::Struct { fields } => {
let fields_str = fields
.iter()
.map(|field| {
format!(
" {}: {};",
field.name,
field.field_data_type.to_typescript_string()
)
})
.collect::<Vec<String>>()
.join("\n");
format!("type {} = {{\n{}\n}};", self.name, fields_str)
}
IdlTypeDefType::Enum { variants } => {
let variants_str = variants
.iter()
.map(|variant| {
let fields_str = match &variant.fields {
Some(IdlTypeEnumFields::Named(fields)) => fields
.iter()
.map(|field| {
format!(
" {}: {};",
field.name,
field.field_data_type.to_typescript_string()
)
})
.collect::<Vec<String>>()
.join(", "),
None => String::new(),
};
format!("{} = {{ {} }}", variant.name, fields_str)
})
.collect::<Vec<String>>()
.join(" | ");
format!("type {} = {};", self.name, variants_str)
}
}
}
}
impl TypeScriptConverter for IdlType {
fn to_typescript_string(&self) -> String {
match self {
IdlType::Array(idl_type, size) => {
format!("[{}; {}]", idl_type.to_typescript_string(), size)
}
IdlType::Bool => "boolean".to_string(),
IdlType::Bytes => "Uint8Array".to_string(),
IdlType::Defined(name) => name.clone(),
IdlType::I128 | IdlType::I16 | IdlType::I32 | IdlType::I64 | IdlType::I8 => {
"number".to_string()
}
IdlType::Option(idl_type) => format!("{} | null", idl_type.to_typescript_string()),
IdlType::Tuple(idl_types) => format!(
"[{}]",
idl_types
.iter()
.map(|idl_type| idl_type.to_typescript_string())
.collect::<Vec<String>>()
.join(", ")
),
IdlType::PublicKey => "PublicKey".to_string(),
IdlType::String => "string".to_string(),
IdlType::U128 | IdlType::U16 | IdlType::U32 | IdlType::U64 | IdlType::U8 => {
"number".to_string()
}
IdlType::Vec(idl_type) => format!("{}[]", idl_type.to_typescript_string()),
IdlType::HashMap(key_type, value_type) => format!(
"Map<{}, {}>",
key_type.to_typescript_string(),
value_type.to_typescript_string()
),
IdlType::BTreeMap(key_type, value_type) => format!(
"Map<{}, {}>",
key_type.to_typescript_string(),
value_type.to_typescript_string()
),
IdlType::HashSet(idl_type) => format!("Set<{}>", idl_type.to_typescript_string()),
IdlType::BTreeSet(idl_type) => format!("Set<{}>", idl_type.to_typescript_string()),
}
}
}
| 0
|
solana_public_repos/nautilus-project/nautilus/solana
|
solana_public_repos/nautilus-project/nautilus/solana/derive/Cargo.toml
|
[package]
name = "nautilus-derive"
version = "0.0.1"
authors = ["Joe Caulfield <jcaulfield135@gmail.com>"]
repository = "https://github.com/nautilus-project/nautilus"
license = "Apache-2.0"
description = "Nautilus derive macro for adding CRUD operations to data types"
rust-version = "1.59"
edition = "2021"
[lib]
proc-macro = true
[dependencies]
proc-macro2 = "1.0"
quote = "1.0"
nautilus-syn = { path = "../syn", version = "0.0.1" }
syn = { version = "1.0", features = ["extra-traits"] }
| 0
|
solana_public_repos/nautilus-project/nautilus/solana/derive
|
solana_public_repos/nautilus-project/nautilus/solana/derive/src/lib.rs
|
//! Nautilus' macros used to power its abstraction.
use nautilus_syn::{entry::NautilusEntrypoint, object::NautilusObject};
use proc_macro::TokenStream;
use quote::ToTokens;
use syn::{parse_macro_input, ItemStruct};
extern crate proc_macro;
/// The procedural macro to build the entirety of a Nautilus program.
///
/// This macro alone can build a valid Nautilus program from the annotated
/// module.
///
/// Parses the annotated module into a `syn::ItemMod` and converts that to a
/// `nautilus_syn::NautilusEntrypoint` to build the program's entrypoint,
/// processor, and IDL.
#[proc_macro_attribute]
pub fn nautilus(_: TokenStream, input: TokenStream) -> TokenStream {
parse_macro_input!(input as NautilusEntrypoint)
.to_token_stream()
.into()
}
/// The derive macro to implement the required traits to allow for the annotated
/// struct to serve as the data type for a Nautilus record - allowing it to be
/// used as `T` inside of `Record<'_, T>`.
#[proc_macro_derive(Table, attributes(default_instructions, primary_key, authority))]
pub fn nautilus_table(input: TokenStream) -> TokenStream {
let item_struct = parse_macro_input!(input as ItemStruct);
NautilusObject::from_item_struct(
item_struct,
nautilus_syn::object::NautilusObjectType::Record,
)
.to_token_stream()
.into()
}
/// The derive macro to implement the required traits to allow for the annotated
/// struct to serve as the data type for a Nautilus account - allowing it to be
/// used as `T` inside of `Account<'_, T>`.
#[proc_macro_derive(State, attributes(seeds, authority))]
pub fn nautilus_account(input: TokenStream) -> TokenStream {
let item_struct = parse_macro_input!(input as ItemStruct);
NautilusObject::from_item_struct(
item_struct,
nautilus_syn::object::NautilusObjectType::Account,
)
.to_token_stream()
.into()
}
| 0
|
solana_public_repos/nautilus-project/nautilus/solana
|
solana_public_repos/nautilus-project/nautilus/solana/syn/Cargo.toml
|
[package]
name = "nautilus-syn"
version = "0.0.1"
authors = ["Joe Caulfield <jcaulfield135@gmail.com>"]
repository = "https://github.com/nautilus-project/nautilus"
license = "Apache-2.0"
description = "Lib for parsing syntax for Nautilus derive macros"
rust-version = "1.59"
edition = "2021"
[dependencies]
borsh = "0.9.3"
borsh-derive = "0.9.3"
cargo_toml = "0.15.2"
case = "1.0.0"
convert_case = "0.6.0"
nautilus-idl = { version = "0.0.1", path = "../idl" }
proc-macro2 = "1.0"
quote = "1.0"
shank_idl = "0.0.12"
shank_macro_impl = "0.0.12"
solana-program = "1.15.0"
syn = { version = "1.0", features = ["extra-traits", "full"] }
| 0
|
solana_public_repos/nautilus-project/nautilus/solana/syn
|
solana_public_repos/nautilus-project/nautilus/solana/syn/src/lib.rs
|
//
//
// ----------------------------------------------------------------
// Nautilus Token Generation
// ----------------------------------------------------------------
//
//
pub mod entry;
pub mod object;
| 0
|
solana_public_repos/nautilus-project/nautilus/solana/syn/src
|
solana_public_repos/nautilus-project/nautilus/solana/syn/src/entry/entry_variant.rs
|
//! A `syn`-powered struct that dissolves to the required components to create
//! the variants of the program's instruction enum and it's associated processor
//! match arm initialization logic.
use nautilus_idl::idl_instruction::IdlInstruction;
use proc_macro2::{Span, TokenStream};
use quote::quote;
use syn::{Ident, Type};
use crate::{
entry::required_account::{to_ident_pointer, RequiredAccountSubtype},
object::{parser::NautilusObjectConfig, source::source_nautilus_names, NautilusObject},
};
use super::{
entry_enum::NautilusEntrypointEnum,
required_account::{
metadata_ident, mint_authority_ident, self_account_ident, RequiredAccount,
RequiredAccountType,
},
};
/// The struct used to house all of the required components for building out the
/// generated program, derived from the user's declared function.
///
/// The key functionality actually occurs in the trait implementations for this
/// struct - including the self implementations such as `new(..)`.
#[derive(Debug)]
pub struct NautilusEntrypointEnumVariant {
/// Instruction discriminant: derived from the order the functions are
/// declared.
pub discriminant: u8,
/// The identifier of this instruction's variant in the program instruction
/// enum.
pub variant_ident: Ident,
/// The arguments required for this instruction's variant in the program
/// instruction enum.
pub variant_args: Vec<(Ident, Type)>,
/// All required accounts for this instruction, in order to instantiate the
/// declared Nautilus objects.
pub required_accounts: Vec<RequiredAccount>,
/// The identifier of the user's declared function, in order to call it.
pub call_ident: Ident,
/// The "call context" of each declared parameter in the user's defined
/// function signature.
///
/// "Call context" can be explored further by examining the documentation
/// for `CallContext`, but essentially it's information about whether or
/// not the parameter is a Nautilus object or an instruction argument.
pub call_context: Vec<CallContext>,
}
/// "Call context" for each declared parameter in the user's defined function
/// signature.
#[derive(Debug)]
pub enum CallContext {
/// The parameter is in fact a Nautilus object.
///
/// Houses the configurations for this specific Nautilus object declared,
/// which will tell Nautilus how to instanitate it.
Nautilus(NautilusObject),
/// The parameter is an instruction argument and not a Nautilus object.
Arg(Ident),
}
impl NautilusEntrypointEnumVariant {
/// Creates a new `NautilusEntrypointEnumVariant`.
///
/// This action will map each `CallContext::Nautilus(..)` for the parameters
/// declared in the user's function to determine all required accounts
/// for the instruction.
pub fn new(
discriminant: u8,
variant_ident: Ident,
variant_args: Vec<(Ident, Type)>,
call_ident: Ident,
call_context: Vec<CallContext>,
) -> Self {
let required_accounts = RequiredAccount::condense(
call_context
.iter()
.filter_map(|ctx| match ctx {
CallContext::Nautilus(n) => {
let req = n.get_required_accounts();
let mut accounts = vec![];
accounts.extend(req.0);
match req.1 {
Some(r) => accounts.extend(r),
None => (),
};
Some(accounts)
}
CallContext::Arg(_) => None,
})
.collect(),
);
Self {
discriminant,
variant_ident,
variant_args,
required_accounts,
call_ident,
call_context,
}
}
/// Builds the processor match arm for this particular declared function.
///
/// This function is where the bulk of the magic occurs.
///
/// Its basically going to generate the code to extract all required
/// accounts from the provided list of accounts in the program's
/// entrypoint, ie. `accounts: &[AccountInfo]`, then use those
/// accounts to create `Box` pointers and instantiate each declared Nautilus
/// object, then call the user's function.
fn build_match_arm_logic(&self) -> TokenStream {
let instruction_name = self.variant_ident.to_string();
let mut index_init = quote!();
// Maps all required accounts for this instruction into the proper tokens to
// extract from the iterator and create a `Box` pointer for that
// account. The `Box` pointer is created in this step, so all cloning
// later in the match arm is cloning the `Box<AccountInfo>` instead of
// the `AccountInfo` itself.
let all_accounts = self.required_accounts.iter().map(|r| {
let ident = match &r.account_type {
RequiredAccountType::Account(subtype) => match &subtype {
RequiredAccountSubtype::SelfAccount => self_account_ident(&r.ident),
RequiredAccountSubtype::Metadata => metadata_ident(&r.ident),
RequiredAccountSubtype::MintAuthority => mint_authority_ident(&r.ident),
},
RequiredAccountType::IndexAccount => {
index_init = quote! { let nautilus_index = NautilusIndex::load(program_id, index_pointer)?; }; // TODO
r.ident.clone()
}
_ => r.ident.clone(),
};
let ident_pointer = to_ident_pointer(&ident);
quote! {
let #ident = next_account_info(accounts_iter)?.to_owned();
let #ident_pointer = Box::new(#ident);
}
});
let mut object_inits = vec![];
let mut call_args = vec![];
// This block is going to try to instantiate every Nautilus object needed to
// call the user's function. Non-Nautilus objects will simply
// pass-through to the called function. The last line of the processor
// match arm will call the user's function with all of the instantiated
// "call_args".
{
self.call_context.iter().for_each(|ctx| {
match ctx {
CallContext::Nautilus(obj) => match &obj.entry_config {
Some(config) => {
let arg_ident = &config.arg_ident;
let (obj_type, arg_ty, is_custom) = match source_nautilus_names().contains(&obj.ident.to_string()) {
true => (obj.ident.clone(), quote!(), false),
false => {
let ty = &obj.ident;
(
match &obj.object_config {
Some(t) => match t {
NautilusObjectConfig::RecordConfig { .. } => Ident::new("Record", Span::call_site()),
NautilusObjectConfig::AccountConfig { .. } => Ident::new("Account", Span::call_site()),
},
None => panic!("Object {} did not match any source Nautilus objects and was not annotated with a Nautilus #[derive(..)] macro", &obj.ident.to_string()),
},
quote! { #ty },
true,
)
},
};
let required_accounts_for_obj = obj.get_required_accounts();
// Identifiers for all accounts required "for read" - in other words, any `Box<AccountInfo<'_>>` fields required
// for that Nautilus object.
let read_call_idents = required_accounts_for_obj.0.iter().map(|r| {
let t: TokenStream = r.into();
t
});
match required_accounts_for_obj.1 {
// If the object is wrapped in `Create<'_, T>`, this option will have a value.
// This means we need to get the identifiers for all accounts required "for create" as well.
Some(accounts_for_create) => {
let create_call_idents = accounts_for_create.iter().map(|r| {
let t: TokenStream = r.into();
t
});
let create_obj_init = match is_custom {
true => quote! {
let mut #arg_ident = Create::new(
#(#create_call_idents,)*
#obj_type::< #arg_ty >::new(#(#read_call_idents,)*)
)?;
},
false => quote! {
let mut #arg_ident = Create::new(
#(#create_call_idents,)*
#obj_type::new(#(#read_call_idents,)*)
)?;
},
};
object_inits.push(create_obj_init);
},
None => {
if config.is_signer {
object_inits.push(
quote! { let #arg_ident = Signer::new(#obj_type::load(#(#read_call_idents,)*)?)?; },
);
} else if config.is_mut {
object_inits.push(
quote! { let #arg_ident = Mut::new(#obj_type::load(#(#read_call_idents,)*)?)?; },
);
} else {
object_inits.push(match is_custom {
true => quote! { let #arg_ident = #obj_type::< #arg_ty >::load(#(#read_call_idents,)*)?; },
false => quote! { let #arg_ident = #obj_type::load(#(#read_call_idents,)*)?; },
}
);
}
},
};
call_args.push(quote! { #arg_ident })
}
None => {
panic!("Error processing entrypoint: `entry_config` not set.")
}
},
CallContext::Arg(arg) => call_args.push(quote! { #arg }),
};
});
}
let call_ident = &self.call_ident;
quote::quote! {
{
splogger::info!("Instruction: {}", #instruction_name);
let accounts_iter = &mut accounts.iter();
#(#all_accounts)*
#index_init
#(#object_inits)*
#call_ident(#(#call_args,)*)
}
}
}
}
impl From<&NautilusEntrypointEnumVariant> for (TokenStream, TokenStream, IdlInstruction) {
/// Dissolves the `NautilusEntrypointEnumVariant` into the proper components
/// for building out the generated program.
///
/// When the `NautilusEntrypointEnum` is dissolved, it dissolves each
/// `NautilusEntrypointEnumVariant` of its `variants` vector and
/// aggregates each generated component.
///
/// Consider the return type of the function itself - defined at the trait
/// level: (`TokenStream`, `TokenStream`, `IdlInstruction`):
/// * `TokenStream` (first): The identifier and associated arguments for the
/// program instruction enum variant for this particular declared
/// function.
/// * `TokenStream` (second): The processor match arm for this particular
/// declared function.
/// * `IdlInstruction`: The IDL instruction derived from this particular
/// declared function.
fn from(value: &NautilusEntrypointEnumVariant) -> Self {
let variant_ident = &value.variant_ident;
let enum_ident = NautilusEntrypointEnum::enum_ident();
let (arg_names, arg_types): (Vec<Ident>, Vec<Type>) =
value.variant_args.clone().into_iter().unzip();
let match_arm_logic = value.build_match_arm_logic();
(
quote! { #variant_ident(#(#arg_types,)*), },
quote! { #enum_ident::#variant_ident(#(#arg_names,)*) => #match_arm_logic, },
value.into(),
)
}
}
| 0
|
solana_public_repos/nautilus-project/nautilus/solana/syn/src
|
solana_public_repos/nautilus-project/nautilus/solana/syn/src/entry/idl.rs
|
//! Converters to allow for dissolving of Nautilus token-generation
//! configuration structs,
// such as `NautilusEntrypointEnum` and `NautilusEntrypointEnumVariant`,
// into IDL components.
use nautilus_idl::{
idl_instruction::{
IdlInstruction, IdlInstructionAccount, IdlInstructionArg, IdlInstructionDiscriminant,
},
idl_nautilus_config::{
IdlSeed, IdlTypeDefNautilusConfig, IdlTypeDefNautilusConfigDefaultInstruction,
},
idl_type_def::IdlTypeDef,
};
use crate::object::{
default_instructions::DefaultInstruction, parser::NautilusObjectConfig, seeds::Seed,
NautilusObject, NautilusObjectRawType,
};
use super::{entry_variant::NautilusEntrypointEnumVariant, required_account::RequiredAccount};
/// Converts the `NautilusEntrypointEnumVariant` into an IDL instruction.
///
/// This will use the configurations from the variant to build the necessary
/// instruction in the IDL - including all required accounts.
impl From<&NautilusEntrypointEnumVariant> for IdlInstruction {
fn from(value: &NautilusEntrypointEnumVariant) -> Self {
let mut name = value.variant_ident.to_string();
name.replace_range(..1, &name[..1].to_lowercase());
IdlInstruction {
name,
accounts: value.required_accounts.iter().map(|a| a.into()).collect(),
args: value
.variant_args
.iter()
.map(|(ident, ty)| IdlInstructionArg::new(ident.to_string(), ty.into()))
.collect(),
discriminant: IdlInstructionDiscriminant::new(value.discriminant),
}
}
}
/// Straightforward conversion from a `RequiredAccount` into its IDL
/// representation, including configs for `is_mut` and `is_signer`.
impl From<&RequiredAccount> for IdlInstructionAccount {
fn from(value: &RequiredAccount) -> Self {
Self {
name: value.name.clone(),
is_mut: value.is_mut,
is_signer: value.is_signer,
account_type: value.account_type.to_string(),
desc: value.desc.clone(),
}
}
}
/// Straightforward conversion from a `NautilusObject` into its IDL type
/// definition.
impl From<&NautilusObject> for IdlTypeDef {
fn from(value: &NautilusObject) -> Self {
let mut default_type_def: IdlTypeDef = match &value.raw_type {
NautilusObjectRawType::Struct(raw) => raw.into(),
NautilusObjectRawType::Enum(raw) => raw.into(),
};
match &value.object_config {
Some(config) => default_type_def.config = Some(config.into()),
None => (),
}
default_type_def
}
}
/// Converts the object configurations for a `NautilusObject` into IDL
/// configurations.
///
/// These configurations are additional (and mostly optional) configs for the
/// client to use to perform certain actions such as SQL queries and
/// autoincrement.
impl From<&NautilusObjectConfig> for IdlTypeDefNautilusConfig {
fn from(value: &NautilusObjectConfig) -> Self {
match value {
NautilusObjectConfig::RecordConfig {
table_name,
data_fields: _, // Unused in additional config.
autoincrement_enabled,
primary_key_ident,
primary_key_ty: _, // Unused, points to field name instead.
authorities,
default_instructions,
} => Self {
discrminator_str: None,
table_name: Some(table_name.clone()),
primary_key: Some(primary_key_ident.to_string()),
autoincrement: Some(*autoincrement_enabled),
authorities: authorities.iter().map(|a| a.to_string()).collect(),
default_instructions: default_instructions
.iter()
.map(|s| s.clone().into())
.collect(),
seeds: vec![],
},
NautilusObjectConfig::AccountConfig {
discrminator_str,
data_fields: _, // Unused in additional config.
authorities,
seeds,
} => Self {
discrminator_str: Some(discrminator_str.clone()),
table_name: None,
primary_key: None,
autoincrement: None,
authorities: authorities.iter().map(|a| a.to_string()).collect(),
default_instructions: vec![],
seeds: seeds.iter().map(|s| s.into()).collect(),
},
}
}
}
/// Converts a `Seed` from the `syn` crate into an `IdlSeed` from the `idl`
/// crate.
impl From<&Seed> for IdlSeed {
fn from(value: &Seed) -> Self {
match value {
Seed::Lit { value } => IdlSeed::Lit {
value: value.clone(),
},
Seed::Field { ident } => IdlSeed::Field {
key: ident.to_string(),
},
Seed::Param { ident, ty } => IdlSeed::Param {
key: ident.to_string(),
value: ty.into(),
},
}
}
}
/// Converts a `DefaultInstruction` from the `syn` crate into an
/// `IdlTypeDefNautilusConfigDefaultInstruction` from the `idl` crate.
impl From<DefaultInstruction> for IdlTypeDefNautilusConfigDefaultInstruction {
fn from(value: DefaultInstruction) -> Self {
match value {
DefaultInstruction::Create(val) => {
IdlTypeDefNautilusConfigDefaultInstruction::Create(val)
}
DefaultInstruction::Delete(val) => {
IdlTypeDefNautilusConfigDefaultInstruction::Delete(val)
}
DefaultInstruction::Update(val) => {
IdlTypeDefNautilusConfigDefaultInstruction::Update(val)
}
}
}
}
| 0
|
solana_public_repos/nautilus-project/nautilus/solana/syn/src
|
solana_public_repos/nautilus-project/nautilus/solana/syn/src/entry/mod.rs
|
//! Builds the entrypoint, processor, and IDL for a Nautilus program.
pub mod entry_enum;
pub mod entry_variant;
pub mod idl;
pub mod parser;
pub mod required_account;
use nautilus_idl::{
converters::{py::PythonIdlWrite, ts::TypeScriptIdlWrite},
idl_metadata::IdlMetadata,
Idl,
};
use proc_macro2::TokenStream;
use quote::{quote, ToTokens};
use syn::{parse::Parse, Item, ItemFn, ItemMod};
use self::{
entry_enum::NautilusEntrypointEnum,
parser::{is_use_super_star, parse_crate_context, parse_manifest},
};
/// The struct containing the parsed contents required to convert the user's
/// annotated module into the proper program configurations.
/// * `leftover_content`: Any declarations in the module that aren't named
/// functions.
/// * `instruction_enum`: The built-out program instruction enum derived from
/// the functions and their arguments.
/// * `declared_functions`: The user's declared functions as-is.
/// * `processor`: The program's processor, built into a function
/// `process_instruction`.
#[derive(Debug)]
pub struct NautilusEntrypoint {
pub leftover_content: Vec<Item>,
pub instruction_enum: TokenStream,
pub declared_functions: Vec<ItemFn>,
pub processor: TokenStream,
}
impl From<ItemMod> for NautilusEntrypoint {
/// Converts the user's annotated module into the `NautilusEntrypoint`
/// struct.
///
/// All of the work to build out the entrypoint, processor, and IDL for a
/// Nautilus program is done here. During this conversion, the module
/// (`ItemMod`) is broken down into components, and the functions declared
/// by the user are extracted and used to build out various child
/// structs such as `NautilusEntrypointEnum` and
/// `NautilusEntrypointEnumVariant`.
///
/// Using information extracted from the user's manifest (`Cargo.toml`) and
/// the entirety of their crate, this function builds the
/// `NautilusEntrypointEnum`, which basically dissolves to the required
/// components.
///
/// For more specific information see the documentation for
/// `NautilusEntrypointEnum` and `NautilusEntrypointEnumVariant`.
fn from(value: ItemMod) -> Self {
let mut declared_functions = vec![];
let leftover_content: Vec<Item> = value
.content
.clone()
.unwrap()
.1
.into_iter()
.filter_map(|item| match is_use_super_star(&item) {
true => None,
false => match item {
Item::Fn(input_fn) => {
declared_functions.push(input_fn);
None
}
_ => Some(item),
},
})
.collect();
let (crate_version, crate_name) = parse_manifest();
let (nautilus_objects, idl_accounts, idl_types) = parse_crate_context();
let nautilus_enum =
&NautilusEntrypointEnum::new(nautilus_objects, declared_functions.clone());
let (instruction_enum, processor, idl_instructions) = nautilus_enum.into();
let idl = Idl::new(
crate_version,
crate_name,
idl_instructions,
idl_accounts,
idl_types,
IdlMetadata::new_with_no_id(),
);
match idl.write_to_json("./target/idl") {
Ok(()) => (),
Err(e) => println!("[ERROR]: Error writing IDL to JSON file: {:#?}", e),
};
match idl.write_to_py("./target/idl") {
Ok(()) => (),
Err(e) => println!(
"[ERROR]: Error writing Python bindings to .py file: {:#?}",
e
),
};
match idl.write_to_ts("./target/idl") {
Ok(()) => (),
Err(e) => println!(
"[ERROR]: Error writing TypeScript bindings to .ts file: {:#?}",
e
),
};
Self {
leftover_content,
instruction_enum,
declared_functions,
processor,
}
}
}
impl Parse for NautilusEntrypoint {
/// Parses the user's defined module into a `syn::ItemMod`, which is an
/// already pre-fabricated function, and calls Into<NautilusEntrypoint>
/// to fire the `from(value: ItemMod)` in the trait implementation `impl
/// From<ItemMod> for NautilusEntrypoint`, which does all the magic.
fn parse(input: syn::parse::ParseStream) -> syn::Result<Self> {
Ok(ItemMod::parse(input)?.into())
}
}
impl ToTokens for NautilusEntrypoint {
/// Extends the existing compiler tokens by the tokens generated by the
/// `NautilusEntrypoint`.
fn to_tokens(&self, tokens: &mut TokenStream) {
tokens.extend::<TokenStream>(self.into());
}
}
impl From<&NautilusEntrypoint> for TokenStream {
/// Converts each component of the `NautilusEntrypoint` into the proper
/// tokens for the compiler.
fn from(ast: &NautilusEntrypoint) -> Self {
let leftover_content = &ast.leftover_content;
let instruction_enum = &ast.instruction_enum;
let declared_functions = &ast.declared_functions;
let processor = &ast.processor;
quote! {
#instruction_enum
#processor
#(#declared_functions)*
#(#leftover_content)*
}
.into()
}
}
| 0
|
solana_public_repos/nautilus-project/nautilus/solana/syn/src
|
solana_public_repos/nautilus-project/nautilus/solana/syn/src/entry/entry_enum.rs
|
//! A `syn`-powered enum that dissolves to the required components to create the
//! program's entrypoint, processor, and IDL.
use nautilus_idl::idl_instruction::IdlInstruction;
use proc_macro2::{Span, TokenStream};
use quote::quote;
use syn::{Ident, ItemFn};
use crate::{
entry::entry_variant::NautilusEntrypointEnumVariant, entry::parser::parse_function,
object::NautilusObject,
};
/// The struct used to house all of the "variants" of type
/// `NautilusEntrypointEnumVariant` which dissolve to the required components
/// for building out the generated program.
///
/// The key functionality actually occurs in the trait implementations for this
/// struct - including the self implementations such as `new(..)`.
#[derive(Debug)]
pub struct NautilusEntrypointEnum {
pub variants: Vec<NautilusEntrypointEnumVariant>,
}
impl NautilusEntrypointEnum {
/// Creates a new `NautilusEntrypointEnum`.
///
/// This action will simply convert the user's declared functions into
/// `NautilusEntrypointEnumVariant` instances, which dissolve to
/// the required components for building out the generated program.
pub fn new(nautilus_objects: Vec<NautilusObject>, declared_functions: Vec<ItemFn>) -> Self {
let variants = declared_functions
.into_iter()
.enumerate()
.map(|(i, f)| {
let (variant_ident, variant_args, call_ident, call_context) =
parse_function(&nautilus_objects, f);
NautilusEntrypointEnumVariant::new(
i.try_into().unwrap(),
variant_ident,
variant_args,
call_ident,
call_context,
)
})
.collect();
Self { variants }
}
pub fn enum_ident() -> Ident {
Ident::new("NautilusEntrypoint", Span::call_site())
}
}
impl From<&NautilusEntrypointEnum> for (TokenStream, TokenStream, Vec<IdlInstruction>) {
/// Maps each `NautilusEntrypointEnumVariant` into the proper components and
/// dissolves itself into the required components for building out the
/// generated program.
///
/// Consider the `fold` operation on the `variants` field, which returns
/// (`variants`, `match_arms`, `idl_instructions`):
/// * `variants`: The variants of the instruction enum for the program.
/// * `match_arms`: The match arms of the processor which will process
/// whichever instruction enum variant (and its arguments) is provided to
/// the program.
/// * `idl_instructions`: The IDL instructions derived from the declared
/// functions - to be used in generating the IDL.
///
/// Consider the return type of the function itself - defined at the trait
/// level: (`TokenStream`, `TokenStream`, `Vec<IdlInstruction>`):
/// * `TokenStream` (first): The instruction enum.
/// * `TokenStream` (second): The processor.
/// * `Vec<IdlInstruction>`: The list of IDL instructions.
fn from(value: &NautilusEntrypointEnum) -> Self {
let enum_name = NautilusEntrypointEnum::enum_ident();
let (variants, match_arms, idl_instructions) = value.variants.iter().fold(
(Vec::new(), Vec::new(), Vec::new()),
|(mut variants, mut match_arms, mut idl_instructions), v| {
let (a, b, c): (TokenStream, TokenStream, IdlInstruction) = v.into();
variants.push(a);
match_arms.push(b);
idl_instructions.push(c);
(variants, match_arms, idl_instructions)
},
);
(
quote! {
#[derive(borsh::BorshDeserialize, borsh::BorshSerialize)]
pub enum #enum_name {
#(#variants)*
}
},
quote! {
pub fn process_instruction<'a>(
program_id: &'static Pubkey,
accounts: &[AccountInfo],
input: &[u8],
) -> ProgramResult {
let instruction = #enum_name::try_from_slice(input)?;
match instruction {
#(#match_arms)*
}
}
entrypoint!(process_instruction);
},
idl_instructions,
)
}
}
| 0
|
solana_public_repos/nautilus-project/nautilus/solana/syn/src
|
solana_public_repos/nautilus-project/nautilus/solana/syn/src/entry/required_account.rs
|
//! The module for determining accounts required for a Nautilus object.
use case::CaseExt;
use convert_case::{Case, Casing};
use proc_macro2::Span;
use quote::quote;
use syn::Ident;
use crate::object::NautilusObjectType;
/// The details of a required account for a Nautilus object.
///
/// These details pretty much map to their IDL representation directly.
#[derive(Clone, Debug, PartialEq)]
pub struct RequiredAccount {
pub ident: Ident,
pub name: String,
pub is_mut: bool,
pub is_signer: bool,
pub desc: String,
pub account_type: RequiredAccountType,
}
/// The type of account required.
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
pub enum RequiredAccountType {
ProgramId,
IndexAccount,
Account(RequiredAccountSubtype), // Any general account not matching the other variants
FeePayer,
Sysvar,
SystemProgram,
Program,
TokenProgram,
AssociatedTokenProgram,
TokenMetadataProgram,
}
/// The sub-type of a general account.
///
/// `SelfAccount` is the underlying account, while others like `Metadata` and
/// `MintAuthority` are required for some objects like `Token` and `Mint`.
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
pub enum RequiredAccountSubtype {
SelfAccount, // The underlying account for any Nautilus object
Metadata,
MintAuthority,
}
/// The type of Nautilus object
#[derive(Clone, Debug, PartialEq)]
pub enum ObjectType {
NautilusIndex,
Wallet,
Nft(bool),
Token(bool),
Mint(bool),
Metadata,
AssociatedTokenAccount,
Record(bool, Vec<Construct>), // Table record
Account(bool, Vec<Construct>), // State account
}
/// A construct shell enum used to map variants with provided args into required
/// accounts.
///
/// This enum almost mirrors the `RequiredAccountType` enum, but in this context
/// its used to pass provided configurations - such as `is_mut` and `is_signer`
/// - to the resolver.
///
/// If you examine `From<Construct> for RequiredAccount`, you'll see this enum
/// is used to resolve the required accounts for any of its variants with the
/// configs.
#[derive(Clone, Debug, PartialEq)]
pub enum Construct {
ProgramId,
Index(bool),
SelfAccount(String, String, bool, bool),
Metadata(String, String, bool),
MintAuthority(String, String, bool, bool),
FeePayer,
Sysvar(SysvarType),
SystemProgram,
TokenProgram,
AssociatedTokenProgram,
TokenMetadataProgram,
}
#[derive(Clone, Debug, PartialEq)]
pub enum SysvarType {
Clock,
EpochSchedule,
Rent,
}
impl From<Construct> for RequiredAccount {
/// Converts a Construct into the proper RequiredAccount using the provided
/// variant arguments.
fn from(value: Construct) -> Self {
match value {
Construct::ProgramId => {
let name = "program_id".to_string();
RequiredAccount {
ident: Ident::new(&name, Span::call_site()),
name: name.clone(),
is_mut: false,
is_signer: false,
desc: name,
account_type: RequiredAccountType::ProgramId,
}
}
Construct::Index(is_mut) => {
let name = "index".to_string();
RequiredAccount {
ident: name_to_ident_snake(&name),
name,
is_mut,
is_signer: false,
desc: "The Nautilus Index for this program".to_string(),
account_type: RequiredAccountType::IndexAccount,
}
}
Construct::SelfAccount(name, desc, is_mut, is_signer) => {
let ident = name_to_ident_snake(&name);
RequiredAccount {
ident,
name,
is_mut,
is_signer,
desc,
account_type: RequiredAccountType::Account(RequiredAccountSubtype::SelfAccount),
}
}
Construct::Metadata(name, desc, is_mut) => {
let ident = name_to_ident_snake(&name);
RequiredAccount {
ident,
name,
is_mut,
is_signer: false,
desc,
account_type: RequiredAccountType::Account(RequiredAccountSubtype::Metadata),
}
}
Construct::MintAuthority(name, desc, is_mut, is_signer) => {
let ident = name_to_ident_snake(&name);
RequiredAccount {
ident,
name,
is_mut,
is_signer,
desc,
account_type: RequiredAccountType::Account(
RequiredAccountSubtype::MintAuthority,
),
}
}
Construct::FeePayer => {
let account_type = RequiredAccountType::FeePayer;
let name = account_type.to_string();
RequiredAccount {
ident: name_to_ident_snake(&name),
name,
is_mut: true,
is_signer: true,
desc: "The transaction fee payer".to_string(),
account_type,
}
}
Construct::Sysvar(sysvar_type) => {
let name = match sysvar_type {
SysvarType::Clock => "clock".to_string(),
SysvarType::EpochSchedule => "epochSchedule".to_string(),
SysvarType::Rent => "rent".to_string(),
};
RequiredAccount {
ident: name_to_ident_snake(&name),
name: name.clone(),
is_mut: false,
is_signer: false,
desc: format!("The Sysvar: {}", &(name.to_case(Case::Title))).to_string(),
account_type: RequiredAccountType::Sysvar,
}
}
Construct::SystemProgram => {
let account_type = RequiredAccountType::SystemProgram;
let name = account_type.to_string();
RequiredAccount {
ident: name_to_ident_snake(&name),
name,
is_mut: false,
is_signer: false,
desc: "The System Program".to_string(),
account_type,
}
}
Construct::TokenProgram => {
let account_type = RequiredAccountType::TokenProgram;
let name = account_type.to_string();
RequiredAccount {
ident: name_to_ident_snake(&name),
name,
is_mut: false,
is_signer: false,
desc: "The Token Program".to_string(),
account_type,
}
}
Construct::AssociatedTokenProgram => {
let account_type = RequiredAccountType::AssociatedTokenProgram;
let name = account_type.to_string();
RequiredAccount {
ident: name_to_ident_snake(&name),
name,
is_mut: false,
is_signer: false,
desc: "The Associated Token Program".to_string(),
account_type,
}
}
Construct::TokenMetadataProgram => {
let account_type = RequiredAccountType::TokenMetadataProgram;
let name = account_type.to_string();
RequiredAccount {
ident: name_to_ident_snake(&name),
name,
is_mut: false,
is_signer: false,
desc: "The Token Metadata Program".to_string(),
account_type,
}
}
}
}
}
// TODO: Add support for custom descriptions
//
impl RequiredAccount {
pub fn derive_object_type(
ty_name: &str,
is_mut: bool,
nautilus_ty: Option<NautilusObjectType>,
) -> ObjectType {
if ty_name.eq("NautilusIndex") {
ObjectType::NautilusIndex
} else if ty_name.eq("Wallet") {
ObjectType::Wallet
} else if ty_name.eq("Nft") {
ObjectType::Nft(false) // TODO: PDA Tokens not supported yet
} else if ty_name.eq("Token") {
ObjectType::Token(false) // TODO: PDA Tokens not supported yet
} else if ty_name.eq("Mint") {
ObjectType::Mint(false) // TODO: PDA Tokens not supported yet
} else if ty_name.eq("Metadata") {
ObjectType::Metadata
} else if ty_name.eq("AssociatedTokenAccount") {
ObjectType::AssociatedTokenAccount
} else {
match nautilus_ty {
Some(t) => match t {
NautilusObjectType::Record => ObjectType::Record(is_mut, vec![]), // TODO: PDA authorities not supported yet
NautilusObjectType::Account => ObjectType::Account(is_mut, vec![]), // TODO: PDA authorities not supported yet
},
None => panic!("Could not match object type: {}. Was it annotated with a Nautilus #[derive(..)] macro?", ty_name)
}
}
}
/// Resolves the required accounts for an object name and ObjectType.
/// The object name, as declared in the user's function signature, is used
/// to append as a prefix to certain accounts where necessary.
pub fn resolve_accounts(
obj_name: String,
object_type: ObjectType,
is_create: bool,
is_signer: bool,
is_mut: bool,
) -> (Vec<Self>, Option<Vec<Self>>) {
let read = match object_type {
ObjectType::NautilusIndex => {
vec![
Construct::ProgramId.into(),
Construct::SelfAccount(obj_name.clone(), obj_name, is_mut, false).into(),
]
}
ObjectType::Wallet => vec![
Construct::SelfAccount(obj_name.clone(), obj_name, is_mut, is_signer).into(),
Construct::SystemProgram.into(),
],
ObjectType::Token(is_pda) | ObjectType::Nft(is_pda) => {
let metadata_name = obj_name.clone() + "_metadata";
vec![
Construct::SelfAccount(
obj_name.clone(),
obj_name.clone(),
is_mut,
is_signer && !is_pda,
)
.into(),
Construct::Metadata(
metadata_name.clone(),
format!("Metadata account for: {}", obj_name),
is_mut,
)
.into(),
Construct::TokenProgram.into(),
Construct::TokenMetadataProgram.into(),
]
}
ObjectType::Mint(is_pda) => vec![
Construct::SelfAccount(obj_name.clone(), obj_name, is_mut, is_signer && !is_pda)
.into(),
Construct::TokenProgram.into(),
],
ObjectType::Metadata => vec![
Construct::SelfAccount(obj_name.clone(), obj_name, is_mut, false).into(),
Construct::TokenMetadataProgram.into(),
],
ObjectType::AssociatedTokenAccount => {
vec![
Construct::SelfAccount(obj_name.clone(), obj_name, is_mut, false).into(),
Construct::TokenProgram.into(),
Construct::AssociatedTokenProgram.into(),
]
}
ObjectType::Record(is_mut, _) => {
vec![
Construct::ProgramId.into(),
Construct::SelfAccount(obj_name.clone(), obj_name, is_mut, false).into(),
Construct::Index(is_mut).into(),
]
}
ObjectType::Account(is_mut, _) => {
vec![
Construct::ProgramId.into(),
Construct::SelfAccount(obj_name.clone(), obj_name, is_mut, false).into(),
]
}
};
(
read,
match is_create {
true => Some(vec![
Construct::FeePayer.into(),
Construct::SystemProgram.into(),
Construct::Sysvar(SysvarType::Rent).into(),
]),
false => None,
},
)
}
/// De-duplication of required accounts. Used to aggregate all accounts
/// required for an instruction.
pub fn condense(all_required_accounts: Vec<Vec<Self>>) -> Vec<Self> {
let flattened = all_required_accounts
.into_iter()
.flat_map(|v| v.into_iter())
.filter(|r| match r.account_type {
RequiredAccountType::ProgramId => false,
_ => true,
});
let mut map = std::collections::HashMap::new();
for account in flattened {
let entry = map.entry(account.name.clone()).or_insert(account.clone());
entry.is_mut |= account.is_mut;
entry.is_signer |= account.is_signer;
entry.desc = account.desc;
}
let mut res: Vec<RequiredAccount> = map.into_iter().map(|(_, v)| v).collect();
res.sort_by(|a, b| {
let account_type_cmp = a.account_type.cmp(&b.account_type);
if account_type_cmp == std::cmp::Ordering::Equal {
a.name.cmp(&b.name)
} else {
account_type_cmp
}
});
res
}
}
impl From<&RequiredAccount> for proc_macro2::TokenStream {
/// Converts a required account into the tokens used to instantiate a
/// Nautilus object. Each required account for a Nautilus object can use
/// `Into<TokenStream>` to generate the cloning of the `Box` pointers in
/// the processor match arm, to be passed into the object's initializer.
fn from(ast: &RequiredAccount) -> Self {
match &ast.account_type {
RequiredAccountType::ProgramId => quote! { program_id },
RequiredAccountType::IndexAccount => quote! { nautilus_index.clone() },
RequiredAccountType::Account(subtype) => match subtype {
RequiredAccountSubtype::SelfAccount => {
let ident_pointer = self_account_ident_pointer(&ast.ident);
quote! { #ident_pointer.clone() }
}
RequiredAccountSubtype::Metadata => {
let ident_pointer = metadata_ident_pointer(&ast.ident);
quote! { #ident_pointer.clone() }
}
RequiredAccountSubtype::MintAuthority => {
let ident_pointer = mint_authority_ident_pointer(&ast.ident);
quote! { #ident_pointer.clone() }
}
},
_ => {
let ident_pointer = to_ident_pointer(&ast.ident);
quote! { #ident_pointer.clone() }
}
}
}
}
impl ToString for RequiredAccountType {
fn to_string(&self) -> String {
match self {
RequiredAccountType::IndexAccount => "index".to_string(),
RequiredAccountType::FeePayer => "feePayer".to_string(),
RequiredAccountType::Sysvar => "sysvar".to_string(),
RequiredAccountType::SystemProgram => "systemProgram".to_string(),
RequiredAccountType::Program => "program".to_string(),
RequiredAccountType::TokenProgram => "tokenProgram".to_string(),
RequiredAccountType::AssociatedTokenProgram => "associatedTokenProgram".to_string(),
RequiredAccountType::TokenMetadataProgram => "tokenMetadataProgram".to_string(),
_ => "account".to_string(),
}
}
}
pub fn appended_ident(ident: &Ident, to_append: &str) -> Ident {
Ident::new(&(ident.to_string() + to_append), Span::call_site())
}
pub fn self_account_ident(ident: &Ident) -> Ident {
appended_ident(ident, "_self_account")
}
pub fn metadata_ident(ident: &Ident) -> Ident {
appended_ident(ident, "_metadata_account")
}
pub fn mint_authority_ident(ident: &Ident) -> Ident {
appended_ident(ident, "_mint_authority")
}
pub fn to_ident_pointer(ident: &Ident) -> Ident {
appended_ident(ident, "_pointer")
}
pub fn self_account_ident_pointer(ident: &Ident) -> Ident {
appended_ident(ident, "_self_account_pointer")
}
pub fn metadata_ident_pointer(ident: &Ident) -> Ident {
appended_ident(ident, "_metadata_account_pointer")
}
pub fn mint_authority_ident_pointer(ident: &Ident) -> Ident {
appended_ident(ident, "_mint_authority_pointer")
}
pub fn name_to_ident(name: &str) -> Ident {
Ident::new(name, Span::call_site())
}
pub fn name_to_ident_snake(name: &str) -> Ident {
Ident::new(&(name.to_string().to_snake()), Span::call_site())
}
| 0
|
solana_public_repos/nautilus-project/nautilus/solana/syn/src
|
solana_public_repos/nautilus-project/nautilus/solana/syn/src/entry/parser.rs
|
//! Parses information about the user's entire crate.
use cargo_toml::Manifest;
use convert_case::{Case::Pascal, Casing};
use nautilus_idl::idl_type_def::IdlTypeDef;
use proc_macro2::Span;
use quote::quote;
use shank_macro_impl::krate::CrateContext;
use syn::{FnArg, Ident, Item, ItemFn, Pat, PathArguments, Type, TypePath, UseTree};
use syn::{Meta, NestedMeta};
use crate::object::source::source_nautilus_objects;
use crate::object::ObjectEntryConfig;
use crate::object::{NautilusObject, NautilusObjectType};
use super::entry_variant::CallContext;
/// Parses metadata from the user's `Cargo.toml`
pub fn parse_manifest() -> (String, String) {
let manifest = Manifest::from_path("Cargo.toml")
.expect("Failed to detect `Cargo.toml`. Is your Cargo.toml file structured properly ?");
let package = manifest
.package
.expect("Failed to parse `Cargo.toml`. Is your Cargo.toml file structured properly ?");
let crate_version = package
.version
.get()
.expect("Failed to parse crate version from `Cargo.toml`. Did you provide one ?");
(String::from(crate_version), package.name)
}
/// Uses Metaplex's `shank_macro_impl` to parse all of the contents of the
/// user's crate.
///
/// It uses this information to build the rest of the IDL (accounts and types),
/// and return all defined Nautilus objects annotated with a Nautilus derive
/// macro.
///
/// Consider the return type: (`Vec<NautilusObject>`, `Vec<IdlTypeDef>`,
/// `Vec<IdlTypeDef>`):
/// * `Vec<NautilusObject>`: All Nautilus objects defined in the crate using
/// Nautilus derive macros.
/// * `Vec<IdlTypeDef>` (first): All accounts for the IDL (Nautilus objects).
/// * `Vec<IdlTypeDef>` (second): All types for the IDL (non-Nautilus objects
/// defined in the crate).
pub fn parse_crate_context() -> (Vec<NautilusObject>, Vec<IdlTypeDef>, Vec<IdlTypeDef>) {
let root = std::env::current_dir().unwrap().join("src/lib.rs");
let crate_context = CrateContext::parse(root).expect(
"Failed to detect `src/lib.rs`. Are you sure you've built your program with `--lib` ?",
);
let mut idl_accounts: Vec<IdlTypeDef> = vec![];
let mut idl_types: Vec<IdlTypeDef> = vec![];
let mut nautilus_objects: Vec<NautilusObject> = crate_context
.structs()
.filter_map(|s| {
if let Some(attr) = s.attrs.iter().find(|attr| attr.path.is_ident("derive")) {
if let Ok(Meta::List(meta_list)) = attr.parse_meta() {
let matched_macro =
meta_list
.nested
.iter()
.find_map(|nested_meta| match nested_meta {
NestedMeta::Meta(Meta::Path(path)) => {
if path.is_ident("Table") {
Some(NautilusObjectType::Record)
} else if path.is_ident("State") {
Some(NautilusObjectType::Account)
} else {
None
}
}
_ => None,
});
if let Some(nautilus_ty) = matched_macro {
let nautilus_obj: NautilusObject =
NautilusObject::from_item_struct(s.clone(), nautilus_ty);
let i = &nautilus_obj;
idl_accounts.push(i.into());
return Some(nautilus_obj);
}
}
}
idl_types.push(s.into());
None
})
.collect();
nautilus_objects.extend(source_nautilus_objects());
crate_context.enums().for_each(|e| idl_types.push(e.into()));
(nautilus_objects, idl_accounts, idl_types)
}
/// Parses all required information from a user's defined function.
///
/// All Nautilus objects - both from the source crate itself and the user's
/// crate - are provided as a parameter in order to decipher whether or not a
/// function's parameter is a Nautilus object.
///
/// Consider the return type: (`Ident`, `Vec<(Ident, Type)>`, `Ident`,
/// `Vec<CallContext>`):
/// * `Ident` (first): The identifier of this instruction's variant in the
/// program instruction enum.
/// * `Vec<(Ident, Type)>` (second): The arguments required for this
/// instruction's variant in the program instruction enum.
/// * `Ident` (second): The "call context" of each declared parameter in the
/// user's defined function signature.
/// * `Vec<CallContext>`: The "call context" of each declared parameter in the
/// user's defined function signature.
///
/// You can see these return values are directly used to build a
/// `NautilusEntrypointEnumVariant`.
pub fn parse_function(
nautilus_objects: &Vec<NautilusObject>,
function: ItemFn,
) -> (Ident, Vec<(Ident, Type)>, Ident, Vec<CallContext>) {
let variant_ident = Ident::new(
&function.sig.ident.to_string().to_case(Pascal),
Span::call_site(),
);
let call_ident = function.sig.ident.clone();
let mut variant_args = vec![];
let call_context = function
.sig
.inputs
.into_iter()
.map(|input| match input {
FnArg::Typed(arg) => match *arg.pat {
Pat::Ident(ref pat_ident) => {
let (type_string, is_create, is_signer, is_mut) = parse_type(&arg.ty);
for obj in nautilus_objects {
if obj.ident == &type_string {
let mut nautilus_obj = obj.clone();
nautilus_obj.entry_config = Some(ObjectEntryConfig {
arg_ident: pat_ident.ident.clone(),
is_create,
is_signer,
is_mut,
});
return CallContext::Nautilus(nautilus_obj);
}
}
variant_args.push((pat_ident.ident.clone(), *arg.ty.clone()));
return CallContext::Arg(pat_ident.ident.clone());
}
_ => panic!("Error parsing function."),
},
_ => panic!("Error parsing function."),
})
.collect();
(variant_ident, variant_args, call_ident, call_context)
}
/// Parses the type of a parameter of a user's defined function signature.
pub fn parse_type(ty: &Type) -> (String, bool, bool, bool) {
let mut is_create = false;
let mut is_signer = false;
let mut is_mut = false;
let mut is_pda = false;
let mut child_type = None;
if let Type::Path(TypePath { path, .. }) = &ty {
if let Some(segment) = path.segments.first() {
if segment.ident == "Create" {
is_create = true;
is_signer = true;
is_mut = true;
(child_type, is_pda) = derive_child_type(&segment.arguments)
} else if segment.ident == "Signer" {
is_signer = true;
(child_type, is_pda) = derive_child_type(&segment.arguments)
} else if segment.ident == "Mut" {
is_mut = true;
(child_type, is_pda) = derive_child_type(&segment.arguments)
} else if segment.ident == "Record" || segment.ident == "Account" {
is_pda = true;
(child_type, _) = derive_child_type(&segment.arguments)
}
}
}
is_mut = is_create || is_signer || is_mut;
if is_pda {
is_signer = false;
}
let type_name = if is_create || is_signer || is_mut || is_pda {
if let Some(t) = &child_type {
format!("{}", quote! { #t })
} else {
panic!("Could not parse provided type: {:#?}", ty);
}
} else {
let mut new_t = ty.clone();
remove_lifetimes_from_type(&mut new_t);
format!("{}", quote! { #new_t })
};
(type_name, is_create, is_signer, is_mut)
}
/// Derives the child type of a compound object with angle-bracket generic
/// arguments, ie: `Object<T>`.
fn derive_child_type(arguments: &PathArguments) -> (Option<Type>, bool) {
if let PathArguments::AngleBracketed(args) = arguments {
for arg in &args.args {
if let syn::GenericArgument::Type(ty) = arg {
let mut new_ty = ty.clone();
remove_lifetimes_from_type(&mut new_ty);
if let Type::Path(TypePath { path, .. }) = &new_ty {
if let Some(segment) = path.segments.first() {
if segment.ident == "Record" || segment.ident == "Account" {
return derive_child_type(&segment.arguments);
}
}
}
return (Some(new_ty), false);
}
}
}
(None, false)
}
/// Removes all lifetime specifiers from a `syn::Type`.
///
/// This is not currently used to replace code but to generate a string
/// representation of a type.
fn remove_lifetimes_from_type(t: &mut Type) {
match t {
Type::Path(ref mut tp) => {
if let Some(segment) = tp.path.segments.last_mut() {
if let PathArguments::AngleBracketed(ref mut abga) = segment.arguments {
if abga.args.len() == 1
&& abga
.args
.iter()
.any(|arg| matches!(arg, syn::GenericArgument::Lifetime(_)))
{
segment.arguments = PathArguments::None;
}
}
}
}
Type::Reference(ref mut tr) => {
tr.lifetime = None;
remove_lifetimes_from_type(&mut tr.elem);
}
Type::Paren(ref mut tp) => {
remove_lifetimes_from_type(&mut tp.elem);
}
Type::Tuple(ref mut tt) => {
for elem in &mut tt.elems {
remove_lifetimes_from_type(elem);
}
}
_ => (),
}
}
/// Is the item `use super::*;`
pub fn is_use_super_star(item: &Item) -> bool {
if let Item::Use(use_item) = item {
if let UseTree::Path(use_path) = &use_item.tree {
if let UseTree::Glob(_) = &*use_path.tree {
return use_path.ident == Ident::new("super", use_path.ident.span());
}
}
}
false
}
pub fn type_to_string(ty: &syn::Type) -> Option<String> {
if let syn::Type::Path(type_path) = ty {
if let Some(segment) = type_path.path.segments.last() {
return Some(segment.ident.to_string());
}
}
None
}
| 0
|
solana_public_repos/nautilus-project/nautilus/solana/syn/src
|
solana_public_repos/nautilus-project/nautilus/solana/syn/src/object/default_instructions.rs
|
use syn::{Attribute, NestedMeta};
/// Possible default instructions for records.
#[derive(Clone, Debug)]
pub enum DefaultInstruction {
Create(String),
Delete(String),
Update(String),
}
impl DefaultInstruction {
pub fn parse(nested_meta: &NestedMeta, struct_name: &str) -> syn::Result<Self> {
if let syn::NestedMeta::Meta(syn::Meta::Path(ref path)) = nested_meta {
let variant_string = path.get_ident().unwrap().to_string();
if variant_string.eq("Create") {
return Ok(DefaultInstruction::Create(struct_name.to_string()));
} else if variant_string.eq("Delete") {
return Ok(DefaultInstruction::Delete(struct_name.to_string()));
} else if variant_string.eq("Update") {
return Ok(DefaultInstruction::Update(struct_name.to_string()));
} else {
return Err(syn_error(&format!(
"Unknown default instruction: {}",
variant_string
)));
}
} else {
return Err(syn_error(
"Invalid format for `default_instructions` attribute",
));
}
}
}
pub struct DefaultInstructionParser {
pub instructions: Vec<DefaultInstruction>,
}
impl DefaultInstructionParser {
pub fn parse(attr: &Attribute, struct_name: &str) -> syn::Result<Self> {
let mut instructions: Vec<DefaultInstruction> = vec![];
if let Ok(syn::Meta::List(ref meta_list)) = attr.parse_meta() {
for nested_meta in meta_list.nested.iter() {
instructions.push(DefaultInstruction::parse(nested_meta, struct_name)?)
}
} else {
return Err(syn_error(
"Invalid format for `default_instructions` attribute",
));
};
Ok(DefaultInstructionParser { instructions })
}
}
fn syn_error(msg: &str) -> syn::Error {
syn::Error::new_spanned("default_instructions", msg)
}
| 0
|
solana_public_repos/nautilus-project/nautilus/solana/syn/src
|
solana_public_repos/nautilus-project/nautilus/solana/syn/src/object/source.rs
|
//! Spawns all objects from Nautilus's `src/objects/.` into `syn::ItemStruct`
//! types for `syn` processing.
use syn::{punctuated::Punctuated, Field, FieldsNamed, Ident, ItemStruct};
use super::NautilusObject;
/// Enum vehicle used to build a `syn::Field`.
enum SourceField {
ProgramId,
AccountInfo,
Metadata,
SystemProgram,
TokenProgram,
AssociatedTokenProgram,
TokenMetadataProgram,
}
impl From<&SourceField> for Field {
/// Converts from a `SourceField` to a `syn::Field`.
fn from(value: &SourceField) -> Self {
match value {
SourceField::ProgramId => source_field("program_id"),
SourceField::AccountInfo => source_field("account_info"),
SourceField::Metadata => source_field("metadata"),
SourceField::SystemProgram => source_field("system_program"),
SourceField::TokenProgram => source_field("token_program"),
SourceField::AssociatedTokenProgram => source_field("associated_token_program"),
SourceField::TokenMetadataProgram => source_field("token_metadata_program"),
}
}
}
/// Helper function to build a named `syn::Field` from defaults.
fn source_field(field_name: &str) -> Field {
Field {
attrs: vec![],
vis: syn::Visibility::Inherited,
ident: Some(Ident::new(field_name, proc_macro2::Span::call_site())),
colon_token: Some(Default::default()),
ty: syn::parse_quote!(AccountInfo<'a>),
}
}
/// Helper function to build a named `syn::ItemStruct` from defaults.
fn source_struct(name: &str, source_fields: Vec<SourceField>) -> ItemStruct {
let ident = Ident::new(name, proc_macro2::Span::call_site());
let fields = {
let mut fields = Punctuated::new();
for f in &source_fields {
fields.push(f.into())
}
FieldsNamed {
brace_token: Default::default(),
named: fields,
}
};
ItemStruct {
attrs: vec![],
vis: syn::Visibility::Inherited,
struct_token: Default::default(),
ident,
generics: Default::default(),
fields: syn::Fields::Named(fields),
semi_token: None,
}
}
/// Uses helpers to return a vector of all Nautilus objects from Nautilus's
/// `src/objects/.` as `syn::ItemStruct` types.
pub fn source_nautilus_objects() -> Vec<NautilusObject> {
[
source_struct(
"NautilusIndex",
vec![SourceField::ProgramId, SourceField::AccountInfo],
),
source_struct(
"Wallet",
vec![SourceField::AccountInfo, SourceField::SystemProgram],
),
source_struct(
"Mint",
vec![SourceField::AccountInfo, SourceField::TokenProgram],
),
source_struct(
"Metadata",
vec![SourceField::AccountInfo, SourceField::TokenMetadataProgram],
),
source_struct(
"AssociatedTokenAccount",
vec![
SourceField::AccountInfo,
SourceField::TokenProgram,
SourceField::AssociatedTokenProgram,
],
),
source_struct(
"Token",
vec![
SourceField::AccountInfo,
SourceField::Metadata,
SourceField::TokenProgram,
SourceField::TokenMetadataProgram,
],
),
source_struct(
"Nft",
vec![
SourceField::AccountInfo,
SourceField::Metadata,
SourceField::TokenProgram,
SourceField::TokenMetadataProgram,
],
),
]
.into_iter()
.map(|s| NautilusObject::from_item_struct(s, super::NautilusObjectType::Account))
.collect()
}
/// Returns a vector with just the string names of all objects from Nautilus's
/// `src/objects/.`.
pub fn source_nautilus_names() -> Vec<String> {
vec![
"NautilusIndex".to_string(),
"Wallet".to_string(),
"Mint".to_string(),
"Metadata".to_string(),
"AssociatedTokenAccount".to_string(),
"Token".to_string(),
"Nft".to_string(),
]
}
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.