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/tutorials | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/TinyAdventureTwo/TinyAdventureTwo.tsx | import { Tutorial } from "../../components/Tutorial";
const TinyAdventureTwo = () => (
<Tutorial
// About section that will be shown under the description of the tutorial page
about={require("./about.md")}
// Actual tutorial pages to show next to the editor
pages={[
{ content: require("./pages/... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/TinyAdventureTwo/index.ts | export { default } from "./TinyAdventureTwo";
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials/TinyAdventureTwo | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/TinyAdventureTwo/files/client.ts.raw | // The PDA adress everyone will be able to control the character if the interact with your program
const [globalLevel1GameDataAccount, bump] =
await anchor.web3.PublicKey.findProgramAddress(
[Buffer.from("level1", "utf8")],
//[pg.wallet.publicKey.toBuffer()], <- You could also add the player wallet as a seed,... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials/TinyAdventureTwo | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/TinyAdventureTwo/files/lib.rs | use anchor_lang::prelude::*;
use anchor_lang::solana_program::native_token::LAMPORTS_PER_SOL;
use anchor_lang::system_program;
// This is your program's public key and it will update
// automatically when you build the project.
declare_id!("");
#[program]
mod tiny_adventure_two {
use super::*;
// The amount ... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials/TinyAdventureTwo | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/TinyAdventureTwo/files/anchor.test.ts.raw | // No imports needed: web3, anchor, pg and more are globally available
// The PDA adress everyone will be able to control the character if the interact with your program
const [globalLevel1GameDataAccount, bump] =
await anchor.web3.PublicKey.findProgramAddress(
[Buffer.from("level1", "utf8")],
//[pg.wallet.p... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/HelloSolana/HelloSolana.tsx | import { Tutorial } from "../../components/Tutorial";
import { PgExplorer, PgView } from "../../utils/pg";
const HelloSolana = () => (
<Tutorial
// About section that will be shown under the description of the tutorial page
about={require("./about.md")}
// Actual tutorial pages to show next to the editor... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/HelloSolana/index.ts | export { default } from "./HelloSolana";
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials/HelloSolana | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/HelloSolana/files/client.ts.raw | // Client code... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials/HelloSolana | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/HelloSolana/files/lib.rs | // Imports we need
use solana_program::{
account_info::AccountInfo,
entrypoint,
entrypoint::ProgramResult,
msg,
pubkey::Pubkey,
}; | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/Template/index.ts | export { default } from "./Template";
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/Template/Template.tsx | import { Tutorial } from "../../components/Tutorial";
const Template = () => (
<Tutorial
// About section that will be shown under the description of the tutorial page
about={require("./about.md")}
// Actual tutorial pages to show next to the editor
pages={[
{ content: require("./pages/1.md") }... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials/Template | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/Template/files/client.ts.raw | // Client code...
console.log(42) | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials/Template | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/Template/files/lib.rs | // Implement program... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials/Template | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/Template/files/index.test.ts.raw | // Test(mocha)
describe("Test", () => {
it("works", () => {
console.log("wow!");
});
}); | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/TodoAppSeahorse/TodoAppSeahorse.tsx | import { Tutorial } from "../../components/Tutorial";
const TodoAppSeahorse = () => (
<Tutorial
// About section that will be shown under the description of the tutorial page
about={require("./about.md")}
// Actual tutorial pages to show next to the editor
pages={[
{ content: require("./pages/1... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/TodoAppSeahorse/index.ts | export { default } from "./TodoAppSeahorse";
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials/TodoAppSeahorse | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/TodoAppSeahorse/files/todo_app.py | from seahorse.prelude import *
declare_id('')
# User profile
class UserProfile(Account):
...
# Todo list item
class TodoAccount(Account):
...
# initialize user profile
@instruction
def init_user_profile():
...
# add task to user's list
@instruction
def add_task():
...
# mark task as done
@inst... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials/TodoAppSeahorse | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/TodoAppSeahorse/files/index.test.ts.raw | describe("Todo App", async () => {
const task = "ship product";
const lastTodo = new anchor.BN(0);
const lastTodoBuffer = lastTodo.toArrayLike(Buffer, "le", 1);
const [userProfile] = web3.PublicKey.findProgramAddressSync(
[Buffer.from("user_profile"), pg.wallet.publicKey.toBuffer()],
pg.PROGRAM_ID
);... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/FaucetSeahorse/FaucetSeahorse.tsx | import { Tutorial } from "../../components/Tutorial";
const FaucetSeahorse = () => (
<Tutorial
// About section that will be shown under the description of the tutorial page
about={require("./about.md")}
// Actual tutorial pages to show next to the editor
pages={[
{ content: require("./pages/1.... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/FaucetSeahorse/index.ts | export { default } from "./FaucetSeahorse";
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials/FaucetSeahorse | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/FaucetSeahorse/files/faucet.py | from seahorse.prelude import *
from seahorse.pyth import *
declare_id('')
# Faucet
class BitcornFaucet(Account):
...
# initialize a new faucet
@instruction
def init_faucet():
...
# drips tokens to user
@instruction
def drip_bitcorn_tokens():
...
# return unused tokens back to the faucet
@instruction
de... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/Lumberjack/Lumberjack.tsx | import { Tutorial } from "../../components/Tutorial";
const Lumberjack = () => (
<Tutorial
// About section that will be shown under the description of the tutorial page
about={require("./about.md")}
// Actual tutorial pages to show next to the editor
pages={[
{ content: require("./pages/1.md")... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/Lumberjack/index.ts | export { default } from "./Lumberjack";
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials/Lumberjack | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/Lumberjack/files/client.ts.raw | // The PDA that holds the player account data
const [playerDataPda, bump] = await anchor.web3.PublicKey.findProgramAddress(
[Buffer.from("player", "utf8"), pg.wallet.publicKey.toBuffer()],
pg.program.programId
);
let gameDataAccount;
try {
gameDataAccount = await pg.program.account.playerData.fetch(playerDataPda... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials/Lumberjack | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/Lumberjack/files/lib.rs | use anchor_lang::prelude::*;
declare_id!("4ayoaXt8odfcNneUuZPeiYQfSCDH4XyG8iEkaPK2pUHx");
const MAX_ENERGY: u64 = 5;
const TIME_TO_REFILL_ENERGY: i64 = 30;
#[program]
pub mod lumberjack {
use super::*;
pub fn init_player(ctx: Context<InitPlayer>) -> Result<()> {
ctx.accounts.player.energy = MAX_ENER... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/ExpenseTracker/ExpenseTracker.tsx | import { Tutorial } from "../../components/Tutorial";
const ExpenseTracker = () => (
<Tutorial
// About section that will be shown under the description of the tutorial page
about={require("./about.md")}
// Actual tutorial pages to show next to the editor
pages={[
{ content: require("./pages/1.... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/ExpenseTracker/index.ts | export { default } from "./ExpenseTracker";
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials/ExpenseTracker | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/ExpenseTracker/files/lib.rs | use anchor_lang::prelude::*;
// Your program Id will be added here when you enter "build" command
declare_id!("");
#[program]
pub mod etracker {
use super::*;
pub fn initialize_expense(
ctx: Context<InitializeExpense>,
id: u64,
merchant_name: String,
amount: u64,
) -> Res... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials/ExpenseTracker | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/ExpenseTracker/files/index.test.ts.raw | describe("Expense Tracker", async () => {
let merchantName = "test";
let amount = 100;
let id = 1;
let merchantName2 = "test 2";
let amount2 = 200;
let [expense_account] = anchor.web3.PublicKey.findProgramAddressSync(
[
Buffer.from("expense"),
pg.wallet.publicKey.toBuffer(),
new BN(i... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/TinyAdventure/TinyAdventure.tsx | import { Tutorial } from "../../components/Tutorial";
const TinyAdventure = () => (
<Tutorial
// About section that will be shown under the description of the tutorial page
about={require("./about.md")}
// Actual tutorial pages to show next to the editor
pages={[
{ content: require("./pages/1.m... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/TinyAdventure/index.ts | export { default } from "./TinyAdventure";
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials/TinyAdventure | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/TinyAdventure/files/client.ts.raw | // Client
// The PDA adress everyone will be able to control the character if the interact with your program
const [globalLevel1GameDataAccount] =
anchor.web3.PublicKey.findProgramAddressSync(
[Buffer.from("level1", "utf8")],
//[pg.wallet.publicKey.toBuffer()], <- You could also add the player wallet as a se... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials/TinyAdventure | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/TinyAdventure/files/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!("");
#[program]
mod tiny_adventure {
use super::*;
pub fn initialize(ctx: Context<Initialize>) -> Result<()> {
ctx.accounts.new_game_data_account.player_positi... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials/TinyAdventure | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/TinyAdventure/files/anchor.test.ts.raw | // No imports needed: web3, anchor, pg and more are globally available
describe("Test", () => {
it("Initlialize", async () => {
const [newGameDataAccount] = await anchor.web3.PublicKey.findProgramAddress(
[Buffer.from("level1", "utf8")],
pg.program.programId
);
// If account is null we initi... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/TictactoeSeahorse/TictactoeSeahorse.tsx | import { Tutorial } from "../../components/Tutorial";
const TicTacToeSeahorse = () => (
<Tutorial
// About section that will be shown under the description of the tutorial page
about={require("./about.md")}
// Actual tutorial pages to show next to the editor
pages={[
{ content: require("./pages... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/TictactoeSeahorse/index.ts | export { default } from "./TictactoeSeahorse";
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials/TictactoeSeahorse | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/TictactoeSeahorse/files/tictactoe.py | from seahorse.prelude import *
declare_id('')
# Game account
class Game(Account):
...
# Winning states
class GameState(Enum):
...
# initialize game
@instruction
def init_game():
...
# check if someone has won
def win_check()-> GameState:
...
# play a turn
@instruction
def play_game():
..... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials/TictactoeSeahorse | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/TictactoeSeahorse/files/index.test.ts.raw |
describe("Tictactoe game", async () => {
const player1 = pg.wallet.publicKey;
const player2 = pg.wallet.publicKey;
function printgame(grid) {
console.log(`${grid[0]} ${grid[1]} ${grid[2]}`);
console.log(`${grid[3]} ${grid[4]} ${grid[5]}`);
console.log(`${grid[6]} ${grid[7]} ${grid[8]}`);
}
let ... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/HelloSeahorse/HelloSeahorse.tsx | import { Tutorial } from "../../components/Tutorial";
import { PgExplorer, PgView } from "../../utils/pg";
const HelloSeahorse = () => (
<Tutorial
// About section that will be shown under the description of the tutorial page
about={require("./about.md")}
// Actual tutorial pages to show next to the edit... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/HelloSeahorse/index.ts | export { default } from "./HelloSeahorse";
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials/HelloSeahorse | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/HelloSeahorse/files/hello.py | # Seahorse program | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials/HelloSeahorse | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/HelloSeahorse/files/client.ts.raw | // Client code... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/BossBattle/BossBattle.tsx | import { Tutorial } from "../../components/Tutorial";
const BossBattle = () => (
<Tutorial
// About section that will be shown under the description of the tutorial page
about={require("./about.md")}
// Actual tutorial pages to show next to the editor
pages={[
{ content: require("./pages/1.md")... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/BossBattle/index.ts | export { default } from "./BossBattle";
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials/BossBattle | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/BossBattle/files/client.ts.raw | const [enemyBossPDA] = anchor.web3.PublicKey.findProgramAddressSync(
[Buffer.from("boss")],
pg.program.programId
);
async function confirmAndLogTransaction(txHash) {
const { blockhash, lastValidBlockHeight } =
await pg.connection.getLatestBlockhash();
await pg.connection.confirmTransaction(
{
bl... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials/BossBattle | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/BossBattle/files/lib.rs | use anchor_lang::prelude::*;
declare_id!("11111111111111111111111111111111");
const MAX_HEALTH: u64 = 1000;
const MAX_DAMAGE: u64 = 500;
#[program]
pub mod boss_battle {
use super::*;
pub fn respawn(ctx: Context<Respawn>) -> Result<()> {
// Reset enemy boss to max health
ctx.accounts.enemy_b... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/HelloAnchor/HelloAnchor.tsx | import { Tutorial } from "../../components/Tutorial";
import { PgExplorer, PgView } from "../../utils/pg";
const HelloAnchor = () => (
<Tutorial
// About section that will be shown under the description of the tutorial page
about={require("./about.md")}
// Actual tutorial pages to show next to the editor... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/HelloAnchor/index.ts | export { default } from "./HelloAnchor";
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials/HelloAnchor | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/HelloAnchor/files/client.ts.raw | // Client code... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials/HelloAnchor | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/HelloAnchor/files/lib.rs | // Import anchor | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/ZeroCopy/ZeroCopy.tsx | import { Tutorial } from "../../components/Tutorial";
const ZeroCopy = () => (
<Tutorial
// About section that will be shown under the description of the tutorial page
about={require("./about.md")}
// Actual tutorial pages to show next to the editor
pages={[{ content: require("./pages/1.md") }]}
... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/ZeroCopy/index.ts | export { default } from "./ZeroCopy";
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials/ZeroCopy | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/ZeroCopy/files/client.ts.raw | // Please run the tests for this example.
// Just type "test" in the console on the bottom | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials/ZeroCopy | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/ZeroCopy/files/lib.rs | use anchor_lang::prelude::*;
use anchor_lang::solana_program::system_program;
use std::str;
declare_id!("2MpQoKyLGXP26cGASC8pPLY3MaCGitM9XKUxziUmNN4i");
#[program]
pub mod zero_copy {
use super::*;
pub fn initialize_no_zero_copy(_ctx: Context<InitializeNoZeroCopy>) -> Result<()> {
Ok(())
}
... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/tutorials/ZeroCopy | solana_public_repos/solana-playground/solana-playground/client/src/tutorials/ZeroCopy/files/anchor.test.ts.raw | describe("Test", () => {
it("stacksize", async () => {
const signer = anchor.web3.Keypair.generate();
console.log("Local signer is: ", signer.publicKey.toBase58());
let confirmOptions = {
skipPreflight: true,
};
let [pdaHitStackSize] = await anchor.web3.PublicKey.findProgramAddress(
... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src | solana_public_repos/solana-playground/solana-playground/client/src/commands/validation.ts | // Common command checks
import { PgCommand, PgTerminal, PgWallet } from "../utils/pg";
/** Check whether Playground Wallet is connected. */
export const isPgConnected = () => {
if (!PgWallet.current?.isPg) {
throw new Error(
`${PgTerminal.bold(
"Playground Wallet"
)} must be connected to ru... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src | solana_public_repos/solana-playground/solana-playground/client/src/commands/commands.ts | // Exported commands from this file will automatically be usable in the terminal
export * from "./anchor";
export * from "./build";
export * from "./clear";
export * from "./connect";
export * from "./deploy";
export * from "./help";
export * from "./prettier";
export * from "./run-and-test";
export * from "./rustfmt"... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src | solana_public_repos/solana-playground/solana-playground/client/src/commands/index.ts | export * as COMMANDS from "./commands";
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src | solana_public_repos/solana-playground/solana-playground/client/src/commands/create.ts | import type {
Arg,
CommandImpl,
CommandInferredImpl,
Option,
} from "../utils/pg";
/**
* Create a command.
*
* NOTE: This is only a type helper function.
*
* @param cmd command to create
* @returns the command with its inferred type
*/
export const createCmd = <
N extends string,
A extends Arg[],
... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/commands | solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/sugar.ts | import { PgPackage } from "../../utils/pg";
import { createCmd } from "../create";
import { isPgConnected } from "../validation";
export const sugar = createCmd({
name: "sugar",
description:
"Command line tool for creating and managing Metaplex Candy Machines",
run: async (input) => {
const { runSugar } ... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/commands | solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/processor.ts | // @ts-nocheck
import { Emoji, NETWORKS } from "../../constants";
import { PgCommon, PgSettings, PgTerminal } from "../../utils/pg";
import {
processBundlr,
processCollectionSet,
processCreateConfig,
processDeploy,
processGuardAdd,
processGuardRemove,
processGuardShow,
processGuardUpdate,
processGuar... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/commands | solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/index.ts | export { sugar } from "./sugar";
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar | solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/types/guard-data.ts | import type {
CandyGuardsSettings,
DefaultCandyGuardSettings,
Option,
} from "@metaplex-foundation/js";
export interface CandyGuardData {
default: DefaultCandyGuardSettings;
groups: Option<Group[]>;
}
interface Group {
label: string;
guards: CandyGuardsSettings;
}
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar | solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/types/index.ts | export * from "./config";
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar | solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/types/config.ts | import { BigNumber, Creator, Option } from "@metaplex-foundation/js";
import { HiddenSettings } from "@metaplex-foundation/mpl-candy-machine-core";
import type { CandyGuardData } from "./guard-data";
import type { PgWeb3 } from "../../../utils/pg";
export type ToPrimitive<T> = {
[K in keyof T]: T[K] extends PgWeb3.... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar | solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/constants/token-metadata.ts | /** Prefix used for PDAs to avoid certain collision attacks */
export const TOKEN_METADATA_PREFIX = "metadata";
/** Used in seeds to make Edition model pda address */
export const EDITION = "edition";
export const RESERVATION = "reservation";
export const USER = "user";
export const BURN = "burn";
export const COL... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar | solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/constants/sugar.ts | export const VALID_CATEGORIES = ["image", "video", "audio", "vr", "html"];
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar | solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/constants/bundlr.ts | export enum BundlrEnpoints {
DEVNET = "https://devnet.bundlr.network",
MAINNET = "https://node1.bundlr.network",
}
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar | solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/constants/candy-machine.ts | import {
MAX_CREATOR_LEN,
MAX_CREATOR_LIMIT,
MAX_NAME_LENGTH,
MAX_SYMBOL_LENGTH,
MAX_URI_LENGTH,
} from "./token-metadata";
import { PgWeb3 } from "../../../utils/pg";
export const EXPIRE_OFFSET = 10 * 60;
export const CANDY_MACHINE_PREFIX = "candy_machine";
export const BOT_FEE = 10000000;
export const FRE... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar | solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/constants/index.ts | export * from "./bundlr";
export * from "./candy-machine-core";
export * from "./candy-machine";
export * from "./sugar";
export * from "./token-metadata";
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar | solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/constants/candy-machine-core.ts | import {
MAX_CREATOR_LEN,
MAX_CREATOR_LIMIT,
MAX_NAME_LENGTH,
MAX_SYMBOL_LENGTH,
MAX_URI_LENGTH,
} from "./token-metadata";
// Empty value used for string padding.
export const NULL_STRING = "\0";
// Constant to define the replacement index string.
export const REPLACEMENT_INDEX = "$ID$";
// Constant to de... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar | solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/utils/metaplex.ts | import {
bundlrStorage,
Metaplex,
walletAdapterIdentity,
} from "@metaplex-foundation/js";
import { BundlrEnpoints } from "../constants";
import { PgConnection, PgSettings, PgWallet } from "../../../utils/pg";
export const getMetaplex = async (
endpoint: string = PgSettings.connection.endpoint
) => {
return... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar | solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/utils/print.ts | import { PgTerminal } from "../../../utils/pg";
export const printWithStyle = (
indent: string,
key: string | number,
value: any = ""
) => {
PgTerminal.log(
` ${PgTerminal.secondaryText(`${indent}:.. ${key}:`)} ${value}`,
{ noColor: true }
);
};
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar | solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/utils/cache.ts | import {
CandyMachineItem,
Option,
findCandyMachineV2CreatorPda,
} from "@metaplex-foundation/js";
import { ConfigLine } from "@metaplex-foundation/mpl-candy-machine-core";
import { PgSugar } from "../processor";
import { PgCommon, PgExplorer, PgWeb3 } from "../../../utils/pg";
export class CandyCache {
progr... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar | solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/utils/candy-machine.ts | import type { PgWeb3 } from "../../../utils/pg";
export const assertCorrectAuthority = (
userPk: PgWeb3.PublicKey,
updateAuthorityPk: PgWeb3.PublicKey
) => {
if (!userPk.equals(updateAuthorityPk)) {
throw new Error(
"Update authority does not match that of the candy machine."
);
}
};
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar | solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/utils/accounts.ts | import { Metaplex } from "@metaplex-foundation/js";
import {
MAX_NAME_LENGTH,
MAX_SYMBOL_LENGTH,
MAX_URI_LENGTH,
} from "../constants";
export const getCmCreatorMetadataAccounts = async (
metaplex: Metaplex,
creator: string,
position: number = 0
) => {
if (position > 4) {
throw new Error("CM Creator... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar | solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/utils/index.ts | export * from "./accounts";
export * from "./cache";
export * from "./candy-machine";
export * from "./config";
export * from "./guards";
export * from "./metaplex";
export * from "./print";
| 0 |
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar | solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/utils/guards.ts | import {
Option,
sol,
toBigNumber,
toDateTime,
token,
} from "@metaplex-foundation/js";
import { PgWeb3 } from "../../../utils/pg";
import type { ConfigData, ToPrimitive } from "../types";
export const parseGuards = (
guards: ToPrimitive<Option<ConfigData["guards"]>>
) => {
if (!guards) return null;
... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar | solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/utils/config.ts | import { Option, toBigNumber } from "@metaplex-foundation/js";
import { parseGuards } from "./guards";
import { PgSugar } from "../processor";
import { PgCommon, PgExplorer, PgTerminal, PgWeb3 } from "../../../utils/pg";
import type { ConfigData, ToPrimitive } from "../types";
export const loadConfigData = async (): ... | 0 |
solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar | solana_public_repos/solana-playground/solana-playground/client/src/commands/sugar/commands/index.ts | export * from "./bundlr";
export * from "./collection";
export * from "./create-config";
export * from "./deploy";
export * from "./guard";
export * from "./hash";
export * from "./launch";
export * from "./mint";
export * from "./reveal";
export * from "./show";
export * from "./sign";
export * from "./update";
export... | 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/validate/validate.ts | import type { JsonMetadata } from "@metaplex-foundation/js";
import {
checkCategory,
checkCreatorsAddresses,
checkCreatorsShares,
checkName,
checkSellerFeeBasisPoints,
checkSymbol,
checkUrl,
} from "./parser";
import { SugarUploadScreen } from "../upload";
import { Emoji } from "../../../../constants";
i... | 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/validate/parser.ts | import type { Creator } from "@metaplex-foundation/js";
import {
MAX_NAME_LENGTH,
MAX_SYMBOL_LENGTH,
MAX_URI_LENGTH,
VALID_CATEGORIES,
} from "../../constants";
import { PgCommon } from "../../../../utils/pg";
import type { ToPrimitive } from "../../types";
export const checkName = (name: string) => {
if (n... | 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/validate/index.ts | export * from "./parser";
export * from "./validate";
| 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/collection/collection.ts | import { createSetCollectionInstruction } from "@metaplex-foundation/mpl-candy-machine-core";
import { hashAndUpdate } from "../hash";
import { processUpdate } from "../update";
import { assertCorrectAuthority, getMetaplex, loadCache } from "../../utils";
import { Emoji } from "../../../../constants";
import { PgTermi... | 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/collection/index.ts | export * from "./collection";
| 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/create-config/create-config.ts | import {
MAX_NAME_LENGTH,
MAX_URI_LENGTH,
REPLACEMENT_INDEX_INCREMENT,
} from "../../constants";
import { PgSugar } from "../../processor";
import { Emoji } from "../../../../constants";
import { PgCommon, PgExplorer, PgTerminal } from "../../../../utils/pg";
import { ConfigData, ToPrimitive, UploadMethod } from ... | 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/create-config/index.ts | export * from "./create-config";
| 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/mint/mint.ts | import { toBigNumber } from "@metaplex-foundation/js";
import { getMetaplex, loadCache } from "../../utils";
import { Emoji } from "../../../../constants";
import { PgBlockExplorer, PgTerminal, PgWeb3 } from "../../../../utils/pg";
export const processMint = async (
rpcUrl: string | undefined,
number: bigint | un... | 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/mint/index.ts | export * from "./mint";
| 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/update/index.ts | export * from "./update";
| 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/update/update.ts | import { toBigNumber } from "@metaplex-foundation/js";
import {
assertCorrectAuthority,
getMetaplex,
loadCache,
loadConfigData,
} from "../../utils";
import { Emoji } from "../../../../constants";
import { PgTerminal, PgWeb3 } from "../../../../utils/pg";
export const processUpdate = async (
rpcUrl: 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/hash/hash.ts | import { loadCache, loadConfigData, saveConfigData } from "../../utils";
import { PgBytes, PgCommon, PgTerminal } from "../../../../utils/pg";
export const processHash = async (compare: string | undefined) => {
const configData = await loadConfigData();
const term = await PgTerminal.get();
if (compare) {
co... | 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/hash/index.ts | export * from "./hash";
| 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/verify/verify.ts | import { CandyMachineItem } from "@metaplex-foundation/js";
import { CacheItem, getMetaplex, loadCache } from "../../utils";
import { Emoji } from "../../../../constants";
import { PgConnection, PgTerminal, PgWeb3 } from "../../../../utils/pg";
export const processVerify = async (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/verify/index.ts | export * from "./verify";
| 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/deploy/collection.ts | import { Creator, Metaplex } from "@metaplex-foundation/js";
import {
createCreateMetadataAccountV3Instruction,
createCreateMasterEditionV3Instruction,
} from "@metaplex-foundation/mpl-token-metadata";
import {
createAssociatedTokenAccountInstruction,
getAssociatedTokenAddress,
MINT_SIZE,
TOKEN_PROGRAM_ID,
... | 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/deploy/index.ts | export * from "./deploy";
| 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/deploy/deploy.ts | import { Emoji } from "../../../../constants";
import { PgCommon, PgTerminal, PgWeb3 } from "../../../../utils/pg";
import { loadConfigData, getMetaplex, loadCache } from "../../utils";
import { hashAndUpdate } from "../hash";
import { processUpdate } from "../update";
import { checkName, checkSellerFeeBasisPoints, che... | 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/launch/launch.ts | import { processCreateConfig } from "../create-config";
import { processDeploy } from "../deploy";
import { processUpload } from "../upload";
import { processValidate } from "../validate";
import { processVerify } from "../verify";
import { loadConfigData } from "../../utils";
import { Emoji } from "../../../../constan... | 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/launch/index.ts | export * from "./launch";
| 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.