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/commands/sugar/commands
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/commands/reveal/reveal.ts
import { getCmCreatorMetadataAccounts, getMetaplex, loadCache, loadConfigData, } from "../../utils"; import { Emoji } from "../../../../constants"; import { PgTerminal, PgWeb3 } from "../../../../utils/pg"; export const processReveal = async (rpcUrl: string | undefined) => { const term = await PgTerminal.get...
0
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/commands
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/commands/reveal/index.ts
export * from "./reveal";
0
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/commands
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/commands/show/index.ts
export * from "./show";
0
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/commands
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/commands/show/show.ts
import { Creator } from "@metaplex-foundation/js"; import { NULL_STRING } from "../../constants"; import { getMetaplex, loadCache, printWithStyle } from "../../utils"; import { Emoji } from "../../../../constants"; import { PgCommon, PgTerminal, PgWeb3 } from "../../../../utils/pg"; export const processShow = async (...
0
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/commands
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/commands/guard/remove.ts
import { getMetaplex, loadCache } from "../../utils"; import { Emoji } from "../../../../constants"; import { PgTerminal, PgWeb3 } from "../../../../utils/pg"; export const processGuardRemove = async ( rpcUrl: string | undefined, candyMachine: string | undefined, candyGuard: string | undefined ) => { const ter...
0
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/commands
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/commands/guard/index.ts
export * from "./add"; export * from "./remove"; export * from "./show"; export * from "./update"; export * from "./withdraw";
0
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/commands
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/commands/guard/add.ts
import { CandyCache, getMetaplex, loadCache, loadConfigData, } from "../../utils"; import { Emoji } from "../../../../constants"; import { PgTerminal, PgWeb3 } from "../../../../utils/pg"; export const processGuardAdd = async ( rpcUrl: string | undefined, candyMachine: string | undefined, candyGuard: str...
0
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/commands
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/commands/guard/withdraw.ts
import { getMetaplex, loadCache, loadConfigData } from "../../utils"; import { Emoji } from "../../../../constants"; import { PgTerminal, PgWeb3 } from "../../../../utils/pg"; export const processGuardWithdraw = async ( rpcUrl: string | undefined, candyGuard: string | undefined ) => { const term = await PgTermin...
0
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/commands
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/commands/guard/show.ts
import { DefaultCandyGuardSettings } from "@metaplex-foundation/js"; import { getMetaplex, loadCache, printWithStyle } from "../../utils"; import { Emoji } from "../../../../constants"; import { PgCommon, PgTerminal, PgWeb3 } from "../../../../utils/pg"; export const processGuardShow = async ( rpcUrl: string | unde...
0
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/commands
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/commands/guard/update.ts
import { getMetaplex, loadCache, loadConfigData } from "../../utils"; import { Emoji } from "../../../../constants"; import { PgTerminal, PgWeb3 } from "../../../../utils/pg"; export const processGuardUpdate = async ( rpcUrl: string | undefined, candyGuard: string | undefined ) => { const term = await PgTerminal...
0
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/commands
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/commands/withdraw/index.ts
export * from "./withdraw";
0
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/commands
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/commands/withdraw/withdraw.ts
import { Metaplex } from "@metaplex-foundation/js"; import { getMetaplex } from "../../utils"; import { Emoji } from "../../../../constants"; import { PgCommon, PgTerminal, PgWeb3 } from "../../../../utils/pg"; export const processWithdraw = async ( candyMachine: string | undefined, rpcUrl: string | undefined, ...
0
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/commands
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/commands/sign/sign.ts
import { Metaplex } from "@metaplex-foundation/js"; import { getCmCreatorMetadataAccounts, getMetaplex, loadCache, } from "../../utils"; import { Emoji } from "../../../../constants"; import { PgTerminal, PgWeb3 } from "../../../../utils/pg"; export const processSign = async ( rpcUrl: string | undefined, mi...
0
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/commands
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/commands/sign/index.ts
export * from "./sign";
0
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/commands
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/commands/upload/assets.ts
import { JsonMetadata } from "@metaplex-foundation/js"; import { SugarUploadScreen } from "./SugarUploadScreen"; import { CacheItem } from "../../utils"; import { PgBytes, PgCommon, PgView } from "../../../../utils/pg"; class AssetPair { name: string; metadata: string; metadata_hash: string; image: string; ...
0
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/commands
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/commands/upload/index.ts
export { SugarUploadScreen } from "./SugarUploadScreen"; export * from "./upload";
0
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/commands
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/commands/upload/upload.ts
import { BundlrStorageDriver, JsonMetadata, sol, toMetaplexFileFromBrowser, UploadMetadataInput, } from "@metaplex-foundation/js"; import { getAssetPairs } from "./assets"; import { loadConfigData, getMetaplex, loadCache } from "../../utils"; import { Emoji } from "../../../../constants"; import { PgCommon, ...
0
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/commands
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/commands/upload/SugarUploadScreen.tsx
import { FC, useCallback, useState } from "react"; import Modal from "../../../../components/Modal"; import UploadArea from "../../../../components/UploadArea"; import { PgCommon } from "../../../../utils/pg"; interface SugarUploadScreenProps { title: string; } export const SugarUploadScreen: FC<SugarUploadScreenP...
0
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/commands
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/commands/bundlr/bundlr.ts
import Bundlr from "@bundlr-network/client"; import { BundlrEnpoints } from "../../constants"; import { Emoji } from "../../../../constants"; import { PgConnection, PgSettings, PgTerminal, PgWallet, PgWeb3, } from "../../../../utils/pg"; enum BundlrAction { Balance = 0, Withraw = 1, } // The minimum am...
0
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/commands
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/commands/bundlr/index.ts
export * from "./bundlr";
0
solana_public_repos/solana-playground/solana-playground/client/src/commands
solana_public_repos/solana-playground/solana-playground/client/src/commands/prettier/prettier.ts
import { EventName } from "../../constants"; import { PgCommon } from "../../utils/pg"; import { createCmd } from "../create"; export const prettier = createCmd({ name: "prettier", description: "Format the current file with prettier", run: async () => { await PgCommon.sendAndReceiveCustomEvent(EventName.EDIT...
0
solana_public_repos/solana-playground/solana-playground/client/src/commands
solana_public_repos/solana-playground/solana-playground/client/src/commands/prettier/index.ts
export { prettier } from "./prettier";
0
solana_public_repos/solana-playground/solana-playground/client/src/commands
solana_public_repos/solana-playground/solana-playground/client/src/commands/deploy/index.ts
export { deploy } from "./deploy";
0
solana_public_repos/solana-playground/solana-playground/client/src/commands
solana_public_repos/solana-playground/solana-playground/client/src/commands/deploy/deploy.ts
import { BpfLoaderUpgradeable } from "../../utils/bpf-upgradeable-browser"; import { PgCommand, PgCommon, PgConnection, PgGlobal, PgProgramInfo, PgServer, PgTerminal, PgTx, PgWallet, PgWeb3, } from "../../utils/pg"; import { createCmd } from "../create"; export const deploy = createCmd({ name: "d...
0
solana_public_repos/solana-playground/solana-playground/client/src/commands
solana_public_repos/solana-playground/solana-playground/client/src/commands/spl-token/spl-token.ts
import { PgPackage } from "../../utils/pg"; import { createCmd } from "../create"; import { isPgConnected } from "../validation"; export const splToken = createCmd({ name: "spl-token", description: "Commands for interacting with SPL Tokens", run: async (input) => { const { runSplToken } = await PgPackage.imp...
0
solana_public_repos/solana-playground/solana-playground/client/src/commands
solana_public_repos/solana-playground/solana-playground/client/src/commands/spl-token/index.ts
export { splToken } from "./spl-token";
0
solana_public_repos/solana-playground/solana-playground/client/src/commands
solana_public_repos/solana-playground/solana-playground/client/src/commands/solana/solana.ts
import { PgPackage } from "../../utils/pg"; import { createCmd } from "../create"; import { isPgConnected } from "../validation"; export const solana = createCmd({ name: "solana", description: "Commands for interacting with Solana", run: async (input) => { const { runSolana } = await PgPackage.import("solana...
0
solana_public_repos/solana-playground/solana-playground/client/src/commands
solana_public_repos/solana-playground/solana-playground/client/src/commands/solana/index.ts
export { solana } from "./solana";
0
solana_public_repos/solana-playground/solana-playground/client/src/commands
solana_public_repos/solana-playground/solana-playground/client/src/commands/clear/index.ts
export { clear } from "./clear";
0
solana_public_repos/solana-playground/solana-playground/client/src/commands
solana_public_repos/solana-playground/solana-playground/client/src/commands/clear/clear.ts
import { PgTerminal } from "../../utils/pg"; import { createCmd } from "../create"; export const clear = createCmd({ name: "clear", description: "Clear terminal", run: () => PgTerminal.run({ clear: [{ full: true }] }), });
0
solana_public_repos/solana-playground/solana-playground/client/src/commands
solana_public_repos/solana-playground/solana-playground/client/src/commands/run-and-test/run-and-test.ts
import { PgClientImporter, PgCommon, PgExplorer, PgLanguage, PgTerminal, } from "../../utils/pg"; import { createArgs, createCmd } from "../create"; /** * Crate common arguments. * * @param parentPath path that is expected to be run inside of * @returns the common arguments */ const createCommonArgs = (...
0
solana_public_repos/solana-playground/solana-playground/client/src/commands
solana_public_repos/solana-playground/solana-playground/client/src/commands/run-and-test/index.ts
export { run, test } from "./run-and-test";
0
solana_public_repos/solana-playground/solana-playground/client/src/commands
solana_public_repos/solana-playground/solana-playground/client/src/commands/anchor/anchor.ts
import { PgPackage } from "../../utils/pg"; import { createCmd } from "../create"; import { isPgConnected } from "../validation"; export const anchor = createCmd({ name: "anchor", description: "Anchor CLI", run: async (input) => { const { runAnchor } = await PgPackage.import("anchor-cli", { log: true, ...
0
solana_public_repos/solana-playground/solana-playground/client/src/commands
solana_public_repos/solana-playground/solana-playground/client/src/commands/anchor/index.ts
export { anchor } from "./anchor";
0
solana_public_repos/solana-playground/solana-playground/client/src/commands
solana_public_repos/solana-playground/solana-playground/client/src/commands/build/index.ts
export { build } from "./build";
0
solana_public_repos/solana-playground/solana-playground/client/src/commands
solana_public_repos/solana-playground/solana-playground/client/src/commands/build/build.ts
import { ExplorerFiles, PgCommon, PgExplorer, PgGlobal, PgPackage, PgProgramInfo, PgServer, PgSettings, PgTerminal, PgWeb3, TupleFiles, } from "../../utils/pg"; import { createCmd } from "../create"; export const build = createCmd({ name: "build", description: "Build your program", run: asy...
0
solana_public_repos/solana-playground/solana-playground/client/src/commands
solana_public_repos/solana-playground/solana-playground/client/src/commands/rustfmt/rustfmt.ts
import { EventName } from "../../constants"; import { PgCommon } from "../../utils/pg"; import { createCmd } from "../create"; export const rustfmt = createCmd({ name: "rustfmt", description: "Format the current file with rustfmt", run: async () => { await PgCommon.sendAndReceiveCustomEvent(EventName.EDITOR_...
0
solana_public_repos/solana-playground/solana-playground/client/src/commands
solana_public_repos/solana-playground/solana-playground/client/src/commands/rustfmt/index.ts
export { rustfmt } from "./rustfmt";
0
solana_public_repos/solana-playground/solana-playground/client/src/commands
solana_public_repos/solana-playground/solana-playground/client/src/commands/connect/connect.ts
import { PgCommon, PgTerminal, PgView, PgWallet } from "../../utils/pg"; import { createArgs, createCmd } from "../create"; export const connect = createCmd({ name: "connect", description: "Toggle connection to Playground Wallet", args: createArgs([ { name: "wallet", optional: true, values:...
0
solana_public_repos/solana-playground/solana-playground/client/src/commands
solana_public_repos/solana-playground/solana-playground/client/src/commands/connect/index.ts
export { connect } from "./connect";
0
solana_public_repos/solana-playground/solana-playground/client/src/commands
solana_public_repos/solana-playground/solana-playground/client/src/commands/help/help.ts
import { formatList, PgCommandManager, PgTerminal } from "../../utils/pg"; import { createCmd } from "../create"; export const help = createCmd({ name: "help", description: "Print help message", run: () => { const cmds = Object.values(PgCommandManager.all); PgTerminal.log("Commands:\n\n" + formatList(cmd...
0
solana_public_repos/solana-playground/solana-playground/client/src/commands
solana_public_repos/solana-playground/solana-playground/client/src/commands/help/index.ts
export { help } from "./help";
0
solana_public_repos/solana-playground/solana-playground/client/src
solana_public_repos/solana-playground/solana-playground/client/src/frameworks/common.ts
import { ClientPackageName, MergeUnion, PgCommon, PgLanguage, PgView, TupleFiles, ValueOf, } from "../utils/pg"; import { SelectProgram } from "./SelectProgram"; /** Map of dependency name -> version */ type Dependencies = { [dependencyName: string]: string }; /** Import statement regular expression wit...
0
solana_public_repos/solana-playground/solana-playground/client/src
solana_public_repos/solana-playground/solana-playground/client/src/frameworks/index.ts
import { anchor } from "./anchor"; import { native } from "./native"; import { seahorse } from "./seahorse"; /** All available program frameworks, order matters */ export const FRAMEWORKS = [native, anchor, seahorse];
0
solana_public_repos/solana-playground/solana-playground/client/src
solana_public_repos/solana-playground/solana-playground/client/src/frameworks/create.ts
import { Framework, FrameworkImpl, PgCommon } from "../utils/pg"; /** * Create a framework with inferred types. * * @param framework framework to create * @returns the framework with inferred types */ export const createFramework = <N extends string>( framework: FrameworkImpl<N> ) => { const folderPath = `./$...
0
solana_public_repos/solana-playground/solana-playground/client/src
solana_public_repos/solana-playground/solana-playground/client/src/frameworks/SelectProgram.tsx
import { FC, useState } from "react"; import styled, { css } from "styled-components"; import Modal from "../components/Modal"; import Text from "../components/Text"; import { Info } from "../components/Icons"; interface SelectProgramProps { /** Program names to select from */ programNames: string[]; } export co...
0
solana_public_repos/solana-playground/solana-playground/client/src/frameworks
solana_public_repos/solana-playground/solana-playground/client/src/frameworks/seahorse/from.ts
import { PgCommon, PgExplorer, TupleFiles } from "../../utils/pg"; import { convertFromPlayground as convertToAnchor } from "../anchor/from"; import { addAfter } from "../common"; /** * {@link Framework.importFromPlayground} */ export const convertFromPlayground = async (files: TupleFiles) => { // Seahorse program...
0
solana_public_repos/solana-playground/solana-playground/client/src/frameworks
solana_public_repos/solana-playground/solana-playground/client/src/frameworks/seahorse/to.ts
import { convertToPlayground as convertFromAnchor } from "../anchor/to"; import { PgCommon, PgExplorer, TupleFiles } from "../../utils/pg"; /** * {@link Framework.importToPlayground} */ export const convertToPlayground = async (files: TupleFiles) => { // Seahorse is a wrapper around Anchor, only difference is the ...
0
solana_public_repos/solana-playground/solana-playground/client/src/frameworks
solana_public_repos/solana-playground/solana-playground/client/src/frameworks/seahorse/index.ts
export { seahorse } from "./seahorse";
0
solana_public_repos/solana-playground/solana-playground/client/src/frameworks
solana_public_repos/solana-playground/solana-playground/client/src/frameworks/seahorse/seahorse.ts
import { createFramework } from "../create"; export const seahorse = createFramework({ name: "Seahorse", language: "Python", icon: "https://pbs.twimg.com/profile_images/1556384244598964226/S3cx06I2_400x400.jpg", circleImage: true, githubExample: { name: "Transfer SOL", url: "https://github.com/solana...
0
solana_public_repos/solana-playground/solana-playground/client/src/frameworks/seahorse
solana_public_repos/solana-playground/solana-playground/client/src/frameworks/seahorse/files/index.ts
import type { TupleFiles } from "../../../utils/pg"; export const files: TupleFiles = [ ["src/fizzbuzz.py", require("./src/fizzbuzz.py")], ["client/client.ts", require("./client/client.ts.raw")], ["tests/seahorse.test.ts", require("./tests/seahorse.test.ts.raw")], ];
0
solana_public_repos/solana-playground/solana-playground/client/src/frameworks/seahorse/files
solana_public_repos/solana-playground/solana-playground/client/src/frameworks/seahorse/files/tests/seahorse.test.ts.raw
// No imports needed: web3, anchor, pg and more are globally available describe("FizzBuzz", async () => { // Generate the fizzbuzz account public key from its seeds const [fizzBuzzAccountPk] = await web3.PublicKey.findProgramAddress( [Buffer.from("fizzbuzz"), pg.wallet.publicKey.toBuffer()], pg.PROGRAM_ID ...
0
solana_public_repos/solana-playground/solana-playground/client/src/frameworks/seahorse/files
solana_public_repos/solana-playground/solana-playground/client/src/frameworks/seahorse/files/client/client.ts.raw
// Client console.log("My address:", pg.wallet.publicKey.toString()); const balance = await pg.connection.getBalance(pg.wallet.publicKey); console.log(`My balance: ${balance / web3.LAMPORTS_PER_SOL} SOL`);
0
solana_public_repos/solana-playground/solana-playground/client/src/frameworks/seahorse/files
solana_public_repos/solana-playground/solana-playground/client/src/frameworks/seahorse/files/src/fizzbuzz.py
# fizzbuzz # Built with Seahorse v0.2.0 # # On-chain, persistent FizzBuzz! from seahorse.prelude import * # This is your program's public key and it will update # automatically when you build the project. declare_id('11111111111111111111111111111111') class FizzBuzz(Account): fizz: bool buzz: bool n: u64 @ins...
0
solana_public_repos/solana-playground/solana-playground/client/src/frameworks
solana_public_repos/solana-playground/solana-playground/client/src/frameworks/native/from.ts
import { PgCommon, PgConnection, PgExplorer, PgProgramInfo, TupleFiles, } from "../../utils/pg"; import { addAfter, addImports, getJSDependencies, getRustDependencies, IMPORT_STATEMENT_REGEX, } from "../common"; /** * {@link Framework.importFromPlayground} */ export const convertFromPlayground = ...
0
solana_public_repos/solana-playground/solana-playground/client/src/frameworks
solana_public_repos/solana-playground/solana-playground/client/src/frameworks/native/to.ts
import { convertToPlaygroundCommon, selectProgram } from "../common"; import type { TupleFiles } from "../../utils/pg"; /** * {@link Framework.importToPlayground} */ export const convertToPlayground = async (files: TupleFiles) => { // Get Cargo workspace if it exists const workspaceManifest = files .filter((...
0
solana_public_repos/solana-playground/solana-playground/client/src/frameworks
solana_public_repos/solana-playground/solana-playground/client/src/frameworks/native/native.ts
import { createFramework } from "../create"; export const native = createFramework({ name: "Native", language: "Rust", icon: "/icons/platforms/solana.png", githubExample: { name: "Hello Solana", // Only import the program for now since `fs` and `os` modules are not // implemented in Playground. We ...
0
solana_public_repos/solana-playground/solana-playground/client/src/frameworks
solana_public_repos/solana-playground/solana-playground/client/src/frameworks/native/index.ts
export { native } from "./native";
0
solana_public_repos/solana-playground/solana-playground/client/src/frameworks/native
solana_public_repos/solana-playground/solana-playground/client/src/frameworks/native/files/index.ts
import type { TupleFiles } from "../../../utils/pg"; export const files: TupleFiles = [ ["src/lib.rs", require("./src/lib.rs")], ["client/client.ts", require("./client/client.ts.raw")], ["tests/native.test.ts", require("./tests/native.test.ts.raw")], ];
0
solana_public_repos/solana-playground/solana-playground/client/src/frameworks/native/files
solana_public_repos/solana-playground/solana-playground/client/src/frameworks/native/files/tests/native.test.ts.raw
// No imports needed: web3, borsh, pg and more are globally available /** * The state of a greeting account managed by the hello world program */ class GreetingAccount { counter = 0; constructor(fields: { counter: number } | undefined = undefined) { if (fields) { this.counter = fields.counter; } ...
0
solana_public_repos/solana-playground/solana-playground/client/src/frameworks/native/files
solana_public_repos/solana-playground/solana-playground/client/src/frameworks/native/files/client/client.ts.raw
// Client console.log("My address:", pg.wallet.publicKey.toString()); const balance = await pg.connection.getBalance(pg.wallet.publicKey); console.log(`My balance: ${balance / web3.LAMPORTS_PER_SOL} SOL`);
0
solana_public_repos/solana-playground/solana-playground/client/src/frameworks/native/files
solana_public_repos/solana-playground/solana-playground/client/src/frameworks/native/files/src/lib.rs
use borsh::{BorshDeserialize, BorshSerialize}; use solana_program::{ account_info::{next_account_info, AccountInfo}, entrypoint, entrypoint::ProgramResult, msg, program_error::ProgramError, pubkey::Pubkey, }; /// Define the type of state stored in accounts #[derive(BorshSerialize, BorshDeserial...
0
solana_public_repos/solana-playground/solana-playground/client/src/frameworks
solana_public_repos/solana-playground/solana-playground/client/src/frameworks/anchor/from.ts
import { PgCommon, PgExplorer, PgProgramInfo, TupleFiles, } from "../../utils/pg"; import { addAfter, addImports, getJSDependencies, getRustDependencies, IMPORT_STATEMENT_REGEX, } from "../common"; /** * {@link Framework.importFromPlayground} */ export const convertFromPlayground = async (files: Tu...
0
solana_public_repos/solana-playground/solana-playground/client/src/frameworks
solana_public_repos/solana-playground/solana-playground/client/src/frameworks/anchor/to.ts
import { PgCommon, TupleFiles } from "../../utils/pg"; import { convertToPlaygroundCommon, selectProgram } from "../common"; /** * {@link Framework.importToPlayground} */ export const convertToPlayground = async (files: TupleFiles) => { // Get program name(s) const programNames = PgCommon.toUniqueArray( file...
0
solana_public_repos/solana-playground/solana-playground/client/src/frameworks
solana_public_repos/solana-playground/solana-playground/client/src/frameworks/anchor/anchor.ts
import { createFramework } from "../create"; export const anchor = createFramework({ name: "Anchor", language: "Rust", icon: "https://www.anchor-lang.com/_next/image?url=%2Flogo.png&w=128&q=80", githubExample: { name: "Create Account", url: "https://github.com/solana-developers/program-examples/tree/ma...
0
solana_public_repos/solana-playground/solana-playground/client/src/frameworks
solana_public_repos/solana-playground/solana-playground/client/src/frameworks/anchor/index.ts
export { anchor } from "./anchor";
0
solana_public_repos/solana-playground/solana-playground/client/src/frameworks/anchor
solana_public_repos/solana-playground/solana-playground/client/src/frameworks/anchor/files/index.ts
import type { TupleFiles } from "../../../utils/pg"; export const files: TupleFiles = [ ["src/lib.rs", require("./src/lib.rs")], ["client/client.ts", require("./client/client.ts.raw")], ["tests/anchor.test.ts", require("./tests/anchor.test.ts.raw")], ];
0
solana_public_repos/solana-playground/solana-playground/client/src/frameworks/anchor/files
solana_public_repos/solana-playground/solana-playground/client/src/frameworks/anchor/files/tests/anchor.test.ts.raw
// No imports needed: web3, anchor, pg and more are globally available describe("Test", () => { it("initialize", async () => { // Generate keypair for the new account const newAccountKp = new web3.Keypair(); // Send transaction const data = new BN(42); const txHash = await pg.program.methods ...
0
solana_public_repos/solana-playground/solana-playground/client/src/frameworks/anchor/files
solana_public_repos/solana-playground/solana-playground/client/src/frameworks/anchor/files/client/client.ts.raw
// Client console.log("My address:", pg.wallet.publicKey.toString()); const balance = await pg.connection.getBalance(pg.wallet.publicKey); console.log(`My balance: ${balance / web3.LAMPORTS_PER_SOL} SOL`);
0
solana_public_repos/solana-playground/solana-playground/client/src/frameworks/anchor/files
solana_public_repos/solana-playground/solana-playground/client/src/frameworks/anchor/files/src/lib.rs
use anchor_lang::prelude::*; // This is your program's public key and it will update // automatically when you build the project. declare_id!("11111111111111111111111111111111"); #[program] mod hello_anchor { use super::*; pub fn initialize(ctx: Context<Initialize>, data: u64) -> Result<()> { ctx.acco...
0
solana_public_repos/solana-playground/solana-playground/client/src
solana_public_repos/solana-playground/solana-playground/client/src/views/index.ts
export { BOTTOM } from "./bottom"; export { MAIN_SECONDARY } from "./main"; export { SIDEBAR } from "./sidebar";
0
solana_public_repos/solana-playground/solana-playground/client/src/views
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/index.ts
export { SIDEBAR } from "./sidebar";
0
solana_public_repos/solana-playground/solana-playground/client/src/views
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/create.ts
import { PgCommon, SidebarPage, SidebarPageParam } from "../../utils/pg"; /** * Create a sidebar page. * * @param page sidebar page * @returns the page with correct types */ export const createSidebarPage = <N extends string>( page: SidebarPageParam<N> ) => { page.icon = "/icons/sidebar/" + page.icon; page....
0
solana_public_repos/solana-playground/solana-playground/client/src/views
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/sidebar.ts
import { buildDeploy } from "./build-deploy"; import { explorer } from "./explorer"; import { programs } from "./programs"; import { test } from "./test"; import { tutorials } from "./tutorials"; /** All sidebar pages in order */ export const SIDEBAR = [explorer, buildDeploy, test, tutorials, programs];
0
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/build-deploy/build-deploy.ts
import { createSidebarPage } from "../create"; export const buildDeploy = createSidebarPage({ name: "Build & Deploy", icon: "build.png", keybind: "Ctrl+Shift+B", });
0
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/build-deploy/index.ts
export { buildDeploy } from "./build-deploy";
0
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/build-deploy
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/build-deploy/Component/BuildDeploy.tsx
import styled from "styled-components"; import Build from "./Build"; import Deploy from "./Deploy"; import ProgramSettings from "./ProgramSettings"; const BuildDeploy = () => ( <Wrapper> <Build /> <Deploy /> <ProgramSettings /> </Wrapper> ); const Wrapper = styled.div` padding: 1.5rem; border-bot...
0
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/build-deploy
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/build-deploy/Component/Build.tsx
import { useCallback } from "react"; import styled from "styled-components"; import Button from "../../../../components/Button"; import { useRenderOnChange } from "../../../../hooks"; import { PgCommand, PgGlobal } from "../../../../utils/pg"; const Build = () => { const buildLoading = useRenderOnChange( PgGlob...
0
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/build-deploy
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/build-deploy/Component/Deploy.tsx
import { useMemo } from "react"; import styled from "styled-components"; import Text from "../../../../components/Text"; import Button, { ButtonProps } from "../../../../components/Button"; import { PgCommand, PgGlobal } from "../../../../utils/pg"; import { useProgramInfo, useRenderOnChange, useWallet, } from "...
0
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/build-deploy
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/build-deploy/Component/index.ts
export { default } from "./BuildDeploy";
0
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/build-deploy/Component
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/build-deploy/Component/ProgramSettings/IDL.tsx
import { ChangeEvent, useCallback, useEffect, useMemo, useState } from "react"; import styled from "styled-components"; import Button from "../../../../../components/Button"; import ExportButton from "../../../../../components/ExportButton"; import ImportButton from "../../../../../components/ImportButton"; import { ...
0
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/build-deploy/Component
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/build-deploy/Component/ProgramSettings/ProgramSettings.tsx
import { FC, ReactNode, useState } from "react"; import styled, { css } from "styled-components"; import Foldable from "../../../../../components/Foldable"; import BuildFlags from "./BuildFlags"; import IDL from "./IDL"; import ProgramBinary from "./ProgramBinary"; import ProgramID from "./ProgramID"; import { useAsyn...
0
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/build-deploy/Component
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/build-deploy/Component/ProgramSettings/ProgramID.tsx
import { ChangeEvent, useEffect, useState } from "react"; import styled, { css } from "styled-components"; import Button from "../../../../../components/Button"; import CopyButton from "../../../../../components/CopyButton"; import ExportButton from "../../../../../components/ExportButton"; import ImportButton from "....
0
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/build-deploy/Component
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/build-deploy/Component/ProgramSettings/BuildFlags.tsx
import styled from "styled-components"; import Checkbox from "../../../../../components/Checkbox"; import Tooltip from "../../../../../components/Tooltip"; import { PgCommon, PgSettings } from "../../../../../utils/pg"; type BuildFlag = keyof typeof PgSettings["build"]["flags"]; const BUILD_FLAGS: { [K in BuildFlag]...
0
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/build-deploy/Component
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/build-deploy/Component/ProgramSettings/index.ts
export { default } from "./ProgramSettings";
0
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/build-deploy/Component
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/build-deploy/Component/ProgramSettings/ProgramBinary.tsx
import styled from "styled-components"; import Button from "../../../../../components/Button"; import ImportButton from "../../../../../components/ImportButton"; import { PgCommon, PgExplorer, PgProgramInfo, PgServer, } from "../../../../../utils/pg"; import { useRenderOnChange } from "../../../../../hooks"; ...
0
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/test/test.ts
import TestSkeleton from "./Component/TestSkeleton"; import { createSidebarPage } from "../create"; export const test = createSidebarPage({ name: "Test", icon: "test.png", keybind: "Ctrl+Shift+D", LoadingElement: TestSkeleton, });
0
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/test/index.ts
export { test } from "./test";
0
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/test
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/test/Component/InputLabel.tsx
import { FC } from "react"; import styled, { css } from "styled-components"; interface InputLabelProps { name: string; type: string; isMut?: boolean; isSigner?: boolean; } const InputLabel: FC<InputLabelProps> = ({ name, type, isMut, isSigner }) => ( <Wrapper> <NameWrapper> <Name>{name}:</Name> ...
0
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/test
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/test/Component/TestSkeleton.tsx
import styled, { css } from "styled-components"; import { Skeleton } from "../../../../components/Loading"; const TestSkeleton = () => ( <Wrapper> <ProgramNameWrapper> <Skeleton width="4rem" /> <Skeleton width="6rem" /> </ProgramNameWrapper> <Heading> <Skeleton width="6.5rem" /> <...
0
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/test
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/test/Component/Test.tsx
import { useEffect } from "react"; import styled from "styled-components"; import BN from "bn.js"; import Account from "./Account"; import Event from "./Event"; import Instruction from "./Instruction"; import IdlProvider from "./IdlProvider"; import Text from "../../../../components/Text"; import { PgCommand, PgProgra...
0
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/test
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/test/Component/Interaction.tsx
import { FC } from "react"; import styled, { css } from "styled-components"; import Foldable from "../../../../components/Foldable"; interface InteractionProps { name: string; index: number; } const Interaction: FC<InteractionProps> = ({ name, index, children }) => ( <Wrapper index={index}> <Foldable eleme...
0
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/test
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/test/Component/index.ts
export { default } from "./Test";
0
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/test
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/test/Component/CodeResult.tsx
import styled, { css } from "styled-components"; import CodeBlock, { CodeBlockProps } from "../../../../components/CodeBlock"; interface CodeResultProps extends CodeBlockProps { index: number; } const CodeResult = (props: CodeResultProps) => ( <StyledCodeBlock lang="json" {...props} /> ); const StyledCodeBlock ...
0
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/test
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/test/Component/IdlProvider.tsx
import { FC, createContext, useContext } from "react"; import type { Idl } from "../../../../utils/pg/program-interaction"; interface IdlProviderProps { idl: Idl; } const IdlContext = createContext<IdlProviderProps | null>(null); const IdlProvider: FC<IdlProviderProps> = ({ children, ...props }) => { return <Id...
0
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/test/Component
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/test/Component/Instruction/InstructionProvider.tsx
import { Dispatch, FC, SetStateAction, createContext, useContext } from "react"; import type { GeneratableInstruction } from "../../../../../utils/pg/program-interaction"; interface InstructionProviderProps { instruction: GeneratableInstruction; setInstruction: Dispatch<SetStateAction<GeneratableInstruction>>; } ...
0
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/test/Component
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/test/Component/Instruction/FromSeed.tsx
import { FC, useMemo, useRef, useState } from "react"; import styled from "styled-components"; import InputLabel from "../InputLabel"; import InstructionInput from "./InstructionInput"; import Button from "../../../../../components/Button"; import Tooltip from "../../../../../components/Tooltip"; import SearchBar, { ...
0
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/test/Component
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/test/Component/Instruction/Instruction.tsx
import { FC, useCallback, useEffect, useReducer, useState } from "react"; import styled from "styled-components"; import InstructionInput from "./InstructionInput"; import InstructionProvider from "./InstructionProvider"; import Interaction from "../Interaction"; import Button from "../../../../../components/Button"; ...
0
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/test/Component
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/test/Component/Instruction/InstructionInput.tsx
import { FC, useEffect, useMemo, useRef, useState } from "react"; import styled from "styled-components"; import FromSeed from "./FromSeed"; import Label from "../InputLabel"; import CopyButton from "../../../../../components/CopyButton"; import SearchBar, { SearchBarItem, SearchBarProps, } from "../../../../../co...
0
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/test/Component
solana_public_repos/solana-playground/solana-playground/client/src/views/sidebar/test/Component/Instruction/index.ts
export { default } from "./Instruction";
0