repo_id stringclasses 563
values | file_path stringlengths 40 166 | content stringlengths 1 2.94M | __index_level_0__ int64 0 0 |
|---|---|---|---|
solana_public_repos/solana-playground/solana-playground/client/src | solana_public_repos/solana-playground/solana-playground/client/src/constants/emoji.ts | export enum Emoji {
CROSS = "β ",
CHECKMARK = "β
",
LOOKING_GLASS = "π ",
CANDY = "π¬ ",
COMPUTER = "π₯ ",
PAPER = "π ",
CONFETTI = "π ",
PAYMENT = "π΅ ",
UPLOAD = "π€ ",
WITHDRAW = "π§ ",
ASSETS = "π ",
LAUNCH = "π ",
COLLECTION = "π¦ ",
ERROR = "π ",
WARNING = "β οΈ ",
SIGNING = "β... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src | solana_public_repos/solana-playground/solana-playground/client/src/constants/index.ts | export * from "./connection";
export * from "./dom";
export * from "./emoji";
export * from "./errors";
export * from "./event";
export * from "./project";
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src | solana_public_repos/solana-playground/solana-playground/client/src/constants/event.ts | export enum EventName {
// Editor
EDITOR_FOCUS = "editorfocus",
EDITOR_FORMAT = "editorformat",
// Modal
MODAL_SET = "modalset",
// Playnet
PLAYNET_ON_DID_INIT = "playnetondidinit",
// Router
ROUTER_NAVIGATE = "routernavigate",
ROUTER_ON_DID_CHANGE_PATH = "routerondidchangepath",
// Terminal
... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/providers | solana_public_repos/solana-playground/solana-playground/client/src/providers/solana/index.ts | export { SolanaProvider } from "./SolanaProvider";
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src/providers | solana_public_repos/solana-playground/solana-playground/client/src/providers/solana/SolanaProvider.tsx | import { FC, useEffect, useMemo } from "react";
import { useWallet, WalletProvider } from "@solana/wallet-adapter-react";
import { PgWallet } from "../../utils/pg";
export const SolanaProvider: FC = ({ children }) => {
const wallets = useMemo(() => [], []);
return (
<WalletProvider wallets={wallets}>
<... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/providers | solana_public_repos/solana-playground/solana-playground/client/src/providers/theme/ThemeProvider.tsx | import { FC, useEffect, useState } from "react";
import styled, {
css,
ThemeProvider as StyledThemeProvider,
} from "styled-components";
import { FONTS, THEMES } from "../../theme";
import { Font, PgTheme, ThemeReady } from "../../utils/pg/theme";
import { EventName } from "../../constants/event";
import { useSetS... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/providers | solana_public_repos/solana-playground/solana-playground/client/src/providers/theme/index.ts | export { ThemeProvider } from "./ThemeProvider";
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils | solana_public_repos/solana-playground/solana-playground/client/src/utils/bpf-upgradeable-browser/instruction.ts | import { Buffer } from "buffer";
import * as BufferLayout from "@solana/buffer-layout";
import * as Layout from "./layout";
/**
* @internal
*/
export type InstructionType = {
/** The Instruction index (from solana upstream program) */
index: number;
/** The BufferLayout to use to build data */
layout: Buffe... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils | solana_public_repos/solana-playground/solana-playground/client/src/utils/bpf-upgradeable-browser/layout.ts | import { Buffer } from "buffer";
import * as BufferLayout from "@solana/buffer-layout";
/**
* Layout for a Rust Vec<u8> type
*/
export const rustVecBytes = (property: string = "string") => {
const rvbl = BufferLayout.struct<any>(
[
BufferLayout.u32("length"),
BufferLayout.u32("lengthPadding"),
... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils | solana_public_repos/solana-playground/solana-playground/client/src/utils/bpf-upgradeable-browser/index.ts | export * from "./bpf-upgradeable-browser";
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils | solana_public_repos/solana-playground/solana-playground/client/src/utils/bpf-upgradeable-browser/bpf-upgradeable-browser.ts | // Thanks to @fanatid
import { Buffer } from "buffer";
import * as BufferLayout from "@solana/buffer-layout";
import {
PACKET_DATA_SIZE,
PublicKey,
SYSVAR_CLOCK_PUBKEY,
SYSVAR_RENT_PUBKEY,
SystemProgram,
Transaction,
TransactionInstruction,
Signer,
} from "@solana/web3.js";
import { encodeData, Instru... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/block-explorer.ts | import { PgConnection } from "./connection";
import { createDerivable, declareDerivable, derivable } from "./decorators";
import { PgSettings } from "./settings";
interface BlockExplorerImpl {
/** Name of the block explorer */
name: string;
/** Base URL of the explorer website */
url: string;
/**
* Get th... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/program-info.ts | import { decodeIdlAccount, idlAddress } from "@coral-xyz/anchor/dist/cjs/idl";
import type { Idl } from "@coral-xyz/anchor";
import { PgBytes } from "./bytes";
import { PgCommand } from "./command";
import { PgConnection } from "./connection";
import {
createDerivable,
declareDerivable,
declareUpdatable,
deriv... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/bytes.ts | import { utils } from "@coral-xyz/anchor";
export class PgBytes {
/** Convert the given hex string to `Buffer`. */
static fromHex(str: string) {
return utils.bytes.hex.decode(str);
}
/** Convert the given buffer to hex string. */
static toHex(buf: Buffer) {
return utils.bytes.hex.encode(buf);
}
... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/editor.ts | import { EventName } from "../../constants";
import { PgCommon } from "./common";
export class PgEditor {
/** Focus the editor. */
static focus() {
PgCommon.createAndDispatchCustomEvent(EventName.EDITOR_FOCUS);
}
}
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/github.ts | import { PgCommon } from "./common";
import { PgExplorer, TupleFiles } from "./explorer";
import { PgFramework } from "./framework";
import { PgLanguage } from "./language";
import { GithubError } from "../../constants";
import type { Arrayable } from "./types";
type GithubRepositoryData = {
name: string;
path: st... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/router.ts | import { PgCommon } from "./common";
import { EventName } from "../../constants";
import type { Disposable, OrString, SyncOrAsync } from "./types";
/** Opening delimiter for path variables */
const OPEN = "{";
/** Closing delimiter for path variables */
const CLOSE = "}";
/** Custom route */
type Route<P extends str... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/settings.ts | // Settings are getting loaded at the start of the application, so any non-type
// import should be avoided.
import { Endpoint } from "../../constants";
import { declareUpdatable, migratable, updatable } from "./decorators";
import type { OrString } from "./types";
interface Settings {
/** Connection settings */
... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/language.ts | import { PgCommon } from "./common";
import type { Arrayable } from "./types";
/** Programing language implementation */
type LanguageImpl<N extends string> = {
/** Language name */
name: N;
/** Valid file extension(s) for the language */
extension: Arrayable<Extension>;
};
/** Programming language */
type La... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/share.ts | import { PgCommon } from "./common";
import { ExplorerFiles, PgExplorer } from "./explorer";
import { PgServer } from "./server";
export class PgShare {
/**
* Get the shared project files from the given path.
*
* @param id shared project id
* @returns shared project files
*/
static async get(id: str... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/common.ts | import type { ChangeEvent } from "react";
import { Endpoint, EventName } from "../../constants";
import type {
AllPartial,
Disposable,
Promisable,
SyncOrAsync,
Arrayable,
OrString,
ValueOf,
} from "./types";
export class PgCommon {
/**
* @param ms amount of time to sleep in ms
* @returns a promi... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/view.ts | import type { FC, ReactNode } from "react";
import type { ToastOptions } from "react-toastify";
import { PgCommon } from "./common";
import { EventName } from "../../constants";
import type {
SetState,
SetElementAsync,
Disposable,
CallableJSX,
RequiredKey,
} from "./types";
/** Sidebar page param */
export ... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/web3.ts | export * as PgWeb3 from "@solana/web3.js";
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/connection.ts | import { PgCommon } from "./common";
import { createDerivable, declareDerivable, derivable } from "./decorators";
import { OverridableConnection, PgPlaynet } from "./playnet";
import { PgSettings } from "./settings";
import { PgWeb3 } from "./web3";
/** Optional `connection` prop */
export interface ConnectionOption {... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/types.ts | /** Get value of the given object */
export type ValueOf<T extends object> = T[keyof T];
/** Methods of the given object */
export type Methods<T> = {
[U in keyof T]?: T[U] extends (...args: any[]) => any ? Parameters<T[U]> : [];
};
/** Convert the return types of the methods of the object to `Promise` */
export ty... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/framework.ts | import { PgCommon } from "./common";
import { PgExplorer, TupleFiles } from "./explorer";
import type { RequiredKey, SyncOrAsync } from "./types";
/** Custom framework parameter */
export type FrameworkImpl<N extends string> = {
/** Framework name */
name: N;
/** Framework program language */
language: Langua... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/global.ts | import { declareUpdatable, updatable } from "./decorators";
interface GlobalState {
buildLoading: boolean;
deployState: "ready" | "loading" | "paused" | "cancelled";
}
const defaultState: GlobalState = {
buildLoading: false,
deployState: "ready",
};
/** Nothing to persist. */
const storage = {
read() {
... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/index.ts | export * from "./block-explorer";
export * from "./bytes";
export * from "./client/";
export * from "./common";
export * from "./command";
export * from "./connection";
export * from "./editor";
export * from "./explorer/";
export * from "./framework";
export * from "./github";
export * from "./global";
export * from "... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/command.ts | import { PgCommon } from "./common";
import { PgTerminal } from "./terminal";
import type {
Arrayable,
Disposable,
Getable,
SyncOrAsync,
ValueOf,
} from "./types";
/** Terminal command implementation */
export type CommandImpl<
N extends string,
A extends Arg[],
O extends Option[],
S,
R
> = {
/**... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/server.ts | import type { Idl } from "@coral-xyz/anchor";
import type { TupleFiles } from "./explorer";
/** Rust `Option` type */
type Option<T> = T | null | undefined;
/** `/build` request */
interface BuildRequest {
/** Program files */
files: TupleFiles;
/** UUID of the program */
uuid?: Option<string>;
/** Build f... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/package.ts | import { PgCommon } from "./common";
import { PgTerminal } from "./terminal";
import { GITHUB_URL } from "../../constants";
/** Mapped import results */
interface ImportResult {
"anchor-cli": typeof import("@solana-playground/anchor-cli");
playnet: typeof import("@solana-playground/playnet");
rustfmt: typeof imp... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/program-interaction/account.ts | import { getAnchorProgram } from "./program";
import { PgCommon } from "../common";
import type { PgWeb3 } from "../web3";
/**
* Fetch the given on-chain account.
*
* @param accountName name of the account
* @param address public key of the account
* @returns the account
*/
export const fetchAccount = async (
... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/program-interaction/program-interaction.ts | import { fetchAccount, fetchAllAccounts } from "./account";
import {
GeneratableInstruction,
createGenerator,
generateValue,
generateProgramAddressFromSeeds,
} from "./generator";
import { getPrograms, getOrInitPythAccounts } from "./generators";
import { getIdlType, IdlInstruction } from "./idl-types";
import ... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/program-interaction/instruction.ts | import { getPrograms } from "./generators";
import { getIdlType, Idl, IdlAccount, IdlInstruction } from "./idl-types";
import { PgWeb3 } from "../web3";
import type {
GeneratableInstruction,
InstructionValueGenerator,
} from "./generator";
import type { OrString } from "../types";
/**
* Create a generatable instr... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/program-interaction/program.ts | import { AnchorProvider, Program } from "@coral-xyz/anchor";
import { PgCommon } from "../common";
import { PgConnection } from "../connection";
import { PgProgramInfo } from "../program-info";
import { PgWallet } from "../wallet";
/**
* Create an Anchor program instance.
*
* @param params optional overrides of th... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/program-interaction/storage.ts | import { PgCommon } from "../common";
import type { GeneratableInstruction } from "./generator";
import type { IdlAccount, IdlInstruction } from "./idl-types";
/**
* Get the instruction from the configured {@link storage}.
*
* @param idlIx IDL instruction
* @returns the saved instruction or `null`
*/
export const... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/program-interaction/generator.ts | import { IdlType, getIdlType } from "./idl-types";
import { getPrograms, getPythAccounts } from "./generators";
import { PgProgramInfo } from "../program-info";
import { PgWallet } from "../wallet";
import { PgWeb3 } from "../web3";
/**
* Generatable instruction, i.e. the values of the instruction can be derived
* f... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/program-interaction/index.ts | export { PgProgramInteraction } from "./program-interaction";
export type { Idl, IdlInstruction, IdlType } from "./idl-types";
export type {
GeneratableInstruction,
InstructionValueGenerator,
Seed,
} from "./generator";
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/program-interaction/idl-types.ts | import { BN, DecodeType } from "@coral-xyz/anchor";
import type {
Idl,
IdlEnumFieldsNamed,
IdlEnumFieldsTuple,
IdlEnumVariant,
IdlType,
} from "@coral-xyz/anchor/dist/cjs/idl";
import { PgCommon } from "../common";
import { PgWeb3 } from "../web3";
import type { MergeUnion, OrString } from "../types";
expor... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/program-interaction | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/program-interaction/generators/pyth.ts | import { PgCommon } from "../../common";
import { Cluster, PgConnection } from "../../connection";
/** Pyth feed accounts per cluster */
const PYTH_ACCOUNTS: {
/** Map of feed account name -> public key */
[K in Cluster]?: { [name: string]: string };
} = {};
/**
* Get or initialize Pyth feed accounts for the cur... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/program-interaction | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/program-interaction/generators/program.ts | import {
ASSOCIATED_PROGRAM_ID,
TOKEN_PROGRAM_ID,
} from "@coral-xyz/anchor/dist/cjs/utils/token";
import { PgCommon } from "../../common";
import { PgProgramInfo } from "../../program-info";
import { PgWeb3 } from "../../web3";
import type { Arrayable } from "../../types";
/** Program data */
interface Program {... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/program-interaction | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/program-interaction/generators/index.ts | export { getPrograms } from "./program";
export { getOrInitPythAccounts, getPythAccounts } from "./pyth";
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/tutorial/storage.ts | import { PgExplorer } from "../explorer";
import type { ValueOf } from "../types";
/** A map of string to unknown data as used for tutorial storage data */
type Data = Record<string, unknown>;
/**
* Get the current tutorial's storage object that is useful for persisting user
* data in the current tutorial.
*
* Th... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/tutorial/details.ts | export const TUTORIAL_LEVELS = [
"Beginner",
"Intermediate",
"Advanced",
] as const;
export const TUTORIAL_CATEGORIES = [
"Compression",
"DeFi",
"Gaming",
"Governance",
"Lending",
"Multisig",
"NFT",
"Payment",
"Stablecoin",
"SPL",
"Staking",
"Token",
"Trading",
] as const;
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/tutorial/types.ts | import type { ComponentType } from "react";
import { TUTORIAL_CATEGORIES, TUTORIAL_LEVELS } from "./details";
import type { Nullable, RequiredKey } from "../types";
type Author = {
/** Author's name that will be displayed as one of the creators of the tutorial */
name: string;
/** Optional link to the author's ... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/tutorial/index.ts | export * from "./details";
export { PgTutorial } from "./tutorial";
export { getTutorialStorage } from "./storage";
export * from "./types";
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/tutorial/tutorial.ts | import { PgCommon } from "../common";
import { PgExplorer, TupleFiles } from "../explorer";
import { PgRouter } from "../router";
import { PgView } from "../view";
import { declareUpdatable, updatable } from "../decorators";
import type {
SerializedTutorialState,
TutorialData,
TutorialMetadata,
TutorialState,
}... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/playnet/utils.ts | import type { WasmAccount } from "@solana-playground/playnet";
import { PgCommon } from "../common";
import { PgWeb3 } from "../web3";
export class PgPlaynetUtils {
/**
* Convert WASM account to `web3.js.AccountInfo`
*
* @param wasmAccount the account object that wasm-bindgen created
* @returns `web3.js... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/playnet/rpc.ts | import type { PgRpc, TransactionStatus } from "@solana-playground/playnet";
import { PgSerde } from "./serde";
import { PgPlaynetUtils } from "./utils";
import { PgBytes } from "../bytes";
import { PgCommon } from "../common";
import { PgConnection } from "../connection";
import { PgSettings } from "../settings";
impo... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/playnet/types.ts | import type { PgWeb3 } from "../web3";
/** Playnet RPC request */
export interface RpcRequest {
jsonrpc: string;
method: keyof PgWeb3.Connection;
params: any[];
id: string;
}
/** Playnet RPC response */
export type RpcResponse<K extends keyof PgWeb3.Connection> = {
jsonrpc: string;
result: PgWeb3.Connecti... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/playnet/serde.ts | import { PgBytes } from "../bytes";
import { PgWeb3 } from "../web3";
export class PgSerde {
/**
* Serialize the base64 transaction string to make it compatible for Serde
* to deserialize it from WASM.
*
* @param txBase64 base64 encoded transaction string
* @returns Rust Serde serialized transaction s... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/playnet/index.ts | export { PgPlaynet } from "./playnet";
export * from "./types";
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/playnet/playnet.ts | import { PgPlaynetRpc } from "./rpc";
import { PgCommon } from "../common";
import { PgExplorer } from "../explorer";
import { PgPackage } from "../package";
import { EventName } from "../../../constants";
import type { OverridableConnection } from "./types";
export class PgPlaynet {
/** Overridable Playnet connecti... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/decorators/derivable.ts | import {
addInit,
addOnDidChange,
getChangePropName,
INTERNAL_STATE_PROPERTY,
} from "./common";
import { PgCommon } from "../common";
import type {
Initialize,
OnDidChangeDefault,
OnDidChangeProperty,
} from "./types";
import type { Disposable } from "../types";
/**
* Make the given static class deriva... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/decorators/common.ts | import { PgCommon } from "../common";
import type { OnDidChangeDefault } from "./types";
import type { Arrayable, Disposable, SyncOrAsync } from "../types";
/** Private state property */
export const INTERNAL_STATE_PROPERTY = "_state";
/** The property name for keeping track of whether the class has been initialized ... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/decorators/types.ts | import type { ON_DID_CHANGE } from "./common";
import type { Disposable, SyncOrAsync } from "../types";
/** `init` prop */
export type Initialize = {
/** Initializer that returns a disposable */
init(): SyncOrAsync<Disposable>;
};
/** Default `onDidChange` type */
export type OnDidChangeDefault<T> = {
/**
* ... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/decorators/index.ts | export * from "./derivable";
export * from "./migratable";
export * from "./updatable";
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/decorators/updatable.ts | import { PgCommon } from "../common";
import {
addInit,
addOnDidChange,
INTERNAL_STATE_PROPERTY,
IS_INITIALIZED_PROPERTY,
ON_DID_CHANGE,
} from "./common";
import type {
Initialize,
OnDidChangeDefault,
OnDidChangeProperty,
} from "./types";
import type { Disposable, SyncOrAsync } from "../types";
/** U... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/decorators/migratable.ts | import type { SyncOrAsync } from "../types";
/**
* Run the given `migrate` function as soon as the static class module has been
* imported.
*
* Migration is useful for making changes to how the data is stored.
*/
export function migratable(migrate: () => SyncOrAsync<void>) {
migrate();
return (_sClass: any) =... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/terminal/history.ts | /** Manage terminal history */
export class PgHistory {
/** Maximum allowed size */
private _size: number;
/** Cursor index */
private _cursor = 0;
/** All history entries */
private _entries: string[] = [];
constructor(size: number) {
this._size = size;
}
/** Get all entries. */
getEntries() ... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/terminal/autocomplete.ts | import { getIsOption, hasTrailingWhitespace, parse } from "./utils";
import { PgCommon } from "../common";
import type { Getable } from "../types";
/** Autocomplete handler input type */
type AutocompleteHandler =
| AutocompleteHandlerCallback
| AutocompleteHandlerObject
| AutocompleteHandlerArray;
/** Callback... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/terminal/utils.ts | /**
* Parse the given input to tokens.
*
* @param input command input
* @returns the parsed tokens
*/
export const parse = (input: string) => {
const tokens = [];
let currentTokenIndex = 0;
let isInQuotes = false;
for (const char of input) {
switch (char) {
case '"':
case "'":
isInQ... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/terminal/types.ts | /** Tty print options */
export interface PrintOptions {
/** Whether the command is sync */
sync?: boolean;
/** Whether to append a new line */
newLine?: boolean;
/** Disable automatic coloring */
noColor?: boolean;
}
/** Manage terminal commands */
export type CommandManager<R = unknown> = {
/** Get the... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/terminal/shell.ts | import { PgAutocomplete } from "./autocomplete";
import { PgHistory } from "./history";
import { PgTty } from "./tty";
import {
closestLeftBoundary,
closestRightBoundary,
hasTrailingWhitespace,
isIncompleteInput,
parse,
} from "./utils";
import { PgTerminal } from "./terminal";
import { PgCommon } from "../co... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/terminal/terminal.ts | import { ITerminalOptions, Terminal as XTerm } from "xterm";
import { FitAddon } from "xterm-addon-fit";
import { WebLinksAddon } from "xterm-addon-web-links";
import { format } from "util";
import { PgAutocomplete } from "./autocomplete";
import { PgHistory } from "./history";
import { PgShell } from "./shell";
impor... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/terminal/index.ts | export * from "./terminal";
export type { CommandManager } from "./types";
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/terminal/tty.ts | import { Terminal as XTerm } from "xterm";
import { PgAutocomplete } from "./autocomplete";
import { PgTerminal } from "./terminal";
import { getLastToken } from "./utils";
import { PgCommon } from "../common";
import type {
ActiveCharPrompt,
ActivePrompt,
CommandManager,
PrintOptions,
} from "./types";
/**
... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/explorer/workspace.ts | import { WorkspaceError } from "../../../constants";
import { PgCommon } from "../common";
interface Workspaces {
/** All workspace names */
allNames: string[];
/** Current workspace name */
currentName?: string;
}
/**
* Workspace functionality class that only exists in the memory state
*
* This class does... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/explorer/fs.ts | import FS from "@isomorphic-git/lightning-fs";
import { PgExplorer } from "./explorer";
export class PgFs {
/** Async `indexedDB` based file system instance */
private static _fs = new FS("solana-playground").promises;
/**
* Write a file.
*
* @param path file path
* @param data file content
* @p... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/explorer/explorer.ts | import { PgExplorerEvent } from "./events";
import { PgFs } from "./fs";
import { PgWorkspace } from "./workspace";
import { PgCommon } from "../common";
import { PgLanguage } from "../language";
import { ClassName, Id, ItemError, WorkspaceError } from "../../../constants";
import type {
Explorer,
TupleFiles,
Fol... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/explorer/types.ts | import type { TupleString } from "../types";
/** Playground explorer */
export interface Explorer {
/** Explorer files */
files: ExplorerFiles;
/** Full path of the files in tabs */
tabs: string[];
/** Current file index(in tabs) */
currentIndex: number;
}
/** Full path -> `ItemInfo` */
export type Explor... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/explorer/events.ts | import { PgCommon } from "../common";
import type { FullFile } from "./types";
export class PgExplorerEvent {
/** `onDidCreateItem` event name */
static readonly ON_DID_INIT = "explorerondidinit";
/** `onDidCreateItem` event name */
static readonly ON_DID_CREATE_ITEM = "explorerondidcreateitem";
/** `onDidR... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/explorer/index.ts | export * from "./explorer";
export * from "./types";
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/tx/tx.ts | import { ExplorerLink } from "./ExplorerLink";
import { PgCommon } from "../common";
import { PgPlaynet } from "../playnet";
import { PgSettings } from "../settings";
import { PgView } from "../view";
import { ConnectionOption, PgConnection } from "../connection";
import { CurrentWallet, PgWallet, WalletOption } from "... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/tx/ExplorerLink.tsx | import { FC } from "react";
import styled from "styled-components";
import Link from "../../../components/Link";
import { useBlockExplorer } from "../../../hooks";
interface ExplorerLinkProps {
txHash: string;
}
export const ExplorerLink: FC<ExplorerLinkProps> = ({ txHash }) => {
const blockExplorer = useBlockEx... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/tx/index.ts | export * from "./tx";
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/theme/interface.ts | import { StandardProperties } from "csstype";
import { ITerminalOptions as XtermOptions } from "xterm";
import { ButtonKind } from "../../../components/Button";
import { MenuKind } from "../../../components/Menu";
import { TextKind } from "../../../components/Text";
import { AllRequired, ChildRequired, NestedRequired ... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/theme/index.ts | export { PgTheme } from "./theme";
export * from "./interface";
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/theme/theme.ts | import type { StandardProperties } from "csstype";
import { PgCommon } from "../common";
import { EventName } from "../../../constants";
import type {
DefaultComponent,
ImportableTheme,
Font,
ThemeInternal,
ThemeReady,
ThemeColor,
Highlight,
} from "./interface";
import type { ValueOf } from "../types";
... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/wallet/wallet.ts | import * as ed25519 from "@noble/ed25519";
import { PgCommon } from "../common";
import {
createDerivable,
declareDerivable,
declareUpdatable,
derivable,
migratable,
updatable,
} from "../decorators";
import { PgWeb3 } from "../web3";
import type {
AnyTransaction,
CurrentWallet,
SerializedWallet,
S... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/wallet/types.ts | import type {
Adapter,
MessageSignerWalletAdapterProps,
SignerWalletAdapterProps,
WalletAdapter,
WalletAdapterProps,
} from "@solana/wallet-adapter-base";
import type { Wallet as SolanaWallet } from "@solana/wallet-adapter-react";
import type { PgWeb3 } from "../web3";
/** Wallet state */
export interface W... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/wallet/index.ts | export { PgWallet } from "./wallet";
export * from "./types";
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/client/client.ts | import { ScriptTarget, transpile } from "typescript";
import * as mocha from "mocha";
import * as util from "util";
import * as anchor from "@coral-xyz/anchor";
import { ClientPackageName, PgClientPackage } from "./package";
import { PgCommon } from "../common";
import { PgConnection } from "../connection";
import { P... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/client/client-importer.ts | import { PgTerminal } from "../terminal";
export class PgClientImporter {
/**
* Redefine `console.log` to show mocha logs in the terminal and asynchronously
* import `PgClient`.
*/
static async import() {
if (!this._isOverridden) {
// Override the `console.log` before the initial `PgClient` impo... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/utils/pg | solana_public_repos/solana-playground/solana-playground/client/src/utils/pg/client/index.ts | export { PgClientImporter } from "./client-importer";
export type { ClientPackageName } from "./package";
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src | solana_public_repos/solana-playground/solana-playground/client/src/languages/rust.ts | import { PgLanguage } from "../utils/pg";
export const rust = PgLanguage.create({
name: "Rust",
extension: "rs",
});
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src | solana_public_repos/solana-playground/solana-playground/client/src/languages/json.ts | import { PgLanguage } from "../utils/pg";
export const json = PgLanguage.create({
name: "JSON",
extension: "json",
});
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src | solana_public_repos/solana-playground/solana-playground/client/src/languages/languages.ts | export * from "./javascript";
export * from "./json";
export * from "./python";
export * from "./rust";
export * from "./typescript";
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src | solana_public_repos/solana-playground/solana-playground/client/src/languages/javascript.ts | import { PgLanguage } from "../utils/pg";
export const javascript = PgLanguage.create({
name: "JavaScript",
extension: "js",
});
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src | solana_public_repos/solana-playground/solana-playground/client/src/languages/python.ts | import { PgLanguage } from "../utils/pg";
export const python = PgLanguage.create({
name: "Python",
extension: "py",
});
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src | solana_public_repos/solana-playground/solana-playground/client/src/languages/typescript.ts | import { PgLanguage } from "../utils/pg";
export const typescript = PgLanguage.create({
name: "TypeScript",
extension: "ts",
});
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src | solana_public_repos/solana-playground/solana-playground/client/src/languages/index.ts | import * as _LANGUAGES from "./languages";
/** All programming languages */
export const LANGUAGES = Object.values(_LANGUAGES);
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src/components | solana_public_repos/solana-playground/solana-playground/client/src/components/SearchBar/SearchBar.tsx | import {
Dispatch,
FC,
ReactNode,
SetStateAction,
useEffect,
useRef,
useState,
} from "react";
import styled, { css } from "styled-components";
import Button from "../Button";
import Input, { InputProps } from "../Input";
import { Close, PointedArrow, Search } from "../Icons";
import { SpinnerWithBg } fr... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/components | solana_public_repos/solana-playground/solana-playground/client/src/components/SearchBar/index.ts | export { default } from "./SearchBar";
export type {
DropdownProps as SearchBarDropdownProps,
NormalizedItem as SearchBarItem,
SearchBarProps,
} from "./SearchBar";
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src/components | solana_public_repos/solana-playground/solana-playground/client/src/components/Tabs/Tabs.tsx | import { SetStateAction, useCallback } from "react";
import styled, { css } from "styled-components";
import Tab from "./Tab";
import Button from "../Button";
import Dnd from "../Dnd";
import Img from "../Img";
import { Id } from "../../constants";
import { PgExplorer, PgTheme, PgWallet } from "../../utils/pg";
import... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/components | solana_public_repos/solana-playground/solana-playground/client/src/components/Tabs/Tab.tsx | import {
ComponentPropsWithoutRef,
forwardRef,
MouseEvent,
useCallback,
useMemo,
useRef,
useState,
} from "react";
import styled, { css } from "styled-components";
import Button from "../Button";
import LangIcon from "../LangIcon";
import Menu from "../Menu";
import { Close } from "../Icons";
import { Pg... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/components | solana_public_repos/solana-playground/solana-playground/client/src/components/Tabs/index.ts | export { Tabs } from "./Tabs";
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src/components | solana_public_repos/solana-playground/solana-playground/client/src/components/CopyButton/CopyButton.tsx | import { FC } from "react";
import styled, { css } from "styled-components";
import Button from "../Button";
import Tooltip from "../Tooltip";
import { Copy } from "../Icons";
import { useCopy } from "../../hooks";
interface CopyButtonProps {
copyText: string;
}
const CopyButton: FC<CopyButtonProps> = ({ copyText ... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/components | solana_public_repos/solana-playground/solana-playground/client/src/components/CopyButton/index.ts | export { default } from "./CopyButton";
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src/components | solana_public_repos/solana-playground/solana-playground/client/src/components/Tooltip/Tooltip.tsx | import { FC, ReactNode } from "react";
import styled, { css } from "styled-components";
import Popover, { PopoverProps } from "../Popover";
import { QuestionMarkOutlined } from "../Icons";
import { PgTheme } from "../../utils/pg";
export type TooltipProps = Omit<PopoverProps, "showOnHover" | "popEl"> & {
/** Toolti... | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.