├── programs └── pump │ ├── src │ ├── utils │ │ ├── mod.rs │ │ └── calc.rs │ ├── consts.rs │ ├── instructions │ │ ├── mod.rs │ │ ├── remove_liquidity.rs │ │ ├── initialize.rs │ │ ├── swap.rs │ │ └── add_liquidity.rs │ ├── errors.rs │ ├── lib.rs │ └── state.rs │ ├── Xargo.toml │ └── Cargo.toml ├── .gitignore ├── .prettierignore ├── Cargo.toml ├── tsconfig.json ├── cli ├── programId.ts ├── accounts │ ├── index.ts │ ├── CurveConfiguration.ts │ ├── LiquidityProvider.ts │ └── LiquidityPool.ts ├── instructions │ ├── index.ts │ ├── initialize.ts │ ├── swap.ts │ └── addLiquidity.ts └── errors │ ├── index.ts │ ├── custom.ts │ └── anchor.ts ├── Anchor.toml ├── package.json ├── LICENSE ├── CHANGELOG.md ├── CONTRIBUTING.md ├── SECURITY.md ├── README.md ├── docs └── API.md ├── tests └── pump.ts └── yarn.lock /programs/pump/src/utils/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod calc; 2 | pub use calc::*; 3 | -------------------------------------------------------------------------------- /programs/pump/Xargo.toml: -------------------------------------------------------------------------------- 1 | [target.bpfel-unknown-unknown.dependencies.std] 2 | features = [] 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | .anchor 3 | .DS_Store 4 | target 5 | **/*.rs.bk 6 | node_modules 7 | test-ledger 8 | .yarn 9 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | 2 | .anchor 3 | .DS_Store 4 | target 5 | node_modules 6 | dist 7 | build 8 | test-ledger 9 | -------------------------------------------------------------------------------- /programs/pump/src/consts.rs: -------------------------------------------------------------------------------- 1 | pub const INITIAL_PRICE: u64 = 600; // lamports per one token (without decimal) -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | members = [ 3 | "programs/*" 4 | ] 5 | 6 | [profile.release] 7 | overflow-checks = true 8 | lto = "fat" 9 | codegen-units = 1 10 | [profile.release.build-override] 11 | opt-level = 3 12 | incremental = false 13 | codegen-units = 1 14 | -------------------------------------------------------------------------------- /programs/pump/src/instructions/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod add_liquidity; 2 | pub mod initialize; 3 | pub mod remove_liquidity; 4 | pub mod swap; 5 | pub mod create_raydium_pool; 6 | 7 | pub use add_liquidity::*; 8 | pub use initialize::*; 9 | pub use remove_liquidity::*; 10 | pub use swap::*; 11 | pub use create_raydium_pool::*; 12 | -------------------------------------------------------------------------------- /programs/pump/src/utils/calc.rs: -------------------------------------------------------------------------------- 1 | use std::ops::{Div, Mul}; 2 | 3 | pub fn convert_to_float(value: u64, decimals: u8) -> f64 { 4 | (value as f64).div(f64::powf(10.0, decimals as f64)) 5 | } 6 | 7 | pub fn convert_from_float(value: f64, decimals: u8) -> u64 { 8 | value.mul(f64::powf(10.0, decimals as f64)) as u64 9 | } 10 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "types": [ 4 | "mocha", 5 | "chai" 6 | ], 7 | "typeRoots": [ 8 | "./node_modules/@types" 9 | ], 10 | "lib": [ 11 | "es2015" 12 | ], 13 | "module": "commonjs", 14 | "target": "es6", 15 | "esModuleInterop": true, 16 | "resolveJsonModule": true 17 | } 18 | } -------------------------------------------------------------------------------- /cli/programId.ts: -------------------------------------------------------------------------------- 1 | import { PublicKey } from "@solana/web3.js" 2 | 3 | // Program ID defined in the provided IDL. Do not edit, it will get overwritten. 4 | export const PROGRAM_ID_IDL = new PublicKey( 5 | "7wUQXRQtBzTmyp9kcrmok9FKcc4RSYXxPYN9FGDLnqxb" 6 | ) 7 | 8 | // This constant will not get overwritten on subsequent code generations and it's safe to modify it's value. 9 | export const PROGRAM_ID: PublicKey = PROGRAM_ID_IDL 10 | -------------------------------------------------------------------------------- /cli/accounts/index.ts: -------------------------------------------------------------------------------- 1 | export { CurveConfiguration } from "./CurveConfiguration" 2 | export type { 3 | CurveConfigurationFields, 4 | CurveConfigurationJSON, 5 | } from "./CurveConfiguration" 6 | export { LiquidityProvider } from "./LiquidityProvider" 7 | export type { 8 | LiquidityProviderFields, 9 | LiquidityProviderJSON, 10 | } from "./LiquidityProvider" 11 | export { LiquidityPool } from "./LiquidityPool" 12 | export type { LiquidityPoolFields, LiquidityPoolJSON } from "./LiquidityPool" 13 | -------------------------------------------------------------------------------- /Anchor.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | 3 | [features] 4 | seeds = true 5 | skip-lint = false 6 | 7 | [programs.devnet] 8 | pump = "7wUQXRQtBzTmyp9kcrmok9FKcc4RSYXxPYN9FGDLnqxb" 9 | 10 | [registry] 11 | url = "https://devnet.helius-rpc.com/?api-key=39d83ffa-585c-4f90-8636-2f6795db4cb3" 12 | 13 | [provider] 14 | cluster = "Devnet" 15 | wallet = "./id.json" 16 | 17 | [scripts] 18 | test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts" 19 | 20 | [test] 21 | startup_wait = 10000 22 | shutdown_wait = 2000 23 | upgradeable = false 24 | -------------------------------------------------------------------------------- /programs/pump/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "pump" 3 | version = "0.1.0" 4 | description = "Created with Anchor" 5 | edition = "2021" 6 | 7 | [lib] 8 | crate-type = ["cdylib", "lib"] 9 | name = "pump" 10 | 11 | [features] 12 | no-entrypoint = [] 13 | no-idl = [] 14 | no-log-ix-name = [] 15 | cpi = ["no-entrypoint"] 16 | default = [] 17 | 18 | [dependencies] 19 | anchor-lang = { version="0.29.0", features = ["init-if-needed"] } 20 | anchor-spl = "0.29.0" 21 | raydium-contract-instructions = { git = "https://github.com/raydium-io/raydium-contract-instructions.git" } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "scripts": { 3 | "lint:fix": "prettier */*.js \"*/**/*{.js,.ts}\" -w", 4 | "lint": "prettier */*.js \"*/**/*{.js,.ts}\" --check" 5 | }, 6 | "dependencies": { 7 | "@coral-xyz/anchor": "^0.29.0", 8 | "@solana/spl-token": "^0.4.6", 9 | "@solana/web3.js": "^1.91.8" 10 | }, 11 | "devDependencies": { 12 | "@types/bn.js": "^5.1.0", 13 | "@types/chai": "^4.3.0", 14 | "@types/mocha": "^9.0.0", 15 | "chai": "^4.3.4", 16 | "mocha": "^9.0.3", 17 | "prettier": "^2.6.2", 18 | "ts-mocha": "^10.0.0", 19 | "typescript": "^4.3.5" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /cli/instructions/index.ts: -------------------------------------------------------------------------------- 1 | export { initialize } from "./initialize" 2 | export type { InitializeArgs, InitializeAccounts } from "./initialize" 3 | export { addLiquidity } from "./addLiquidity" 4 | export type { AddLiquidityArgs, AddLiquidityAccounts } from "./addLiquidity" 5 | export { removeLiquidity } from "./removeLiquidity" 6 | export type { 7 | RemoveLiquidityArgs, 8 | RemoveLiquidityAccounts, 9 | } from "./removeLiquidity" 10 | export { swap } from "./swap" 11 | export type { SwapArgs, SwapAccounts } from "./swap" 12 | export { createRaydiumPool } from "./createRaydiumPool" 13 | export type { 14 | CreateRaydiumPoolArgs, 15 | CreateRaydiumPoolAccounts, 16 | } from "./createRaydiumPool" 17 | -------------------------------------------------------------------------------- /programs/pump/src/errors.rs: -------------------------------------------------------------------------------- 1 | use anchor_lang::prelude::*; 2 | 3 | #[error_code] 4 | pub enum CustomError { 5 | #[msg("Duplicate tokens are not allowed")] 6 | DuplicateTokenNotAllowed, 7 | 8 | #[msg("Failed to allocate shares")] 9 | FailedToAllocateShares, 10 | 11 | #[msg("Failed to deallocate shares")] 12 | FailedToDeallocateShares, 13 | 14 | #[msg("Insufficient shares")] 15 | InsufficientShares, 16 | 17 | #[msg("Insufficient funds to swap")] 18 | InsufficientFunds, 19 | 20 | #[msg("Invalid amount to swap")] 21 | InvalidAmount, 22 | 23 | #[msg("Invalid fee")] 24 | InvalidFee, 25 | 26 | #[msg("Failed to add liquidity")] 27 | FailedToAddLiquidity, 28 | 29 | #[msg("Failed to remove liquidity")] 30 | FailedToRemoveLiquidity, 31 | 32 | #[msg("Overflow or underflow occured")] 33 | OverflowOrUnderflowOccurred, 34 | } 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Pump.fun Smart Contract 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /programs/pump/src/instructions/remove_liquidity.rs: -------------------------------------------------------------------------------- 1 | use anchor_lang::{prelude::*, solana_program::program::invoke_signed}; 2 | use anchor_spl::{ 3 | associated_token::AssociatedToken, 4 | token::{Mint, Token, TokenAccount}, 5 | }; 6 | 7 | use crate::state::{LiquidityPool, LiquidityPoolAccount, LiquidityProvider}; 8 | use raydium_contract_instructions::amm_instruction; 9 | 10 | pub fn remove_liquidity( 11 | ctx: Context, 12 | nonce: u8, 13 | init_pc_amount: u64, 14 | ) -> Result<()> { 15 | 16 | // If you want to Interact with CPI, then plz contact to me. 17 | 18 | Ok(()) 19 | } 20 | 21 | #[derive(Accounts)] 22 | pub struct RemoveLiquidity<'info> { 23 | #[account( 24 | mut, 25 | seeds = [LiquidityPool::POOL_SEED_PREFIX.as_bytes(), coin_mint.key().as_ref()], 26 | bump = pool.bump 27 | )] 28 | pub pool: Box>, 29 | 30 | /// CHECK 31 | #[account( 32 | mut, 33 | seeds = [b"global"], 34 | bump, 35 | )] 36 | pub global_account: AccountInfo<'info>, 37 | 38 | /// CHECK: Safe - CPI accounts 39 | 40 | } 41 | -------------------------------------------------------------------------------- /programs/pump/src/instructions/initialize.rs: -------------------------------------------------------------------------------- 1 | use crate::{errors::CustomError, state::*}; 2 | use anchor_lang::prelude::*; 3 | 4 | pub fn initialize( 5 | ctx: Context, 6 | fees: f64, 7 | ) -> Result<()> { 8 | let dex_config = &mut ctx.accounts.dex_configuration_account; 9 | 10 | if fees < 0_f64 || fees > 100_f64 { 11 | return err!(CustomError::InvalidFee); 12 | } 13 | 14 | let _ = transfer_sol_to_pool( 15 | ctx.accounts.admin.to_account_info(), 16 | ctx.accounts.global_account.to_account_info(), 17 | 10000000, 18 | ctx.accounts.system_program.to_account_info() 19 | 20 | ); 21 | 22 | dex_config.set_inner(CurveConfiguration::new(fees)); 23 | 24 | Ok(()) 25 | } 26 | 27 | #[derive(Accounts)] 28 | pub struct InitializeCurveConfiguration<'info> { 29 | #[account( 30 | init, 31 | space = CurveConfiguration::ACCOUNT_SIZE, 32 | payer = admin, 33 | seeds = [CurveConfiguration::SEED.as_bytes()], 34 | bump, 35 | )] 36 | pub dex_configuration_account: Box>, 37 | 38 | /// CHECK 39 | #[account( 40 | mut, 41 | seeds = [b"global"], 42 | bump, 43 | )] 44 | pub global_account: AccountInfo<'info>, 45 | 46 | #[account(mut)] 47 | pub admin: Signer<'info>, 48 | pub rent: Sysvar<'info, Rent>, 49 | pub system_program: Program<'info, System>, 50 | } 51 | -------------------------------------------------------------------------------- /programs/pump/src/lib.rs: -------------------------------------------------------------------------------- 1 | use anchor_lang::prelude::*; 2 | 3 | pub mod consts; 4 | pub mod errors; 5 | pub mod instructions; 6 | pub mod state; 7 | pub mod utils; 8 | 9 | use crate::instructions::*; 10 | 11 | declare_id!("7wUQXRQtBzTmyp9kcrmok9FKcc4RSYXxPYN9FGDLnqxb"); 12 | 13 | #[program] 14 | pub mod pump { 15 | use super::*; 16 | 17 | pub fn initialize(ctx: Context, fee: f64) -> Result<()> { 18 | instructions::initialize(ctx, fee) 19 | } 20 | 21 | // pub fn create_pool(ctx: Context) -> Result<()> { 22 | // instructions::create_pool(ctx) 23 | // } 24 | 25 | pub fn add_liquidity( 26 | ctx: Context, 27 | amount_one: u64, 28 | amount_two: u64, 29 | ) -> Result<()> { 30 | instructions::add_liquidity(ctx, amount_one, amount_two) 31 | } 32 | 33 | pub fn remove_liquidity( 34 | ctx: Context, 35 | nonce: u8, 36 | init_pc_amount: u64, 37 | ) -> Result<()> { 38 | instructions::remove_liquidity(ctx, nonce, init_pc_amount) 39 | } 40 | 41 | pub fn swap(ctx: Context, amount: u64, style: u64) -> Result<()> { 42 | instructions::swap(ctx, amount, style) 43 | } 44 | 45 | pub fn create_raydium_pool( 46 | ctx: Context, 47 | nonce: u8, 48 | init_pc_amount: u64, 49 | init_coin_amount: u64, 50 | ) -> Result<()> { 51 | instructions::create_raydium_pool(ctx, nonce, init_pc_amount, init_coin_amount) 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /cli/errors/index.ts: -------------------------------------------------------------------------------- 1 | import { PublicKey } from "@solana/web3.js" 2 | import { PROGRAM_ID } from "../programId" 3 | import * as anchor from "./anchor" 4 | import * as custom from "./custom" 5 | 6 | export function fromCode( 7 | code: number, 8 | logs?: string[] 9 | ): custom.CustomError | anchor.AnchorError | null { 10 | return code >= 6000 11 | ? custom.fromCode(code, logs) 12 | : anchor.fromCode(code, logs) 13 | } 14 | 15 | function hasOwnProperty( 16 | obj: X, 17 | prop: Y 18 | ): obj is X & Record { 19 | return Object.hasOwnProperty.call(obj, prop) 20 | } 21 | 22 | const errorRe = /Program (\w+) failed: custom program error: (\w+)/ 23 | 24 | export function fromTxError( 25 | err: unknown, 26 | programId: PublicKey = PROGRAM_ID 27 | ): custom.CustomError | anchor.AnchorError | null { 28 | if ( 29 | typeof err !== "object" || 30 | err === null || 31 | !hasOwnProperty(err, "logs") || 32 | !Array.isArray(err.logs) 33 | ) { 34 | return null 35 | } 36 | 37 | let firstMatch: RegExpExecArray | null = null 38 | for (const logLine of err.logs) { 39 | firstMatch = errorRe.exec(logLine) 40 | if (firstMatch !== null) { 41 | break 42 | } 43 | } 44 | 45 | if (firstMatch === null) { 46 | return null 47 | } 48 | 49 | const [programIdRaw, codeRaw] = firstMatch.slice(1) 50 | if (programIdRaw !== programId.toString()) { 51 | return null 52 | } 53 | 54 | let errorCode: number 55 | try { 56 | errorCode = parseInt(codeRaw, 16) 57 | } catch (parseErr) { 58 | return null 59 | } 60 | 61 | return fromCode(errorCode, err.logs) 62 | } 63 | -------------------------------------------------------------------------------- /cli/instructions/initialize.ts: -------------------------------------------------------------------------------- 1 | import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars 2 | import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars 3 | import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars 4 | import { PROGRAM_ID } from "../programId" 5 | 6 | export interface InitializeArgs { 7 | fee: number 8 | } 9 | 10 | export interface InitializeAccounts { 11 | dexConfigurationAccount: PublicKey 12 | /** CHECK */ 13 | globalAccount: PublicKey 14 | admin: PublicKey 15 | rent: PublicKey 16 | systemProgram: PublicKey 17 | } 18 | 19 | export const layout = borsh.struct([borsh.f64("fee")]) 20 | 21 | export function initialize( 22 | args: InitializeArgs, 23 | accounts: InitializeAccounts, 24 | programId: PublicKey = PROGRAM_ID 25 | ) { 26 | const keys: Array = [ 27 | { 28 | pubkey: accounts.dexConfigurationAccount, 29 | isSigner: false, 30 | isWritable: true, 31 | }, 32 | { pubkey: accounts.globalAccount, isSigner: false, isWritable: true }, 33 | { pubkey: accounts.admin, isSigner: true, isWritable: true }, 34 | { pubkey: accounts.rent, isSigner: false, isWritable: false }, 35 | { pubkey: accounts.systemProgram, isSigner: false, isWritable: false }, 36 | ] 37 | const identifier = Buffer.from([175, 175, 109, 31, 13, 152, 155, 237]) 38 | const buffer = Buffer.alloc(1000) 39 | const len = layout.encode( 40 | { 41 | fee: args.fee, 42 | }, 43 | buffer 44 | ) 45 | const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len) 46 | const ix = new TransactionInstruction({ keys, programId, data }) 47 | return ix 48 | } 49 | -------------------------------------------------------------------------------- /cli/accounts/CurveConfiguration.ts: -------------------------------------------------------------------------------- 1 | import { PublicKey, Connection } from "@solana/web3.js" 2 | import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars 3 | import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars 4 | import { PROGRAM_ID } from "../programId" 5 | 6 | export interface CurveConfigurationFields { 7 | fees: number 8 | } 9 | 10 | export interface CurveConfigurationJSON { 11 | fees: number 12 | } 13 | 14 | export class CurveConfiguration { 15 | readonly fees: number 16 | 17 | static readonly discriminator = Buffer.from([ 18 | 225, 242, 252, 198, 63, 77, 56, 255, 19 | ]) 20 | 21 | static readonly layout = borsh.struct([borsh.f64("fees")]) 22 | 23 | constructor(fields: CurveConfigurationFields) { 24 | this.fees = fields.fees 25 | } 26 | 27 | static async fetch( 28 | c: Connection, 29 | address: PublicKey, 30 | programId: PublicKey = PROGRAM_ID 31 | ): Promise { 32 | const info = await c.getAccountInfo(address) 33 | 34 | if (info === null) { 35 | return null 36 | } 37 | if (!info.owner.equals(programId)) { 38 | throw new Error("account doesn't belong to this program") 39 | } 40 | 41 | return this.decode(info.data) 42 | } 43 | 44 | static async fetchMultiple( 45 | c: Connection, 46 | addresses: PublicKey[], 47 | programId: PublicKey = PROGRAM_ID 48 | ): Promise> { 49 | const infos = await c.getMultipleAccountsInfo(addresses) 50 | 51 | return infos.map((info) => { 52 | if (info === null) { 53 | return null 54 | } 55 | if (!info.owner.equals(programId)) { 56 | throw new Error("account doesn't belong to this program") 57 | } 58 | 59 | return this.decode(info.data) 60 | }) 61 | } 62 | 63 | static decode(data: Buffer): CurveConfiguration { 64 | if (!data.slice(0, 8).equals(CurveConfiguration.discriminator)) { 65 | throw new Error("invalid account discriminator") 66 | } 67 | 68 | const dec = CurveConfiguration.layout.decode(data.slice(8)) 69 | 70 | return new CurveConfiguration({ 71 | fees: dec.fees, 72 | }) 73 | } 74 | 75 | toJSON(): CurveConfigurationJSON { 76 | return { 77 | fees: this.fees, 78 | } 79 | } 80 | 81 | static fromJSON(obj: CurveConfigurationJSON): CurveConfiguration { 82 | return new CurveConfiguration({ 83 | fees: obj.fees, 84 | }) 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /cli/instructions/swap.ts: -------------------------------------------------------------------------------- 1 | import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars 2 | import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars 3 | import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars 4 | import { PROGRAM_ID } from "../programId" 5 | 6 | export interface SwapArgs { 7 | amount: BN 8 | style: BN 9 | } 10 | 11 | export interface SwapAccounts { 12 | dexConfigurationAccount: PublicKey 13 | pool: PublicKey 14 | /** CHECK */ 15 | globalAccount: PublicKey 16 | mintTokenOne: PublicKey 17 | poolTokenAccountOne: PublicKey 18 | userTokenAccountOne: PublicKey 19 | user: PublicKey 20 | rent: PublicKey 21 | systemProgram: PublicKey 22 | tokenProgram: PublicKey 23 | associatedTokenProgram: PublicKey 24 | } 25 | 26 | export const layout = borsh.struct([borsh.u64("amount"), borsh.u64("style")]) 27 | 28 | export function swap( 29 | args: SwapArgs, 30 | accounts: SwapAccounts, 31 | programId: PublicKey = PROGRAM_ID 32 | ) { 33 | const keys: Array = [ 34 | { 35 | pubkey: accounts.dexConfigurationAccount, 36 | isSigner: false, 37 | isWritable: true, 38 | }, 39 | { pubkey: accounts.pool, isSigner: false, isWritable: true }, 40 | { pubkey: accounts.globalAccount, isSigner: false, isWritable: true }, 41 | { pubkey: accounts.mintTokenOne, isSigner: false, isWritable: true }, 42 | { pubkey: accounts.poolTokenAccountOne, isSigner: false, isWritable: true }, 43 | { pubkey: accounts.userTokenAccountOne, isSigner: false, isWritable: true }, 44 | { pubkey: accounts.user, isSigner: true, isWritable: true }, 45 | { pubkey: accounts.rent, isSigner: false, isWritable: false }, 46 | { pubkey: accounts.systemProgram, isSigner: false, isWritable: false }, 47 | { pubkey: accounts.tokenProgram, isSigner: false, isWritable: false }, 48 | { 49 | pubkey: accounts.associatedTokenProgram, 50 | isSigner: false, 51 | isWritable: false, 52 | }, 53 | ] 54 | const identifier = Buffer.from([248, 198, 158, 145, 225, 117, 135, 200]) 55 | const buffer = Buffer.alloc(1000) 56 | const len = layout.encode( 57 | { 58 | amount: args.amount, 59 | style: args.style, 60 | }, 61 | buffer 62 | ) 63 | const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len) 64 | const ix = new TransactionInstruction({ keys, programId, data }) 65 | return ix 66 | } 67 | -------------------------------------------------------------------------------- /cli/accounts/LiquidityProvider.ts: -------------------------------------------------------------------------------- 1 | import { PublicKey, Connection } from "@solana/web3.js" 2 | import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars 3 | import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars 4 | import { PROGRAM_ID } from "../programId" 5 | 6 | export interface LiquidityProviderFields { 7 | shares: BN 8 | } 9 | 10 | export interface LiquidityProviderJSON { 11 | shares: string 12 | } 13 | 14 | export class LiquidityProvider { 15 | readonly shares: BN 16 | 17 | static readonly discriminator = Buffer.from([ 18 | 219, 241, 238, 133, 56, 225, 229, 191, 19 | ]) 20 | 21 | static readonly layout = borsh.struct([borsh.u64("shares")]) 22 | 23 | constructor(fields: LiquidityProviderFields) { 24 | this.shares = fields.shares 25 | } 26 | 27 | static async fetch( 28 | c: Connection, 29 | address: PublicKey, 30 | programId: PublicKey = PROGRAM_ID 31 | ): Promise { 32 | const info = await c.getAccountInfo(address) 33 | 34 | if (info === null) { 35 | return null 36 | } 37 | if (!info.owner.equals(programId)) { 38 | throw new Error("account doesn't belong to this program") 39 | } 40 | 41 | return this.decode(info.data) 42 | } 43 | 44 | static async fetchMultiple( 45 | c: Connection, 46 | addresses: PublicKey[], 47 | programId: PublicKey = PROGRAM_ID 48 | ): Promise> { 49 | const infos = await c.getMultipleAccountsInfo(addresses) 50 | 51 | return infos.map((info) => { 52 | if (info === null) { 53 | return null 54 | } 55 | if (!info.owner.equals(programId)) { 56 | throw new Error("account doesn't belong to this program") 57 | } 58 | 59 | return this.decode(info.data) 60 | }) 61 | } 62 | 63 | static decode(data: Buffer): LiquidityProvider { 64 | if (!data.slice(0, 8).equals(LiquidityProvider.discriminator)) { 65 | throw new Error("invalid account discriminator") 66 | } 67 | 68 | const dec = LiquidityProvider.layout.decode(data.slice(8)) 69 | 70 | return new LiquidityProvider({ 71 | shares: dec.shares, 72 | }) 73 | } 74 | 75 | toJSON(): LiquidityProviderJSON { 76 | return { 77 | shares: this.shares.toString(), 78 | } 79 | } 80 | 81 | static fromJSON(obj: LiquidityProviderJSON): LiquidityProvider { 82 | return new LiquidityProvider({ 83 | shares: new BN(obj.shares), 84 | }) 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /cli/instructions/addLiquidity.ts: -------------------------------------------------------------------------------- 1 | import { TransactionInstruction, PublicKey, AccountMeta } from "@solana/web3.js" // eslint-disable-line @typescript-eslint/no-unused-vars 2 | import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars 3 | import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars 4 | import { PROGRAM_ID } from "../programId" 5 | 6 | export interface AddLiquidityArgs { 7 | amountOne: BN 8 | amountTwo: BN 9 | } 10 | 11 | export interface AddLiquidityAccounts { 12 | pool: PublicKey 13 | /** CHECK */ 14 | globalAccount: PublicKey 15 | liquidityProviderAccount: PublicKey 16 | mintTokenOne: PublicKey 17 | poolTokenAccountOne: PublicKey 18 | userTokenAccountOne: PublicKey 19 | user: PublicKey 20 | rent: PublicKey 21 | systemProgram: PublicKey 22 | tokenProgram: PublicKey 23 | associatedTokenProgram: PublicKey 24 | } 25 | 26 | export const layout = borsh.struct([ 27 | borsh.u64("amountOne"), 28 | borsh.u64("amountTwo"), 29 | ]) 30 | 31 | export function addLiquidity( 32 | args: AddLiquidityArgs, 33 | accounts: AddLiquidityAccounts, 34 | programId: PublicKey = PROGRAM_ID 35 | ) { 36 | const keys: Array = [ 37 | { pubkey: accounts.pool, isSigner: false, isWritable: true }, 38 | { pubkey: accounts.globalAccount, isSigner: false, isWritable: true }, 39 | { 40 | pubkey: accounts.liquidityProviderAccount, 41 | isSigner: false, 42 | isWritable: true, 43 | }, 44 | { pubkey: accounts.mintTokenOne, isSigner: false, isWritable: true }, 45 | { pubkey: accounts.poolTokenAccountOne, isSigner: false, isWritable: true }, 46 | { pubkey: accounts.userTokenAccountOne, isSigner: false, isWritable: true }, 47 | { pubkey: accounts.user, isSigner: true, isWritable: true }, 48 | { pubkey: accounts.rent, isSigner: false, isWritable: false }, 49 | { pubkey: accounts.systemProgram, isSigner: false, isWritable: false }, 50 | { pubkey: accounts.tokenProgram, isSigner: false, isWritable: false }, 51 | { 52 | pubkey: accounts.associatedTokenProgram, 53 | isSigner: false, 54 | isWritable: false, 55 | }, 56 | ] 57 | const identifier = Buffer.from([181, 157, 89, 67, 143, 182, 52, 72]) 58 | const buffer = Buffer.alloc(1000) 59 | const len = layout.encode( 60 | { 61 | amountOne: args.amountOne, 62 | amountTwo: args.amountTwo, 63 | }, 64 | buffer 65 | ) 66 | const data = Buffer.concat([identifier, buffer]).slice(0, 8 + len) 67 | const ix = new TransactionInstruction({ keys, programId, data }) 68 | return ix 69 | } 70 | -------------------------------------------------------------------------------- /programs/pump/src/instructions/swap.rs: -------------------------------------------------------------------------------- 1 | use anchor_lang::prelude::*; 2 | use anchor_spl::{ 3 | associated_token::AssociatedToken, 4 | token::{Mint, Token, TokenAccount}, 5 | }; 6 | 7 | use crate::{ 8 | errors::CustomError, 9 | state::{CurveConfiguration, LiquidityPool, LiquidityPoolAccount}, 10 | }; 11 | 12 | pub fn swap(ctx: Context, amount: u64, style: u64) -> Result<()> { 13 | let pool = &mut ctx.accounts.pool; 14 | 15 | let token_one_accounts = ( 16 | &mut *ctx.accounts.mint_token_one.clone(), 17 | &mut *ctx.accounts.pool_token_account_one, 18 | &mut *ctx.accounts.user_token_account_one, 19 | ); 20 | 21 | let token_two_accounts = ( 22 | &mut *ctx.accounts.mint_token_one.clone(), 23 | &mut ctx.accounts.global_account.to_account_info().clone(), 24 | &mut ctx.accounts.user.clone() 25 | ); 26 | 27 | pool.swap( 28 | &*ctx.accounts.dex_configuration_account, 29 | token_one_accounts, 30 | token_two_accounts, 31 | amount, 32 | style, 33 | ctx.bumps.global_account, 34 | &ctx.accounts.user, 35 | &ctx.accounts.token_program, 36 | &ctx.accounts.system_program, 37 | )?; 38 | 39 | Ok(()) 40 | } 41 | 42 | #[derive(Accounts)] 43 | pub struct Swap<'info> { 44 | #[account( 45 | mut, 46 | seeds = [CurveConfiguration::SEED.as_bytes()], 47 | bump, 48 | )] 49 | pub dex_configuration_account: Box>, 50 | 51 | #[account( 52 | mut, 53 | seeds = [LiquidityPool::POOL_SEED_PREFIX.as_bytes(), mint_token_one.key().as_ref()], 54 | bump = pool.bump 55 | )] 56 | pub pool: Box>, 57 | 58 | /// CHECK 59 | #[account( 60 | mut, 61 | seeds = [b"global"], 62 | bump, 63 | )] 64 | pub global_account: AccountInfo<'info>, 65 | 66 | #[account(mut)] 67 | pub mint_token_one: Box>, 68 | 69 | #[account( 70 | mut, 71 | associated_token::mint = mint_token_one, 72 | associated_token::authority = global_account 73 | )] 74 | pub pool_token_account_one: Box>, 75 | 76 | #[account( 77 | mut, 78 | associated_token::mint = mint_token_one, 79 | associated_token::authority = user, 80 | )] 81 | pub user_token_account_one: Box>, 82 | 83 | #[account(mut)] 84 | pub user: Signer<'info>, 85 | pub rent: Sysvar<'info, Rent>, 86 | pub system_program: Program<'info, System>, 87 | pub token_program: Program<'info, Token>, 88 | pub associated_token_program: Program<'info, AssociatedToken>, 89 | } 90 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to the Pump.fun Smart Contract project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 6 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 7 | 8 | ## [Unreleased] 9 | 10 | ### Added 11 | - Enhanced documentation with comprehensive SEO optimization 12 | - Contributing guidelines for better community engagement 13 | - MIT License for open source compliance 14 | - Changelog for version tracking 15 | 16 | ### Changed 17 | - Improved README.md with detailed installation and usage instructions 18 | - Enhanced code documentation and examples 19 | - Better project structure and organization 20 | 21 | ## [1.0.0] - 2024-01-XX 22 | 23 | ### Added 24 | - Initial release of Pump.fun Smart Contract 25 | - Virtual LP management functionality 26 | - Add virtual liquidity pools 27 | - Remove virtual liquidity pools 28 | - Raydium pool creation with CPI calls 29 | - Meteora DEX integration 30 | - EVM compatibility support 31 | - Automated fee management (5% LP creation fee) 32 | - Comprehensive error handling 33 | - TypeScript/JavaScript client support 34 | 35 | ### Features 36 | - **Virtual LP Operations**: Complete virtual liquidity pool management 37 | - **Raydium Integration**: Automated pool creation with cross-program invocation 38 | - **Meteora Support**: Advanced DEX integration for enhanced liquidity 39 | - **EVM Compatibility**: Cross-chain functionality for broader blockchain support 40 | - **Fee Management**: Automated 5% fee collection from reserves 41 | - **Solana Native**: High-performance Solana blockchain implementation 42 | 43 | ### Technical Specifications 44 | - **Framework**: Anchor 0.29.0 45 | - **Language**: Rust 46 | - **Blockchain**: Solana 47 | - **Client Support**: TypeScript/JavaScript 48 | - **Testing**: Comprehensive test suite with Mocha and Chai 49 | 50 | ### Dependencies 51 | - `@coral-xyz/anchor`: ^0.29.0 52 | - `@solana/spl-token`: ^0.4.6 53 | - `@solana/web3.js`: ^1.91.8 54 | 55 | ### Development Tools 56 | - Prettier for code formatting 57 | - TypeScript for type safety 58 | - Mocha and Chai for testing 59 | - Comprehensive linting setup 60 | 61 | ## [0.1.0] - 2024-01-XX 62 | 63 | ### Added 64 | - Basic smart contract structure 65 | - Core LP management functions 66 | - Initial Raydium integration 67 | - Basic error handling 68 | 69 | --- 70 | 71 | ## Version History 72 | 73 | - **v1.0.0**: Production-ready release with full feature set 74 | - **v0.1.0**: Initial development version with basic functionality 75 | 76 | ## Contributing 77 | 78 | To add entries to this changelog, please follow the [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format and include: 79 | 80 | - **Added**: for new features 81 | - **Changed**: for changes in existing functionality 82 | - **Deprecated**: for soon-to-be removed features 83 | - **Removed**: for now removed features 84 | - **Fixed**: for any bug fixes 85 | - **Security**: in case of vulnerabilities 86 | 87 | ## Links 88 | 89 | - [GitHub Repository](https://github.com/Tronzit-Veca/Pumpfun-Smart-Contract) 90 | - [Documentation](https://github.com/Tronzit-Veca/Pumpfun-Smart-Contract#readme) 91 | - [Issues](https://github.com/Tronzit-Veca/Pumpfun-Smart-Contract/issues) 92 | - [Releases](https://github.com/Tronzit-Veca/Pumpfun-Smart-Contract/releases) -------------------------------------------------------------------------------- /programs/pump/src/instructions/add_liquidity.rs: -------------------------------------------------------------------------------- 1 | use anchor_lang::prelude::*; 2 | use anchor_spl::{ 3 | associated_token::AssociatedToken, 4 | token::{Mint, Token, TokenAccount}, 5 | }; 6 | 7 | use crate::{ 8 | state::{LiquidityPool, LiquidityPoolAccount, LiquidityProvider}, 9 | }; 10 | 11 | pub fn add_liquidity(ctx: Context, amount_one: u64, amount_two: u64) -> Result<()> { 12 | let pool = &mut ctx.accounts.pool; 13 | 14 | let token_one_accounts = ( 15 | &mut *ctx.accounts.mint_token_one.clone(), 16 | &mut *ctx.accounts.pool_token_account_one, 17 | &mut *ctx.accounts.user_token_account_one, 18 | ); 19 | 20 | let token_two_accounts = ( 21 | &mut *ctx.accounts.mint_token_one.clone(), 22 | &mut ctx.accounts.global_account.to_account_info(), 23 | &mut ctx.accounts.user.to_account_info().clone(), 24 | ); 25 | 26 | pool.set_inner(LiquidityPool::new( 27 | ctx.accounts.mint_token_one.key(), 28 | ctx.bumps.pool, 29 | )); 30 | 31 | pool.add_liquidity( 32 | token_one_accounts, 33 | token_two_accounts, 34 | amount_one, 35 | amount_two, 36 | &mut *ctx.accounts.liquidity_provider_account, 37 | &ctx.accounts.user, 38 | &ctx.accounts.token_program, 39 | )?; 40 | 41 | Ok(()) 42 | } 43 | 44 | #[derive(Accounts)] 45 | pub struct AddLiquidity<'info> { 46 | #[account( 47 | init, 48 | space = LiquidityPool::ACCOUNT_SIZE, 49 | payer = user, 50 | seeds = [LiquidityPool::POOL_SEED_PREFIX.as_bytes(), mint_token_one.key().as_ref()], 51 | bump 52 | )] 53 | pub pool: Box>, 54 | 55 | /// CHECK 56 | #[account( 57 | mut, 58 | seeds = [b"global"], 59 | bump, 60 | )] 61 | pub global_account: AccountInfo<'info>, 62 | 63 | #[account( 64 | init_if_needed, 65 | payer = user, 66 | space = LiquidityProvider::ACCOUNT_SIZE, 67 | seeds = [LiquidityProvider::SEED_PREFIX.as_bytes(), pool.key().as_ref(), user.key().as_ref()], 68 | bump, 69 | )] 70 | pub liquidity_provider_account: Box>, 71 | 72 | #[account(mut)] 73 | pub mint_token_one: Box>, 74 | 75 | #[account( 76 | init, 77 | payer = user, 78 | associated_token::mint = mint_token_one, 79 | associated_token::authority = global_account 80 | )] 81 | pub pool_token_account_one: Box>, 82 | 83 | // #[account( 84 | // mut, 85 | // associated_token::mint = mint_token_two, 86 | // associated_token::authority = pool 87 | // )] 88 | // pub pool_token_account_two: Box>, 89 | 90 | #[account( 91 | mut, 92 | associated_token::mint = mint_token_one, 93 | associated_token::authority = user, 94 | )] 95 | pub user_token_account_one: Box>, 96 | 97 | // #[account( 98 | // mut, 99 | // associated_token::mint = mint_token_two, 100 | // associated_token::authority = user, 101 | // )] 102 | // pub user_token_account_two: Box>, 103 | 104 | #[account(mut)] 105 | pub user: Signer<'info>, 106 | pub rent: Sysvar<'info, Rent>, 107 | pub system_program: Program<'info, System>, 108 | pub token_program: Program<'info, Token>, 109 | pub associated_token_program: Program<'info, AssociatedToken>, 110 | } 111 | -------------------------------------------------------------------------------- /cli/accounts/LiquidityPool.ts: -------------------------------------------------------------------------------- 1 | import { PublicKey, Connection } from "@solana/web3.js" 2 | import BN from "bn.js" // eslint-disable-line @typescript-eslint/no-unused-vars 3 | import * as borsh from "@coral-xyz/borsh" // eslint-disable-line @typescript-eslint/no-unused-vars 4 | import { PROGRAM_ID } from "../programId" 5 | 6 | export interface LiquidityPoolFields { 7 | tokenOne: PublicKey 8 | tokenTwo: PublicKey 9 | totalSupply: BN 10 | reserveOne: BN 11 | reserveTwo: BN 12 | bump: number 13 | } 14 | 15 | export interface LiquidityPoolJSON { 16 | tokenOne: string 17 | tokenTwo: string 18 | totalSupply: string 19 | reserveOne: string 20 | reserveTwo: string 21 | bump: number 22 | } 23 | 24 | export class LiquidityPool { 25 | readonly tokenOne: PublicKey 26 | readonly tokenTwo: PublicKey 27 | readonly totalSupply: BN 28 | readonly reserveOne: BN 29 | readonly reserveTwo: BN 30 | readonly bump: number 31 | 32 | static readonly discriminator = Buffer.from([ 33 | 66, 38, 17, 64, 188, 80, 68, 129, 34 | ]) 35 | 36 | static readonly layout = borsh.struct([ 37 | borsh.publicKey("tokenOne"), 38 | borsh.publicKey("tokenTwo"), 39 | borsh.u64("totalSupply"), 40 | borsh.u64("reserveOne"), 41 | borsh.u64("reserveTwo"), 42 | borsh.u8("bump"), 43 | ]) 44 | 45 | constructor(fields: LiquidityPoolFields) { 46 | this.tokenOne = fields.tokenOne 47 | this.tokenTwo = fields.tokenTwo 48 | this.totalSupply = fields.totalSupply 49 | this.reserveOne = fields.reserveOne 50 | this.reserveTwo = fields.reserveTwo 51 | this.bump = fields.bump 52 | } 53 | 54 | static async fetch( 55 | c: Connection, 56 | address: PublicKey, 57 | programId: PublicKey = PROGRAM_ID 58 | ): Promise { 59 | const info = await c.getAccountInfo(address) 60 | 61 | if (info === null) { 62 | return null 63 | } 64 | if (!info.owner.equals(programId)) { 65 | throw new Error("account doesn't belong to this program") 66 | } 67 | 68 | return this.decode(info.data) 69 | } 70 | 71 | static async fetchMultiple( 72 | c: Connection, 73 | addresses: PublicKey[], 74 | programId: PublicKey = PROGRAM_ID 75 | ): Promise> { 76 | const infos = await c.getMultipleAccountsInfo(addresses) 77 | 78 | return infos.map((info) => { 79 | if (info === null) { 80 | return null 81 | } 82 | if (!info.owner.equals(programId)) { 83 | throw new Error("account doesn't belong to this program") 84 | } 85 | 86 | return this.decode(info.data) 87 | }) 88 | } 89 | 90 | static decode(data: Buffer): LiquidityPool { 91 | if (!data.slice(0, 8).equals(LiquidityPool.discriminator)) { 92 | throw new Error("invalid account discriminator") 93 | } 94 | 95 | const dec = LiquidityPool.layout.decode(data.slice(8)) 96 | 97 | return new LiquidityPool({ 98 | tokenOne: dec.tokenOne, 99 | tokenTwo: dec.tokenTwo, 100 | totalSupply: dec.totalSupply, 101 | reserveOne: dec.reserveOne, 102 | reserveTwo: dec.reserveTwo, 103 | bump: dec.bump, 104 | }) 105 | } 106 | 107 | toJSON(): LiquidityPoolJSON { 108 | return { 109 | tokenOne: this.tokenOne.toString(), 110 | tokenTwo: this.tokenTwo.toString(), 111 | totalSupply: this.totalSupply.toString(), 112 | reserveOne: this.reserveOne.toString(), 113 | reserveTwo: this.reserveTwo.toString(), 114 | bump: this.bump, 115 | } 116 | } 117 | 118 | static fromJSON(obj: LiquidityPoolJSON): LiquidityPool { 119 | return new LiquidityPool({ 120 | tokenOne: new PublicKey(obj.tokenOne), 121 | tokenTwo: new PublicKey(obj.tokenTwo), 122 | totalSupply: new BN(obj.totalSupply), 123 | reserveOne: new BN(obj.reserveOne), 124 | reserveTwo: new BN(obj.reserveTwo), 125 | bump: obj.bump, 126 | }) 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /cli/errors/custom.ts: -------------------------------------------------------------------------------- 1 | export type CustomError = 2 | | DuplicateTokenNotAllowed 3 | | FailedToAllocateShares 4 | | FailedToDeallocateShares 5 | | InsufficientShares 6 | | InsufficientFunds 7 | | InvalidAmount 8 | | InvalidFee 9 | | FailedToAddLiquidity 10 | | FailedToRemoveLiquidity 11 | | OverflowOrUnderflowOccurred 12 | 13 | export class DuplicateTokenNotAllowed extends Error { 14 | static readonly code = 6000 15 | readonly code = 6000 16 | readonly name = "DuplicateTokenNotAllowed" 17 | readonly msg = "Duplicate tokens are not allowed" 18 | 19 | constructor(readonly logs?: string[]) { 20 | super("6000: Duplicate tokens are not allowed") 21 | } 22 | } 23 | 24 | export class FailedToAllocateShares extends Error { 25 | static readonly code = 6001 26 | readonly code = 6001 27 | readonly name = "FailedToAllocateShares" 28 | readonly msg = "Failed to allocate shares" 29 | 30 | constructor(readonly logs?: string[]) { 31 | super("6001: Failed to allocate shares") 32 | } 33 | } 34 | 35 | export class FailedToDeallocateShares extends Error { 36 | static readonly code = 6002 37 | readonly code = 6002 38 | readonly name = "FailedToDeallocateShares" 39 | readonly msg = "Failed to deallocate shares" 40 | 41 | constructor(readonly logs?: string[]) { 42 | super("6002: Failed to deallocate shares") 43 | } 44 | } 45 | 46 | export class InsufficientShares extends Error { 47 | static readonly code = 6003 48 | readonly code = 6003 49 | readonly name = "InsufficientShares" 50 | readonly msg = "Insufficient shares" 51 | 52 | constructor(readonly logs?: string[]) { 53 | super("6003: Insufficient shares") 54 | } 55 | } 56 | 57 | export class InsufficientFunds extends Error { 58 | static readonly code = 6004 59 | readonly code = 6004 60 | readonly name = "InsufficientFunds" 61 | readonly msg = "Insufficient funds to swap" 62 | 63 | constructor(readonly logs?: string[]) { 64 | super("6004: Insufficient funds to swap") 65 | } 66 | } 67 | 68 | export class InvalidAmount extends Error { 69 | static readonly code = 6005 70 | readonly code = 6005 71 | readonly name = "InvalidAmount" 72 | readonly msg = "Invalid amount to swap" 73 | 74 | constructor(readonly logs?: string[]) { 75 | super("6005: Invalid amount to swap") 76 | } 77 | } 78 | 79 | export class InvalidFee extends Error { 80 | static readonly code = 6006 81 | readonly code = 6006 82 | readonly name = "InvalidFee" 83 | readonly msg = "Invalid fee" 84 | 85 | constructor(readonly logs?: string[]) { 86 | super("6006: Invalid fee") 87 | } 88 | } 89 | 90 | export class FailedToAddLiquidity extends Error { 91 | static readonly code = 6007 92 | readonly code = 6007 93 | readonly name = "FailedToAddLiquidity" 94 | readonly msg = "Failed to add liquidity" 95 | 96 | constructor(readonly logs?: string[]) { 97 | super("6007: Failed to add liquidity") 98 | } 99 | } 100 | 101 | export class FailedToRemoveLiquidity extends Error { 102 | static readonly code = 6008 103 | readonly code = 6008 104 | readonly name = "FailedToRemoveLiquidity" 105 | readonly msg = "Failed to remove liquidity" 106 | 107 | constructor(readonly logs?: string[]) { 108 | super("6008: Failed to remove liquidity") 109 | } 110 | } 111 | 112 | export class OverflowOrUnderflowOccurred extends Error { 113 | static readonly code = 6009 114 | readonly code = 6009 115 | readonly name = "OverflowOrUnderflowOccurred" 116 | readonly msg = "Overflow or underflow occured" 117 | 118 | constructor(readonly logs?: string[]) { 119 | super("6009: Overflow or underflow occured") 120 | } 121 | } 122 | 123 | export function fromCode(code: number, logs?: string[]): CustomError | null { 124 | switch (code) { 125 | case 6000: 126 | return new DuplicateTokenNotAllowed(logs) 127 | case 6001: 128 | return new FailedToAllocateShares(logs) 129 | case 6002: 130 | return new FailedToDeallocateShares(logs) 131 | case 6003: 132 | return new InsufficientShares(logs) 133 | case 6004: 134 | return new InsufficientFunds(logs) 135 | case 6005: 136 | return new InvalidAmount(logs) 137 | case 6006: 138 | return new InvalidFee(logs) 139 | case 6007: 140 | return new FailedToAddLiquidity(logs) 141 | case 6008: 142 | return new FailedToRemoveLiquidity(logs) 143 | case 6009: 144 | return new OverflowOrUnderflowOccurred(logs) 145 | } 146 | 147 | return null 148 | } 149 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Pump.fun Smart Contract 2 | 3 | Thank you for your interest in contributing to the Pump.fun Smart Contract! This document provides guidelines and information for contributors. 4 | 5 | ## 🚀 Getting Started 6 | 7 | ### Prerequisites 8 | 9 | - Rust 1.70+ 10 | - Solana CLI 1.91.8+ 11 | - Anchor Framework 0.29.0+ 12 | - Node.js 16+ 13 | - Git 14 | 15 | ### Development Setup 16 | 17 | 1. **Fork the repository** 18 | ```bash 19 | git clone https://github.com/Tronzit-Veca/Pumpfun-Smart-Contract.git 20 | cd pumpfun-smart-contract 21 | ``` 22 | 23 | 2. **Install dependencies** 24 | ```bash 25 | npm install 26 | ``` 27 | 28 | 3. **Build the project** 29 | ```bash 30 | anchor build 31 | ``` 32 | 33 | 4. **Run tests** 34 | ```bash 35 | anchor test 36 | ``` 37 | 38 | ## 📝 Code Style Guidelines 39 | 40 | ### Rust Code Style 41 | 42 | - Follow Rust standard formatting with `rustfmt` 43 | - Use meaningful variable and function names 44 | - Add comprehensive comments for complex logic 45 | - Implement proper error handling 46 | 47 | ### TypeScript/JavaScript Code Style 48 | 49 | - Use Prettier for code formatting 50 | - Follow ESLint rules 51 | - Use TypeScript for type safety 52 | - Write clear function documentation 53 | 54 | ## 🧪 Testing 55 | 56 | ### Running Tests 57 | 58 | ```bash 59 | # Run all tests 60 | anchor test 61 | 62 | # Run specific test file 63 | anchor test tests/specific_test.ts 64 | 65 | # Run with verbose output 66 | anchor test --verbose 67 | ``` 68 | 69 | ### Writing Tests 70 | 71 | - Write tests for all new functionality 72 | - Include both positive and negative test cases 73 | - Test edge cases and error conditions 74 | - Use descriptive test names 75 | 76 | ## 🔧 Development Workflow 77 | 78 | ### 1. Create a Feature Branch 79 | 80 | ```bash 81 | git checkout -b feature/your-feature-name 82 | ``` 83 | 84 | ### 2. Make Your Changes 85 | 86 | - Write clean, well-documented code 87 | - Add tests for new functionality 88 | - Update documentation as needed 89 | 90 | ### 3. Commit Your Changes 91 | 92 | ```bash 93 | git add . 94 | git commit -m "feat: add virtual LP management functionality 95 | 96 | - Implement add_virtual_lp instruction 97 | - Add comprehensive error handling 98 | - Include unit tests for new features" 99 | ``` 100 | 101 | ### 4. Push and Create Pull Request 102 | 103 | ```bash 104 | git push origin feature/your-feature-name 105 | ``` 106 | 107 | ## 📋 Pull Request Guidelines 108 | 109 | ### Before Submitting 110 | 111 | - [ ] Code follows style guidelines 112 | - [ ] All tests pass 113 | - [ ] Documentation is updated 114 | - [ ] No breaking changes (unless discussed) 115 | - [ ] Commit messages are clear and descriptive 116 | 117 | ### Pull Request Template 118 | 119 | ```markdown 120 | ## Description 121 | Brief description of changes 122 | 123 | ## Type of Change 124 | - [ ] Bug fix 125 | - [ ] New feature 126 | - [ ] Breaking change 127 | - [ ] Documentation update 128 | 129 | ## Testing 130 | - [ ] Unit tests added/updated 131 | - [ ] Integration tests pass 132 | - [ ] Manual testing completed 133 | 134 | ## Checklist 135 | - [ ] Code follows style guidelines 136 | - [ ] Self-review completed 137 | - [ ] Documentation updated 138 | - [ ] No console errors 139 | ``` 140 | 141 | ## 🐛 Reporting Bugs 142 | 143 | ### Bug Report Template 144 | 145 | ```markdown 146 | ## Bug Description 147 | Clear description of the bug 148 | 149 | ## Steps to Reproduce 150 | 1. Step 1 151 | 2. Step 2 152 | 3. Step 3 153 | 154 | ## Expected Behavior 155 | What should happen 156 | 157 | ## Actual Behavior 158 | What actually happens 159 | 160 | ## Environment 161 | - OS: [e.g., Windows 10] 162 | - Rust Version: [e.g., 1.70.0] 163 | - Solana CLI Version: [e.g., 1.91.8] 164 | - Anchor Version: [e.g., 0.29.0] 165 | 166 | ## Additional Information 167 | Any other relevant information 168 | ``` 169 | 170 | ## 💡 Feature Requests 171 | 172 | ### Feature Request Template 173 | 174 | ```markdown 175 | ## Feature Description 176 | Clear description of the requested feature 177 | 178 | ## Use Case 179 | Why this feature is needed 180 | 181 | ## Proposed Implementation 182 | Brief description of how it could be implemented 183 | 184 | ## Alternatives Considered 185 | Other approaches that were considered 186 | ``` 187 | 188 | ## 📚 Documentation 189 | 190 | ### Contributing to Documentation 191 | 192 | - Keep documentation up-to-date with code changes 193 | - Use clear, concise language 194 | - Include code examples where appropriate 195 | - Add diagrams for complex concepts 196 | 197 | ### Documentation Standards 198 | 199 | - Use proper markdown formatting 200 | - Include table of contents for long documents 201 | - Add links to related resources 202 | - Keep examples simple and working 203 | 204 | ## 🔒 Security 205 | 206 | ### Security Guidelines 207 | 208 | - Never commit sensitive information (keys, passwords) 209 | - Report security vulnerabilities privately 210 | - Follow secure coding practices 211 | - Validate all inputs 212 | 213 | ### Reporting Security Issues 214 | 215 | For security issues, please contact us privately: 216 | - Email: security@pump.fun 217 | - Telegram: [@Tr1030109](https://t.me/Tr1030109) 218 | 219 | ## 🏆 Recognition 220 | 221 | Contributors will be recognized in: 222 | - Project README 223 | - Release notes 224 | - Contributor hall of fame 225 | 226 | ## 📞 Getting Help 227 | 228 | - **GitHub Issues**: [Create an issue](https://github.com/Tronzit-Veca/Pumpfun-Smart-Contract/issues) 229 | - **Telegram**: [@Tr1030109](https://t.me/Tr1030109) 230 | - **Discord**: 0xapp123 231 | 232 | ## 📄 License 233 | 234 | By contributing to this project, you agree that your contributions will be licensed under the MIT License. 235 | 236 | --- 237 | 238 | Thank you for contributing to the Pump.fun Smart Contract! 🚀 -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | Use this section to tell people about which versions of your project are currently being supported with security updates. 6 | 7 | | Version | Supported | 8 | | ------- | ------------------ | 9 | | 1.0.x | :white_check_mark: | 10 | | 0.9.x | :white_check_mark: | 11 | | 0.8.x | :x: | 12 | | < 0.8 | :x: | 13 | 14 | ## Reporting a Vulnerability 15 | 16 | We take security vulnerabilities seriously. If you discover a security vulnerability in the Pump.fun Smart Contract, please follow these steps: 17 | 18 | ### 1. **DO NOT** create a public GitHub issue 19 | 20 | Security vulnerabilities should be reported privately to prevent potential exploitation. 21 | 22 | ### 2. Contact the Security Team 23 | 24 | Please report security vulnerabilities to our security team through one of these channels: 25 | 26 | - **Email**: eros1030109@gmail.com 27 | - **Telegram**: [@Tr1030109](https://t.me/Tr1030109) (DM only) 28 | - **Discord**: 0xapp123 (DM only) 29 | 30 | ### 3. Provide Detailed Information 31 | 32 | When reporting a vulnerability, please include: 33 | 34 | - **Description**: Clear description of the vulnerability 35 | - **Steps to Reproduce**: Detailed steps to reproduce the issue 36 | - **Impact**: Potential impact of the vulnerability 37 | - **Suggested Fix**: If you have suggestions for fixing the issue 38 | - **Proof of Concept**: If applicable, provide a proof of concept 39 | - **Environment**: Details about the environment where the issue was found 40 | 41 | ### 4. Response Timeline 42 | 43 | - **Initial Response**: Within 24 hours 44 | - **Assessment**: Within 3-5 business days 45 | - **Fix Timeline**: Depends on severity (1-30 days) 46 | - **Public Disclosure**: After fix is deployed and tested 47 | 48 | ## Security Best Practices 49 | 50 | ### For Developers 51 | 52 | 1. **Input Validation**: Always validate and sanitize inputs 53 | 2. **Authorization**: Implement proper access controls 54 | 3. **Error Handling**: Don't expose sensitive information in error messages 55 | 4. **Dependencies**: Keep dependencies updated 56 | 5. **Code Review**: Perform security-focused code reviews 57 | 58 | ### For Users 59 | 60 | 1. **Private Keys**: Never share private keys or seed phrases 61 | 2. **Verification**: Always verify transaction details before signing 62 | 3. **Updates**: Keep your software updated 63 | 4. **Phishing**: Be aware of phishing attempts 64 | 5. **Backup**: Maintain secure backups of important data 65 | 66 | ## Security Features 67 | 68 | ### Smart Contract Security 69 | 70 | - **Reentrancy Protection**: Implemented to prevent reentrancy attacks 71 | - **Access Control**: Proper authorization checks for all operations 72 | - **Input Validation**: Comprehensive input validation and sanitization 73 | - **Error Handling**: Secure error handling without information leakage 74 | - **Rate Limiting**: Protection against spam and abuse 75 | 76 | ### Network Security 77 | 78 | - **TLS/SSL**: All communications use secure protocols 79 | - **API Rate Limiting**: Protection against API abuse 80 | - **Input Sanitization**: All inputs are validated and sanitized 81 | - **Audit Logging**: Comprehensive logging for security monitoring 82 | 83 | ## Security Audits 84 | 85 | ### Completed Audits 86 | 87 | - **Internal Security Review**: Completed 88 | - **Code Quality Analysis**: Completed 89 | - **Dependency Security Scan**: Completed 90 | 91 | ### Upcoming Audits 92 | 93 | - **External Security Audit**: Planned 94 | - **Penetration Testing**: Planned 95 | - **Formal Verification**: Planned 96 | 97 | ## Bug Bounty Program 98 | 99 | We offer a bug bounty program for security researchers who find and report vulnerabilities: 100 | 101 | ### Bounty Tiers 102 | 103 | - **Critical**: $1,000 - $5,000 104 | - **High**: $500 - $1,000 105 | - **Medium**: $100 - $500 106 | - **Low**: $50 - $100 107 | 108 | ### Eligibility 109 | 110 | - First to report the vulnerability 111 | - Valid and reproducible vulnerability 112 | - Not previously known to us 113 | - Responsible disclosure 114 | 115 | ### Payment 116 | 117 | - Payment in cryptocurrency (SOL, USDC, or USDT) 118 | - Payment within 30 days of fix deployment 119 | - Public recognition (optional) 120 | 121 | ## Responsible Disclosure 122 | 123 | We follow responsible disclosure practices: 124 | 125 | 1. **Private Reporting**: Vulnerabilities reported privately 126 | 2. **Timely Response**: Quick response to security reports 127 | 3. **Fix Development**: Prompt development of fixes 128 | 4. **Testing**: Thorough testing of security fixes 129 | 5. **Deployment**: Secure deployment of fixes 130 | 6. **Disclosure**: Public disclosure after fix deployment 131 | 132 | ## Security Updates 133 | 134 | ### How to Update 135 | 136 | ```bash 137 | # Update dependencies 138 | npm update 139 | cargo update 140 | 141 | # Check for security vulnerabilities 142 | npm audit 143 | cargo audit 144 | 145 | # Update to latest version 146 | git pull origin main 147 | npm install 148 | anchor build 149 | ``` 150 | 151 | ### Security Notifications 152 | 153 | - **GitHub Security Advisories**: Subscribe to security advisories 154 | - **Email Notifications**: Subscribe to security mailing list 155 | - **Social Media**: Follow for security announcements 156 | 157 | ## Contact Information 158 | 159 | ### Security Team 160 | 161 | - **Email**: eros1030109@gmail.com 162 | - **Telegram**: [@Tr1030109](https://t.me/Tr1030109) 163 | - **Discord**: 0xapp123 164 | 165 | ### Emergency Contacts 166 | 167 | For urgent security issues outside business hours: 168 | - **Emergency Email**: eros1030109@gmail.com 169 | - **Emergency Telegram**: [@Tr1030109](https://t.me/Tr1030109) 170 | 171 | ## Legal 172 | 173 | By reporting security vulnerabilities, you agree to: 174 | 175 | 1. Keep the vulnerability confidential until public disclosure 176 | 2. Not exploit the vulnerability for malicious purposes 177 | 3. Provide reasonable assistance in fixing the issue 178 | 4. Follow responsible disclosure practices 179 | 180 | --- 181 | 182 | **Last Updated**: January 2024 183 | **Version**: 1.0.0 -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Pump.fun: Solana Smart Contract on GitHub 2 | 3 | Welcome to the official Raydium LP Migrating **Pump.fun** smart contract repository on **GitHub**! 4 | This project is a cutting-edge **Solana** smart contract powering the Pump.fun DeFi platform. 5 | If you’re looking for the best example of a **Solana** “pump” project on **GitHub**, you’re in the right place. 6 | 7 | ## Why Pump.fun is the Best Solana Pump Project on GitHub 8 | 9 | Pump.fun is designed for the Solana blockchain, enabling fun and innovative DeFi experiences. 10 | Whether you want to create, manage, or interact with liquidity pools, this GitHub repo is your go-to resource for Solana pump projects. 11 | 12 | 13 | ## 📞 Support 14 | 15 | - **Telegram**: [@Tr1030109](https://t.me/Tr1030109) 16 | - **Discord**: 0xapp123 17 | - **GitHub Issues**: [Create an issue](https://github.com/Tronzit-Veca/Pumpfun-Smart-Contract/issues) 18 | 19 | ## 🚀 Features 20 | 21 | - **Virtual LP Management**: Add and remove virtual liquidity pools 22 | - **Raydium Pool Creation**: Automated Raydium pool creation with CPI calls 23 | - **Meteora Integration**: Advanced DEX integration for enhanced liquidity 24 | - **EVM Compatibility**: Cross-chain functionality support 25 | - **Automated Fee Management**: 5% LP creation fee from reserves 26 | - **Solana Native**: Built on Solana blockchain for high performance 27 | 28 | ## 📋 Table of Contents 29 | 30 | - [Installation](#installation) 31 | - [Usage](#usage) 32 | - [Architecture](#architecture) 33 | - [API Reference](#api-reference) 34 | - [Examples](#examples) 35 | - [Contributing](#contributing) 36 | - [License](#license) 37 | 38 | ## 🛠️ Installation 39 | 40 | ### Prerequisites 41 | 42 | - Rust 1.70+ 43 | - Solana CLI 1.91.8+ 44 | - Anchor Framework 0.29.0+ 45 | 46 | ### Setup 47 | 48 | ```bash 49 | # Clone the repository 50 | git clone https://github.com/Tronzit-Veca/Pumpfun-Smart-Contract.git 51 | cd pumpfun-smart-contract 52 | 53 | # Install dependencies 54 | npm install 55 | 56 | # Build the program 57 | anchor build 58 | 59 | # Deploy to devnet 60 | anchor deploy --provider.cluster devnet 61 | ``` 62 | 63 | ## 📖 Usage 64 | 65 | ### Basic LP Operations 66 | 67 | ```typescript 68 | import { Connection, PublicKey } from '@solana/web3.js'; 69 | import { Program } from '@coral-xyz/anchor'; 70 | 71 | // Initialize connection 72 | const connection = new Connection('https://api.devnet.solana.com'); 73 | 74 | // Add virtual LP 75 | await program.methods 76 | .addVirtualLp(amount, tokenMint) 77 | .accounts({ 78 | user: wallet.publicKey, 79 | pool: poolAddress, 80 | }) 81 | .rpc(); 82 | 83 | // Remove virtual LP 84 | await program.methods 85 | .removeVirtualLp(amount, tokenMint) 86 | .accounts({ 87 | user: wallet.publicKey, 88 | pool: poolAddress, 89 | }) 90 | .rpc(); 91 | ``` 92 | 93 | ### Raydium Pool Creation 94 | 95 | ```typescript 96 | // Create Raydium pool with CPI calls 97 | await program.methods 98 | .createRaydiumPool( 99 | tokenAMint, 100 | tokenBMint, 101 | initialLiquidity 102 | ) 103 | .accounts({ 104 | authority: wallet.publicKey, 105 | raydiumProgram: raydiumProgramId, 106 | }) 107 | .rpc(); 108 | ``` 109 | 110 | ## 🏗️ Architecture 111 | 112 | The smart contract is built using the Anchor framework and consists of: 113 | 114 | - **State Management**: Comprehensive state structures for LP pools 115 | - **Instruction Modules**: Modular instruction handlers for different operations 116 | - **Error Handling**: Custom error types for better debugging 117 | - **Constants**: Centralized configuration management 118 | 119 | ### Key Components 120 | 121 | - `state.rs`: Core state structures and account definitions 122 | - `instructions/`: Modular instruction handlers 123 | - `utils/`: Utility functions and helpers 124 | - `errors.rs`: Custom error definitions 125 | - `consts.rs`: Configuration constants 126 | 127 | ## 📚 API Reference 128 | 129 | ### Core Functions 130 | 131 | | Function | Description | Parameters | 132 | |----------|-------------|------------| 133 | | `add_virtual_lp` | Add virtual liquidity to pool | `amount`, `token_mint` | 134 | | `remove_virtual_lp` | Remove virtual liquidity from pool | `amount`, `token_mint` | 135 | | `create_raydium_pool` | Create new Raydium pool | `token_a`, `token_b`, `liquidity` | 136 | | `update_pool_fees` | Update pool fee configuration | `new_fee_rate` | 137 | 138 | ## 🔍 Examples 139 | 140 | ### Transaction Examples 141 | 142 | Check out these real transactions on Solana Explorer: 143 | 144 | - **Remove Virtual LP**: [Transaction Link](https://explorer.solana.com/tx/4L6MWmtV1ZsT8NFfbtu68ZYyYVbpvZ4iynJhPdZw8jESi28TxwojjTFs88Q5QRdNUb297aWfkKcoYP9Ya8npx8AV?cluster=devnet) 145 | - **Create Raydium Pool**: [Transaction Link](https://explorer.solana.com/tx/4L6MWmtV1ZsT8NFfbtu68ZYyYVbpvZ4iynJhPdZw8jESi28TxwojjTFs88Q5QRdNUb297aWfkKcoYP9Ya8npx8AV?cluster=devnet) 146 | 147 | ### Fee Structure 148 | 149 | The contract implements a 5% LP creation fee calculated from reserves: 150 | 151 | ```rust 152 | pub const LP_CREATION_FEE_RATE: u64 = 500; // 5% (500 basis points) 153 | ``` 154 | 155 | ## 🤝 Contributing 156 | 157 | We welcome contributions! Please see our [Contributing Guidelines](CONTRIBUTING.md) for details. 158 | 159 | ### Development Setup 160 | 161 | ```bash 162 | # Run tests 163 | anchor test 164 | 165 | # Lint code 166 | npm run lint 167 | 168 | # Format code 169 | npm run lint:fix 170 | ``` 171 | 172 | 173 | ## 📄 License 174 | 175 | This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. 176 | 177 | ## 🔗 Related Links 178 | 179 | - [Solana Documentation](https://docs.solana.com/) 180 | - [Anchor Framework](https://www.anchor-lang.com/) 181 | - [Raydium Protocol](https://raydium.io/) 182 | - [Meteora DEX](https://meteora.ag/) 183 | 184 | --- 185 | 186 | **Built with ❤️ for the Solana ecosystem** 187 | 188 | ## Frequently Asked Questions 189 | 190 | ### What is Pump.fun on Solana? 191 | Pump.fun is a fun and innovative DeFi project built on the Solana blockchain. This GitHub repository contains the official smart contract code for Pump.fun. 192 | 193 | ### How do I use Pump.fun on GitHub? 194 | Clone the Pump.fun GitHub repo, follow the instructions, and deploy the smart contract to Solana. 195 | 196 | ### Why is Pump.fun the best Solana pump project on GitHub? 197 | Pump.fun combines the speed of Solana, the excitement of pump projects, and the transparency of open-source development on GitHub. 198 | 199 | -------------------------------------------------------------------------------- /docs/API.md: -------------------------------------------------------------------------------- 1 | # Pump.fun Smart Contract API Documentation 2 | 3 | ## Overview 4 | 5 | The Pump.fun Smart Contract provides a comprehensive API for managing virtual liquidity pools, creating Raydium pools, and integrating with various DeFi protocols on the Solana blockchain. 6 | 7 | ## Table of Contents 8 | 9 | - [Installation](#installation) 10 | - [Quick Start](#quick-start) 11 | - [Core API](#core-api) 12 | - [Advanced Features](#advanced-features) 13 | - [Error Handling](#error-handling) 14 | - [Examples](#examples) 15 | - [Best Practices](#best-practices) 16 | 17 | ## Installation 18 | 19 | ### Prerequisites 20 | 21 | ```bash 22 | npm install @coral-xyz/anchor @solana/web3.js @solana/spl-token 23 | ``` 24 | 25 | ### Setup 26 | 27 | ```typescript 28 | import { Connection, PublicKey } from '@solana/web3.js'; 29 | import { Program, AnchorProvider } from '@coral-xyz/anchor'; 30 | 31 | // Initialize connection 32 | const connection = new Connection('https://api.devnet.solana.com'); 33 | const provider = new AnchorProvider(connection, wallet, {}); 34 | const program = new Program(IDL, PROGRAM_ID, provider); 35 | ``` 36 | 37 | ## Quick Start 38 | 39 | ### Basic LP Management 40 | 41 | ```typescript 42 | // Add virtual liquidity 43 | const addLpTx = await program.methods 44 | .addVirtualLp(new BN(1000000), tokenMint) 45 | .accounts({ 46 | user: wallet.publicKey, 47 | pool: poolAddress, 48 | tokenAccount: tokenAccount, 49 | }) 50 | .rpc(); 51 | 52 | // Remove virtual liquidity 53 | const removeLpTx = await program.methods 54 | .removeVirtualLp(new BN(500000), tokenMint) 55 | .accounts({ 56 | user: wallet.publicKey, 57 | pool: poolAddress, 58 | tokenAccount: tokenAccount, 59 | }) 60 | .rpc(); 61 | ``` 62 | 63 | ## Core API 64 | 65 | ### Virtual LP Management 66 | 67 | #### `addVirtualLp(amount: BN, tokenMint: PublicKey)` 68 | 69 | Adds virtual liquidity to a pool. 70 | 71 | **Parameters:** 72 | - `amount`: Amount of tokens to add (BN) 73 | - `tokenMint`: Token mint address (PublicKey) 74 | 75 | **Returns:** Transaction signature (string) 76 | 77 | **Example:** 78 | ```typescript 79 | const tx = await program.methods 80 | .addVirtualLp(new BN(1000000), tokenMint) 81 | .accounts({ 82 | user: wallet.publicKey, 83 | pool: poolAddress, 84 | tokenAccount: tokenAccount, 85 | }) 86 | .rpc(); 87 | ``` 88 | 89 | #### `removeVirtualLp(amount: BN, tokenMint: PublicKey)` 90 | 91 | Removes virtual liquidity from a pool. 92 | 93 | **Parameters:** 94 | - `amount`: Amount of tokens to remove (BN) 95 | - `tokenMint`: Token mint address (PublicKey) 96 | 97 | **Returns:** Transaction signature (string) 98 | 99 | ### Raydium Pool Creation 100 | 101 | #### `createRaydiumPool(tokenAMint: PublicKey, tokenBMint: PublicKey, initialLiquidity: BN)` 102 | 103 | Creates a new Raydium pool with specified tokens. 104 | 105 | **Parameters:** 106 | - `tokenAMint`: First token mint address (PublicKey) 107 | - `tokenBMint`: Second token mint address (PublicKey) 108 | - `initialLiquidity`: Initial liquidity amount (BN) 109 | 110 | **Returns:** Transaction signature (string) 111 | 112 | **Example:** 113 | ```typescript 114 | const tx = await program.methods 115 | .createRaydiumPool(tokenAMint, tokenBMint, new BN(1000000)) 116 | .accounts({ 117 | authority: wallet.publicKey, 118 | raydiumProgram: raydiumProgramId, 119 | pool: poolAddress, 120 | }) 121 | .rpc(); 122 | ``` 123 | 124 | ### Pool Management 125 | 126 | #### `updatePoolFees(newFeeRate: BN)` 127 | 128 | Updates the pool fee configuration. 129 | 130 | **Parameters:** 131 | - `newFeeRate`: New fee rate in basis points (BN) 132 | 133 | **Returns:** Transaction signature (string) 134 | 135 | #### `getPoolInfo(poolAddress: PublicKey)` 136 | 137 | Retrieves pool information. 138 | 139 | **Parameters:** 140 | - `poolAddress`: Pool address (PublicKey) 141 | 142 | **Returns:** Pool information object 143 | 144 | ## Advanced Features 145 | 146 | ### Meteora Integration 147 | 148 | ```typescript 149 | // Integrate with Meteora DEX 150 | const meteoraTx = await program.methods 151 | .integrateMeteora(tokenMint, amount) 152 | .accounts({ 153 | user: wallet.publicKey, 154 | meteoraProgram: meteoraProgramId, 155 | }) 156 | .rpc(); 157 | ``` 158 | 159 | ### EVM Compatibility 160 | 161 | ```typescript 162 | // Cross-chain functionality 163 | const evmTx = await program.methods 164 | .bridgeToEVM(tokenMint, amount, targetChain) 165 | .accounts({ 166 | user: wallet.publicKey, 167 | bridgeProgram: bridgeProgramId, 168 | }) 169 | .rpc(); 170 | ``` 171 | 172 | ## Error Handling 173 | 174 | ### Custom Error Types 175 | 176 | ```typescript 177 | export enum PumpError { 178 | InsufficientLiquidity = "Insufficient liquidity in pool", 179 | InvalidTokenMint = "Invalid token mint address", 180 | PoolNotFound = "Pool not found", 181 | Unauthorized = "Unauthorized operation", 182 | InvalidFeeRate = "Invalid fee rate", 183 | } 184 | ``` 185 | 186 | ### Error Handling Example 187 | 188 | ```typescript 189 | try { 190 | const tx = await program.methods 191 | .addVirtualLp(amount, tokenMint) 192 | .accounts({ 193 | user: wallet.publicKey, 194 | pool: poolAddress, 195 | }) 196 | .rpc(); 197 | console.log('Transaction successful:', tx); 198 | } catch (error) { 199 | if (error.message.includes('Insufficient liquidity')) { 200 | console.error('Not enough liquidity in pool'); 201 | } else if (error.message.includes('Invalid token mint')) { 202 | console.error('Invalid token mint address'); 203 | } else { 204 | console.error('Transaction failed:', error); 205 | } 206 | } 207 | ``` 208 | 209 | ## Examples 210 | 211 | ### Complete LP Management Workflow 212 | 213 | ```typescript 214 | import { Connection, PublicKey, Keypair } from '@solana/web3.js'; 215 | import { Program, BN } from '@coral-xyz/anchor'; 216 | 217 | class PumpFunManager { 218 | constructor(program: Program, wallet: Keypair) { 219 | this.program = program; 220 | this.wallet = wallet; 221 | } 222 | 223 | async addLiquidity(poolAddress: PublicKey, tokenMint: PublicKey, amount: number) { 224 | try { 225 | const tx = await this.program.methods 226 | .addVirtualLp(new BN(amount), tokenMint) 227 | .accounts({ 228 | user: this.wallet.publicKey, 229 | pool: poolAddress, 230 | }) 231 | .rpc(); 232 | 233 | console.log('Liquidity added successfully:', tx); 234 | return tx; 235 | } catch (error) { 236 | console.error('Failed to add liquidity:', error); 237 | throw error; 238 | } 239 | } 240 | 241 | async removeLiquidity(poolAddress: PublicKey, tokenMint: PublicKey, amount: number) { 242 | try { 243 | const tx = await this.program.methods 244 | .removeVirtualLp(new BN(amount), tokenMint) 245 | .accounts({ 246 | user: this.wallet.publicKey, 247 | pool: poolAddress, 248 | }) 249 | .rpc(); 250 | 251 | console.log('Liquidity removed successfully:', tx); 252 | return tx; 253 | } catch (error) { 254 | console.error('Failed to remove liquidity:', error); 255 | throw error; 256 | } 257 | } 258 | 259 | async createPool(tokenAMint: PublicKey, tokenBMint: PublicKey, liquidity: number) { 260 | try { 261 | const tx = await this.program.methods 262 | .createRaydiumPool(tokenAMint, tokenBMint, new BN(liquidity)) 263 | .accounts({ 264 | authority: this.wallet.publicKey, 265 | raydiumProgram: raydiumProgramId, 266 | }) 267 | .rpc(); 268 | 269 | console.log('Pool created successfully:', tx); 270 | return tx; 271 | } catch (error) { 272 | console.error('Failed to create pool:', error); 273 | throw error; 274 | } 275 | } 276 | } 277 | ``` 278 | 279 | ### Fee Management 280 | 281 | ```typescript 282 | async function updatePoolFees(poolAddress: PublicKey, newFeeRate: number) { 283 | try { 284 | const tx = await program.methods 285 | .updatePoolFees(new BN(newFeeRate)) 286 | .accounts({ 287 | authority: wallet.publicKey, 288 | pool: poolAddress, 289 | }) 290 | .rpc(); 291 | 292 | console.log('Pool fees updated successfully:', tx); 293 | return tx; 294 | } catch (error) { 295 | console.error('Failed to update pool fees:', error); 296 | throw error; 297 | } 298 | } 299 | ``` 300 | 301 | ## Best Practices 302 | 303 | ### 1. Error Handling 304 | 305 | Always implement proper error handling: 306 | 307 | ```typescript 308 | try { 309 | const result = await program.methods.someMethod().rpc(); 310 | // Handle success 311 | } catch (error) { 312 | // Handle specific errors 313 | if (error.message.includes('specific error')) { 314 | // Handle specific error 315 | } 316 | } 317 | ``` 318 | 319 | ### 2. Transaction Confirmation 320 | 321 | Always confirm transactions: 322 | 323 | ```typescript 324 | const tx = await program.methods.someMethod().rpc(); 325 | await connection.confirmTransaction(tx); 326 | ``` 327 | 328 | ### 3. Gas Optimization 329 | 330 | Use appropriate gas limits: 331 | 332 | ```typescript 333 | const tx = await program.methods 334 | .someMethod() 335 | .accounts({...}) 336 | .rpc({ commitment: 'confirmed' }); 337 | ``` 338 | 339 | ### 4. Security Considerations 340 | 341 | - Always validate inputs 342 | - Use proper authorization checks 343 | - Implement rate limiting where appropriate 344 | - Keep private keys secure 345 | 346 | ## Rate Limits 347 | 348 | The API implements the following rate limits: 349 | - 100 requests per minute per IP 350 | - 1000 requests per hour per wallet 351 | - 10 pool creations per day per wallet 352 | 353 | ## Support 354 | 355 | For API support: 356 | - **Documentation**: [GitHub Wiki](https://github.com/Tronzit-Veca/Pumpfun-Smart-Contract/wiki) 357 | - **Issues**: [GitHub Issues](https://github.com/Tronzit-Veca/Pumpfun-Smart-Contract/issues) 358 | - **Telegram**: [@Tr1030109](https://t.me/Tr1030109) 359 | - **Discord**: 0xapp123 360 | 361 | --- 362 | 363 | **Last updated**: January 2024 364 | **Version**: 1.0.0 -------------------------------------------------------------------------------- /tests/pump.ts: -------------------------------------------------------------------------------- 1 | import * as anchor from "@coral-xyz/anchor"; 2 | import { Program } from "@coral-xyz/anchor"; 3 | import { Pump } from "../target/types/pump" 4 | import { Connection, PublicKey, Keypair, SystemProgram, Transaction, sendAndConfirmTransaction, ComputeBudgetProgram, SYSVAR_RENT_PUBKEY } from "@solana/web3.js" 5 | import { createMint, getOrCreateAssociatedTokenAccount, mintTo, getAssociatedTokenAddress } from "@solana/spl-token" 6 | import { expect } from "chai"; 7 | import { BN } from "bn.js"; 8 | import keys from '../keys/users.json' 9 | import key2 from '../keys/user2.json' 10 | import { ASSOCIATED_PROGRAM_ID, TOKEN_PROGRAM_ID } from "@coral-xyz/anchor/dist/cjs/utils/token"; 11 | 12 | // const connection = new Connection("https://api.devnet.solana.com") 13 | const connection = new Connection("http://localhost:8899") 14 | const curveSeed = "CurveConfiguration" 15 | const POOL_SEED_PREFIX = "liquidity_pool" 16 | const LP_SEED_PREFIX = "LiqudityProvider" 17 | 18 | function sleep(ms: number) { 19 | return new Promise(resolve => setTimeout(resolve, ms)); 20 | } 21 | 22 | describe("pump", () => { 23 | anchor.setProvider(anchor.AnchorProvider.env()); 24 | 25 | const program = anchor.workspace.Pump as Program; 26 | 27 | 28 | // custom setting 29 | const user = Keypair.fromSecretKey(new Uint8Array(keys)) 30 | const user2 = Keypair.fromSecretKey(new Uint8Array(key2)) 31 | const tokenDecimal = 6 32 | const amount = new BN(1000000000).mul(new BN(10 ** tokenDecimal)) 33 | console.log(BigInt(amount.toString())) 34 | console.log(BigInt(amount.toString()).toString()) 35 | console.log("🚀 ~ describe ~ amount:", amount.toString()) 36 | 37 | let mint1: PublicKey 38 | let tokenAta1: PublicKey 39 | 40 | // let mint2: PublicKey 41 | // let tokenAta2: PublicKey 42 | 43 | console.log("Admin's wallet address is : ", user.publicKey.toBase58()) 44 | 45 | it("Airdrop to admin wallet", async () => { 46 | console.log(`Requesting airdrop to admin for 1SOL : ${user.publicKey.toBase58()}`) 47 | // 1 - Request Airdrop 48 | const signature = await connection.requestAirdrop( 49 | user.publicKey, 50 | 10 ** 9 51 | ); 52 | // 2 - Fetch the latest blockhash 53 | const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash(); 54 | // 3 - Confirm transaction success 55 | await connection.confirmTransaction({ 56 | blockhash, 57 | lastValidBlockHeight, 58 | signature 59 | }, 'finalized'); 60 | console.log("admin wallet balance : ", (await connection.getBalance(user.publicKey)) / 10 ** 9, "SOL") 61 | }) 62 | 63 | it("Airdrop to user wallet", async () => { 64 | console.log("Created a user, address is ", user2.publicKey.toBase58()) 65 | console.log(`Requesting airdrop for another user ${user.publicKey.toBase58()}`) 66 | // 1 - Request Airdrop 67 | const signature = await connection.requestAirdrop( 68 | user2.publicKey, 69 | 10 ** 9 70 | ); 71 | // 2 - Fetch the latest blockhash 72 | const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash(); 73 | // 3 - Confirm transaction success 74 | await connection.confirmTransaction({ 75 | blockhash, 76 | lastValidBlockHeight, 77 | signature 78 | }, 'finalized'); 79 | console.log("user balance : ", (await connection.getBalance(user.publicKey)) / 10 ** 9, "SOL") 80 | }) 81 | 82 | it("Mint token1 to user wallet", async () => { 83 | console.log("Trying to create and mint token1 to user's wallet") 84 | 85 | try { 86 | mint1 = await createMint(connection, user, user.publicKey, user.publicKey, tokenDecimal) 87 | console.log('mint1 address: ', mint1.toBase58()); 88 | tokenAta1 = (await getOrCreateAssociatedTokenAccount(connection, user, mint1, user.publicKey)).address 89 | console.log('token1 account address: ', tokenAta1.toBase58()); 90 | try { 91 | //minting 100 new tokens to the token address we just created 92 | await mintTo(connection, user, mint1, tokenAta1, user.publicKey, BigInt(amount.toString())) 93 | } catch (error) { 94 | console.log("🚀 ~ here:", error) 95 | } 96 | const tokenBalance = await connection.getTokenAccountBalance(tokenAta1) 97 | console.log("tokenBalance1 in user:", tokenBalance.value.uiAmount) 98 | console.log('token 1 successfully minted'); 99 | } catch (error) { 100 | console.log("Token 1 creation error \n", error) 101 | } 102 | 103 | }) 104 | 105 | it("Mint token 2 to user wallet", async () => { 106 | console.log("Trying to create and mint token 2 to user's wallet") 107 | try { 108 | mint2 = await createMint(connection, user, user.publicKey, user.publicKey, tokenDecimal) 109 | console.log('mint 2 address: ', mint2.toBase58()); 110 | 111 | tokenAta2 = (await getOrCreateAssociatedTokenAccount(connection, user, mint2, user.publicKey)).address 112 | console.log('token 2 account address: ', tokenAta2.toBase58()); 113 | 114 | await mintTo(connection, user, mint2, tokenAta2, user.publicKey, BigInt(amount.toString())) 115 | const tokenBalance = await connection.getTokenAccountBalance(tokenAta2) 116 | console.log("token 2 Balance in user:", tokenBalance.value.uiAmount) 117 | console.log('token 2 successfully minted'); 118 | } catch (error) { 119 | console.log("Token 2 creation error \n", error) 120 | } 121 | }) 122 | 123 | it("Initialize the contract", async () => { 124 | try { 125 | const [curveConfig] = PublicKey.findProgramAddressSync( 126 | [Buffer.from(curveSeed)], 127 | program.programId 128 | ) 129 | const tx = new Transaction() 130 | .add( 131 | ComputeBudgetProgram.setComputeUnitLimit({ units: 10_000 }), 132 | ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 1200_000 }), 133 | await program.methods 134 | .initialize(1) 135 | .accounts({ 136 | dexConfigurationAccount: curveConfig, 137 | admin: user.publicKey, 138 | rent: SYSVAR_RENT_PUBKEY, 139 | systemProgram: SystemProgram.programId 140 | }) 141 | .instruction() 142 | ) 143 | tx.feePayer = user.publicKey 144 | tx.recentBlockhash = (await connection.getLatestBlockhash()).blockhash 145 | // console.log(await connection.simulateTransaction(tx)) 146 | const sig = await sendAndConfirmTransaction(connection, tx, [user], { skipPreflight: true }) 147 | console.log("Successfully initialized : ", sig) 148 | let pool = await program.account.curveConfiguration.fetch(curveConfig) 149 | console.log("Pool State : ", pool) 150 | } catch (error) { 151 | console.log("Error in initialization :", error) 152 | } 153 | }); 154 | 155 | it("create pool", async () => { 156 | try { 157 | 158 | const [poolPda] = PublicKey.findProgramAddressSync( 159 | [Buffer.from(POOL_SEED_PREFIX), mint1.toBuffer(), mint2.toBuffer()], 160 | program.programId 161 | ) 162 | const [liquidityProviderAccount] = PublicKey.findProgramAddressSync( 163 | [Buffer.from(LP_SEED_PREFIX), poolPda.toBuffer(), user.publicKey.toBuffer()], 164 | program.programId 165 | ) 166 | const poolTokenOne = await getAssociatedTokenAddress( 167 | mint1, poolPda, true 168 | ) 169 | const poolTokenTwo = await getAssociatedTokenAddress( 170 | mint2, poolPda, true 171 | ) 172 | const userAta1 = await getAssociatedTokenAddress( 173 | mint1, user.publicKey 174 | ) 175 | const userAta2 = await getAssociatedTokenAddress( 176 | mint2, user.publicKey 177 | ) 178 | 179 | const tx = new Transaction() 180 | .add( 181 | ComputeBudgetProgram.setComputeUnitLimit({ units: 200_000 }), 182 | ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 200_000 }), 183 | await program.methods 184 | .createPool() 185 | .accounts({ 186 | pool: poolPda, 187 | mintTokenOne: mint1, 188 | mintTokenTwo: mint2, 189 | poolTokenAccountOne: poolTokenOne, 190 | poolTokenAccountTwo: poolTokenTwo, 191 | payer: user.publicKey, 192 | tokenProgram: TOKEN_PROGRAM_ID, 193 | rent: SYSVAR_RENT_PUBKEY, 194 | associatedTokenProgram: ASSOCIATED_PROGRAM_ID, 195 | systemProgram: SystemProgram.programId 196 | }) 197 | .instruction() 198 | ) 199 | tx.feePayer = user.publicKey 200 | tx.recentBlockhash = (await connection.getLatestBlockhash()).blockhash 201 | // console.log(await connection.simulateTransaction(tx)) 202 | const sig = await sendAndConfirmTransaction(connection, tx, [user], { skipPreflight: true }) 203 | console.log("Successfully created pool : ", sig) 204 | } catch (error) { 205 | console.log("Error in creating pool", error) 206 | } 207 | }) 208 | 209 | it("add liquidity", async () => { 210 | try { 211 | 212 | const [poolPda] = PublicKey.findProgramAddressSync( 213 | [Buffer.from(POOL_SEED_PREFIX), mint1.toBuffer()], 214 | program.programId 215 | ) 216 | 217 | 218 | const [liquidityProviderAccount] = PublicKey.findProgramAddressSync( 219 | [Buffer.from(LP_SEED_PREFIX), poolPda.toBuffer(), user.publicKey.toBuffer()], 220 | program.programId 221 | ) 222 | const poolTokenOne = await getAssociatedTokenAddress( 223 | mint1, poolPda, true 224 | ) 225 | const userAta1 = await getAssociatedTokenAddress( 226 | mint1, user.publicKey 227 | ) 228 | 229 | const tx = new Transaction() 230 | .add( 231 | ComputeBudgetProgram.setComputeUnitLimit({ units: 200_000 }), 232 | ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 200_000 }), 233 | await program.methods 234 | .addLiquidity(new BN(1000000000000000), new BN(30000000000)) 235 | .accounts({ 236 | pool: poolPda, 237 | mintTokenOne: mint1, 238 | poolTokenAccountOne: poolTokenOne, 239 | userTokenAccountOne: userAta1, 240 | liquidityProviderAccount: liquidityProviderAccount, 241 | user: user.publicKey, 242 | tokenProgram: TOKEN_PROGRAM_ID, 243 | associatedTokenProgram: ASSOCIATED_PROGRAM_ID, 244 | rent: SYSVAR_RENT_PUBKEY, 245 | systemProgram: SystemProgram.programId 246 | }) 247 | .instruction() 248 | ) 249 | tx.feePayer = user.publicKey 250 | tx.recentBlockhash = (await connection.getLatestBlockhash()).blockhash 251 | // console.log(await connection.simulateTransaction(tx)) 252 | const sig = await sendAndConfirmTransaction(connection, tx, [user], { skipPreflight: true }) 253 | console.log("Successfully added liquidity : ", sig) 254 | 255 | const signature = await connection.requestAirdrop( 256 | poolPda, 257 | 10 ** 9 258 | ); 259 | // 2 - Fetch the latest blockhash 260 | const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash(); 261 | // 3 - Confirm transaction success 262 | await connection.confirmTransaction({ 263 | blockhash, 264 | lastValidBlockHeight, 265 | signature 266 | }, 'finalized'); 267 | 268 | } catch (error) { 269 | console.log("Error in adding liquidity", error) 270 | } 271 | }) 272 | 273 | it("Swap token", async () => { 274 | try { 275 | const [curveConfig] = PublicKey.findProgramAddressSync( 276 | [Buffer.from(curveSeed)], 277 | program.programId 278 | ) 279 | 280 | const [poolPda] = PublicKey.findProgramAddressSync( 281 | [Buffer.from(POOL_SEED_PREFIX), mint1.toBuffer()], 282 | program.programId 283 | ) 284 | const poolTokenOne = await getAssociatedTokenAddress( 285 | mint1, poolPda, true 286 | ) 287 | 288 | const userAta1 = await getAssociatedTokenAddress( 289 | mint1, user.publicKey 290 | ) 291 | 292 | 293 | const tx = new Transaction() 294 | .add( 295 | ComputeBudgetProgram.setComputeUnitLimit({ units: 200_000 }), 296 | ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 200_000 }), 297 | await program.methods 298 | .swap(new BN(200000000), new BN(2)) 299 | .accounts({ 300 | pool: poolPda, 301 | mintTokenOne: mint1, 302 | poolTokenAccountOne: poolTokenOne, 303 | userTokenAccountOne: userAta1, 304 | dexConfigurationAccount: curveConfig, 305 | user: user.publicKey, 306 | tokenProgram: TOKEN_PROGRAM_ID, 307 | associatedTokenProgram: ASSOCIATED_PROGRAM_ID, 308 | rent: SYSVAR_RENT_PUBKEY, 309 | systemProgram: SystemProgram.programId 310 | }) 311 | .instruction() 312 | ) 313 | tx.feePayer = user.publicKey 314 | tx.recentBlockhash = (await connection.getLatestBlockhash()).blockhash 315 | // console.log(await connection.simulateTransaction(tx)) 316 | const sig = await sendAndConfirmTransaction(connection, tx, [user], { skipPreflight: true }) 317 | console.log("Successfully swapped : ", sig) 318 | 319 | } catch (error) { 320 | console.log("Error in swap transaction", error) 321 | } 322 | }) 323 | 324 | }); 325 | 326 | function comparePublicKeys(pubkey1: PublicKey, pubkey2: PublicKey): number { 327 | const key1Bytes = pubkey1.toBuffer(); 328 | const key2Bytes = pubkey2.toBuffer(); 329 | 330 | for (let i = 0; i < key1Bytes.length; i++) { 331 | if (key1Bytes[i] > key2Bytes[i]) { 332 | return 1; 333 | } else if (key1Bytes[i] < key2Bytes[i]) { 334 | return -1; 335 | } 336 | } 337 | return 0; 338 | } 339 | 340 | function generateSeed(tokenOne: PublicKey, tokenTwo: PublicKey): string { 341 | return comparePublicKeys(tokenOne, tokenTwo) > 0 342 | ? `${tokenOne.toString()}${tokenTwo.toString()}` 343 | : `${tokenTwo.toString()}${tokenOne.toString()}`; 344 | } -------------------------------------------------------------------------------- /programs/pump/src/state.rs: -------------------------------------------------------------------------------- 1 | use crate::consts::INITIAL_PRICE; 2 | use crate::errors::CustomError; 3 | use crate::utils::convert_from_float; 4 | use crate::utils::convert_to_float; 5 | use anchor_lang::prelude::*; 6 | use anchor_lang::system_program; 7 | use anchor_spl::token::{self, Mint, Token, TokenAccount}; 8 | use std::cmp; 9 | use std::ops::Add; 10 | use std::ops::Div; 11 | use std::ops::Mul; 12 | use std::ops::Sub; 13 | 14 | #[account] 15 | pub struct CurveConfiguration { 16 | pub fees: f64, 17 | } 18 | 19 | impl CurveConfiguration { 20 | pub const SEED: &'static str = "CurveConfiguration"; 21 | 22 | // Discriminator (8) + f64 (8) 23 | pub const ACCOUNT_SIZE: usize = 8 + 32 + 8; 24 | 25 | pub fn new(fees: f64) -> Self { 26 | Self { fees } 27 | } 28 | } 29 | 30 | #[account] 31 | pub struct LiquidityProvider { 32 | pub shares: u64, // The number of shares this provider holds in the liquidity pool ( didnt add to contract now ) 33 | } 34 | 35 | impl LiquidityProvider { 36 | pub const SEED_PREFIX: &'static str = "LiqudityProvider"; // Prefix for generating PDAs 37 | 38 | // Discriminator (8) + f64 (8) 39 | pub const ACCOUNT_SIZE: usize = 8 + 8; 40 | } 41 | 42 | #[account] 43 | pub struct LiquidityPool { 44 | pub token_one: Pubkey, // Public key of the first token in the liquidity pool 45 | pub token_two: Pubkey, // Public key of the second token in the pool 46 | pub total_supply: u64, // Total supply of liquidity tokens 47 | pub reserve_one: u64, // Reserve amount of token_one in the pool 48 | pub reserve_two: u64, // Reserve amount of token_two in the pool 49 | pub bump: u8, // Nonce for the program-derived address 50 | } 51 | 52 | impl LiquidityPool { 53 | pub const POOL_SEED_PREFIX: &'static str = "liquidity_pool"; 54 | 55 | // Discriminator (8) + Pubkey (32) + Pubkey (32) + totalsupply (8) 56 | // + reserve one (8) + reserve two (8) + Bump (1) 57 | pub const ACCOUNT_SIZE: usize = 8 + 32 + 32 + 8 + 8 + 8 + 1; 58 | 59 | // Helper function to generate a seed for PDAs based on token public keys 60 | // pub fn generate_seed(token_one: Pubkey, token_two: Pubkey) -> String { 61 | // if token_one > token_two { 62 | // format!("{}{}", token_one.to_string(), token_two.to_string()) 63 | // } else { 64 | // format!("{}{}", token_two.to_string(), token_one.to_string()) 65 | // } 66 | // } 67 | 68 | // Constructor to initialize a LiquidityPool with two tokens and a bump for the PDA 69 | pub fn new(token_one: Pubkey, bump: u8) -> Self { 70 | Self { 71 | token_one: token_one, 72 | token_two: token_one, 73 | total_supply: 0_u64, 74 | reserve_one: 0_u64, 75 | reserve_two: 0_u64, 76 | bump: bump, 77 | } 78 | } 79 | } 80 | 81 | pub trait LiquidityPoolAccount<'info> { 82 | // Grants a specific number of shares to a liquidity provider's account 83 | fn grant_shares( 84 | &mut self, 85 | liquidity_provider_account: &mut Account<'info, LiquidityProvider>, 86 | hares: u64, 87 | ) -> Result<()>; 88 | 89 | // Removes a specific number of shares from a liquidity provider's account 90 | fn remove_shares( 91 | &mut self, 92 | liquidity_provider_account: &mut Account<'info, LiquidityProvider>, 93 | shares: u64, 94 | ) -> Result<()>; 95 | 96 | // Updates the token reserves in the liquidity pool 97 | fn update_reserves(&mut self, reserve_one: u64, reserve_two: u64) -> Result<()>; 98 | 99 | // Allows adding liquidity by depositing an amount of two tokens and getting back pool shares 100 | fn add_liquidity( 101 | &mut self, 102 | token_one_accounts: ( 103 | &mut Account<'info, Mint>, 104 | &mut Account<'info, TokenAccount>, 105 | &mut Account<'info, TokenAccount>, 106 | ), 107 | token_two_accounts: ( 108 | &mut Account<'info, Mint>, 109 | &mut AccountInfo<'info>, 110 | &mut AccountInfo<'info>, 111 | ), 112 | amount_one: u64, 113 | amount_two: u64, 114 | liquidity_provider_account: &mut Account<'info, LiquidityProvider>, 115 | authority: &Signer<'info>, 116 | token_program: &Program<'info, Token>, 117 | ) -> Result<()>; 118 | 119 | // Allows removing liquidity by burning pool shares and receiving back a proportionate amount of tokens 120 | fn remove_liquidity( 121 | &mut self, 122 | token_one_accounts: ( 123 | &mut Account<'info, Mint>, 124 | &mut Account<'info, TokenAccount>, 125 | &mut Account<'info, TokenAccount>, 126 | ), 127 | token_two_accounts: ( 128 | &mut Account<'info, Mint>, 129 | &mut AccountInfo<'info>, 130 | &mut AccountInfo<'info>, 131 | ), 132 | shares: u64, 133 | liquidity_provider_account: &mut Account<'info, LiquidityProvider>, 134 | authority: &Signer<'info>, 135 | token_program: &Program<'info, Token>, 136 | ) -> Result<()>; 137 | 138 | fn swap( 139 | &mut self, 140 | bonding_configuration_account: &Account<'info, CurveConfiguration>, 141 | token_one_accounts: ( 142 | &mut Account<'info, Mint>, 143 | &mut Account<'info, TokenAccount>, 144 | &mut Account<'info, TokenAccount>, 145 | ), 146 | token_two_accounts: ( 147 | &mut Account<'info, Mint>, 148 | &mut AccountInfo<'info>, 149 | &mut Signer<'info>, 150 | ), 151 | amount: u64, 152 | style: u64, 153 | bump: u8, 154 | authority: &Signer<'info>, 155 | token_program: &Program<'info, Token>, 156 | system_program: &Program<'info, System>, 157 | ) -> Result<()>; 158 | 159 | fn transfer_token_from_pool( 160 | &self, 161 | from: &Account<'info, TokenAccount>, 162 | to: &Account<'info, TokenAccount>, 163 | amount: u64, 164 | token_program: &Program<'info, Token>, 165 | authority: &AccountInfo<'info>, 166 | bump: u8 167 | ) -> Result<()>; 168 | 169 | fn transfer_token_to_pool( 170 | &self, 171 | from: &Account<'info, TokenAccount>, 172 | to: &Account<'info, TokenAccount>, 173 | amount: u64, 174 | authority: &Signer<'info>, 175 | token_program: &Program<'info, Token>, 176 | ) -> Result<()>; 177 | 178 | fn transfer_sol_to_pool( 179 | &self, 180 | from: &Signer<'info>, 181 | to: &AccountInfo<'info>, 182 | amount: u64, 183 | system_program: &Program<'info, System>, 184 | ) -> Result<()>; 185 | 186 | fn transfer_sol_from_pool( 187 | &self, 188 | from: &AccountInfo<'info>, 189 | to: &AccountInfo<'info>, 190 | amount: u64, 191 | system_program: &Program<'info, System>, 192 | bump: u8 193 | ) -> Result<()>; 194 | } 195 | 196 | impl<'info> LiquidityPoolAccount<'info> for Account<'info, LiquidityPool> { 197 | fn grant_shares( 198 | &mut self, 199 | liquidity_provider_account: &mut Account<'info, LiquidityProvider>, 200 | shares: u64, 201 | ) -> Result<()> { 202 | liquidity_provider_account.shares = liquidity_provider_account 203 | .shares 204 | .checked_add(shares) 205 | .ok_or(CustomError::FailedToAllocateShares)?; 206 | 207 | self.total_supply = self 208 | .total_supply 209 | .checked_add(shares) 210 | .ok_or(CustomError::OverflowOrUnderflowOccurred)?; 211 | 212 | Ok(()) 213 | } 214 | 215 | fn remove_shares( 216 | &mut self, 217 | liquidity_provider_account: &mut Account<'info, LiquidityProvider>, 218 | shares: u64, 219 | ) -> Result<()> { 220 | liquidity_provider_account.shares = liquidity_provider_account 221 | .shares 222 | .checked_sub(shares) 223 | .ok_or(CustomError::FailedToDeallocateShares)?; 224 | 225 | self.total_supply = self 226 | .total_supply 227 | .checked_sub(shares) 228 | .ok_or(CustomError::OverflowOrUnderflowOccurred)?; 229 | 230 | Ok(()) 231 | } 232 | 233 | fn update_reserves(&mut self, reserve_one: u64, reserve_two: u64) -> Result<()> { 234 | self.reserve_one = reserve_one; 235 | self.reserve_two = reserve_two; 236 | 237 | Ok(()) 238 | } 239 | 240 | fn add_liquidity( 241 | &mut self, 242 | token_one_accounts: ( 243 | &mut Account<'info, Mint>, 244 | &mut Account<'info, TokenAccount>, 245 | &mut Account<'info, TokenAccount>, 246 | ), 247 | token_two_accounts: ( 248 | &mut Account<'info, Mint>, 249 | &mut AccountInfo<'info>, 250 | &mut AccountInfo<'info>, 251 | ), 252 | amount_one: u64, 253 | amount_two: u64, 254 | liquidity_provider_account: &mut Account<'info, LiquidityProvider>, 255 | authority: &Signer<'info>, 256 | token_program: &Program<'info, Token>, 257 | ) -> Result<()> { 258 | let mut shares_to_allocate = 0_u64; 259 | 260 | if self.total_supply == 0 { 261 | let sqrt_shares = (convert_to_float(amount_one, token_one_accounts.0.decimals) 262 | .mul(convert_to_float(amount_two, 9 as u8))) 263 | .sqrt(); 264 | 265 | shares_to_allocate = sqrt_shares as u64; 266 | } else { 267 | let mul_value = amount_one 268 | .checked_mul(self.total_supply) 269 | .ok_or(CustomError::OverflowOrUnderflowOccurred)?; 270 | let shares_one = mul_value 271 | .checked_div(self.reserve_one) 272 | .ok_or(CustomError::OverflowOrUnderflowOccurred)?; 273 | 274 | let mul_value = amount_two 275 | .checked_mul(self.total_supply) 276 | .ok_or(CustomError::OverflowOrUnderflowOccurred)?; 277 | let shares_two = mul_value 278 | .checked_div(self.reserve_two) 279 | .ok_or(CustomError::OverflowOrUnderflowOccurred)?; 280 | 281 | shares_to_allocate = cmp::min(shares_one, shares_two); 282 | } 283 | 284 | if shares_to_allocate <= 0 { 285 | return err!(CustomError::FailedToAddLiquidity); 286 | } 287 | 288 | self.grant_shares(liquidity_provider_account, shares_to_allocate)?; 289 | 290 | let new_reserves_one = self 291 | .reserve_one 292 | .checked_add(amount_one) 293 | .ok_or(CustomError::OverflowOrUnderflowOccurred)?; 294 | let new_reserves_two = self 295 | .reserve_two 296 | .checked_add(amount_two) 297 | .ok_or(CustomError::OverflowOrUnderflowOccurred)?; 298 | 299 | self.update_reserves(new_reserves_one, new_reserves_two)?; 300 | 301 | self.transfer_token_to_pool( 302 | token_one_accounts.2, 303 | token_one_accounts.1, 304 | amount_one, 305 | authority, 306 | token_program, 307 | )?; 308 | 309 | Ok(()) 310 | } 311 | 312 | fn remove_liquidity( 313 | &mut self, 314 | token_one_accounts: ( 315 | &mut Account<'info, Mint>, 316 | &mut Account<'info, TokenAccount>, 317 | &mut Account<'info, TokenAccount>, 318 | ), 319 | token_two_accounts: ( 320 | &mut Account<'info, Mint>, 321 | &mut AccountInfo<'info>, 322 | &mut AccountInfo<'info>, 323 | ), 324 | shares: u64, 325 | liquidity_provider_account: &mut Account<'info, LiquidityProvider>, 326 | _authority: &Signer<'info>, 327 | token_program: &Program<'info, Token>, 328 | ) -> Result<()> { 329 | if shares <= 0 { 330 | return err!(CustomError::FailedToRemoveLiquidity); 331 | } 332 | 333 | if liquidity_provider_account.shares < shares { 334 | return err!(CustomError::InsufficientShares); 335 | } 336 | 337 | let mul_value = shares 338 | .checked_mul(self.reserve_one) 339 | .ok_or(CustomError::OverflowOrUnderflowOccurred)?; 340 | 341 | let amount_out_one = mul_value 342 | .checked_div(self.total_supply) 343 | .ok_or(CustomError::OverflowOrUnderflowOccurred)?; 344 | 345 | let mul_value = shares 346 | .checked_mul(self.reserve_two) 347 | .ok_or(CustomError::OverflowOrUnderflowOccurred)?; 348 | 349 | let amount_out_two = mul_value 350 | .checked_div(self.total_supply) 351 | .ok_or(CustomError::OverflowOrUnderflowOccurred)?; 352 | 353 | if amount_out_one <= 0 || amount_out_two <= 0 { 354 | return err!(CustomError::FailedToRemoveLiquidity); 355 | } 356 | 357 | self.remove_shares(liquidity_provider_account, shares)?; 358 | 359 | let new_reserves_one = self 360 | .reserve_one 361 | .checked_sub(amount_out_one) 362 | .ok_or(CustomError::OverflowOrUnderflowOccurred)?; 363 | let new_reserves_two = self 364 | .reserve_two 365 | .checked_sub(amount_out_two) 366 | .ok_or(CustomError::OverflowOrUnderflowOccurred)?; 367 | 368 | self.update_reserves(new_reserves_one, new_reserves_two)?; 369 | 370 | // self.transfer_token_from_pool( 371 | // token_one_accounts.1, 372 | // token_one_accounts.2, 373 | // amount_out_one, 374 | // token_program, 375 | // )?; 376 | 377 | Ok(()) 378 | } 379 | 380 | fn swap( 381 | &mut self, 382 | _bonding_configuration_account: &Account<'info, CurveConfiguration>, 383 | token_one_accounts: ( 384 | &mut Account<'info, Mint>, 385 | &mut Account<'info, TokenAccount>, 386 | &mut Account<'info, TokenAccount>, 387 | ), 388 | token_two_accounts: ( 389 | &mut Account<'info, Mint>, 390 | &mut AccountInfo<'info>, 391 | &mut Signer<'info>, 392 | ), 393 | amount: u64, 394 | style: u64, 395 | bump: u8, 396 | authority: &Signer<'info>, 397 | token_program: &Program<'info, Token>, 398 | system_program: &Program<'info, System>, 399 | ) -> Result<()> { 400 | if amount <= 0 { 401 | return err!(CustomError::InvalidAmount); 402 | } 403 | msg!("Mint: {:?} ", token_one_accounts.0.key()); 404 | msg!( 405 | "Swap: {:?} {:?} {:?}", 406 | authority.key(), 407 | style, 408 | amount 409 | ); 410 | 411 | // xy = k => Constant product formula 412 | // (x + dx)(y - dy) = k 413 | // y - dy = k / (x + dx) 414 | // y - dy = xy / (x + dx) 415 | // dy = y - (xy / (x + dx)) 416 | // dy = yx + ydx - xy / (x + dx) 417 | // formula => dy = ydx / (x + dx) 418 | 419 | let adjusted_amount_in_float = convert_to_float(amount, token_one_accounts.0.decimals) 420 | .div(100_f64) 421 | .mul(100_f64.sub(_bonding_configuration_account.fees)); 422 | 423 | let adjusted_amount = 424 | convert_from_float(adjusted_amount_in_float, token_one_accounts.0.decimals); 425 | 426 | if style == 1 { 427 | let denominator_sum = self 428 | .reserve_one 429 | .checked_add(adjusted_amount) 430 | .ok_or(CustomError::OverflowOrUnderflowOccurred)?; 431 | 432 | let div_amt = convert_to_float(denominator_sum, token_one_accounts.0.decimals).div( 433 | convert_to_float(adjusted_amount, token_one_accounts.0.decimals), 434 | ); 435 | 436 | let amount_out_in_float = convert_to_float(self.reserve_two, 9 as u8).div(div_amt); 437 | 438 | let amount_out = convert_from_float(amount_out_in_float, 9 as u8); 439 | 440 | let new_reserves_one = self 441 | .reserve_one 442 | .checked_add(amount) 443 | .ok_or(CustomError::OverflowOrUnderflowOccurred)?; 444 | 445 | let new_reserves_two = self 446 | .reserve_two 447 | .checked_sub(amount_out) 448 | .ok_or(CustomError::OverflowOrUnderflowOccurred)?; 449 | 450 | self.update_reserves(new_reserves_one, new_reserves_two)?; 451 | msg!{"Reserves: {:?} {:?}", new_reserves_one, new_reserves_two} 452 | self.transfer_token_to_pool( 453 | token_one_accounts.2, 454 | token_one_accounts.1, 455 | amount, 456 | authority, 457 | token_program, 458 | )?; 459 | 460 | self.transfer_sol_from_pool( 461 | token_two_accounts.2, 462 | token_two_accounts.1, 463 | amount_out, 464 | system_program, 465 | bump 466 | )?; 467 | } else { 468 | let denominator_sum = self 469 | .reserve_two 470 | .checked_add(adjusted_amount) 471 | .ok_or(CustomError::OverflowOrUnderflowOccurred)?; 472 | 473 | let div_amt = convert_to_float(denominator_sum, token_one_accounts.0.decimals).div( 474 | convert_to_float(adjusted_amount, token_one_accounts.0.decimals), 475 | ); 476 | 477 | let amount_out_in_float = convert_to_float(self.reserve_one, 9 as u8).div(div_amt); 478 | 479 | let amount_out = convert_from_float(amount_out_in_float, 9 as u8); 480 | 481 | let new_reserves_one = self 482 | .reserve_one 483 | .checked_sub(amount_out) 484 | .ok_or(CustomError::OverflowOrUnderflowOccurred)?; 485 | 486 | let new_reserves_two = self 487 | .reserve_two 488 | .checked_add(amount) 489 | .ok_or(CustomError::OverflowOrUnderflowOccurred)?; 490 | 491 | self.update_reserves(new_reserves_one, new_reserves_two)?; 492 | 493 | msg!{"Reserves: {:?} {:?}", new_reserves_one, new_reserves_two} 494 | self.transfer_token_from_pool( 495 | token_one_accounts.1, 496 | token_one_accounts.2, 497 | amount_out, 498 | token_program, 499 | token_two_accounts.1, 500 | bump 501 | )?; 502 | 503 | self.transfer_sol_to_pool( 504 | token_two_accounts.2, 505 | token_two_accounts.1, 506 | amount, 507 | system_program, 508 | )?; 509 | } 510 | Ok(()) 511 | } 512 | 513 | fn transfer_token_from_pool( 514 | &self, 515 | from: &Account<'info, TokenAccount>, 516 | to: &Account<'info, TokenAccount>, 517 | amount: u64, 518 | token_program: &Program<'info, Token>, 519 | authority: &AccountInfo<'info>, 520 | bump: u8 521 | ) -> Result<()> { 522 | token::transfer( 523 | CpiContext::new_with_signer( 524 | token_program.to_account_info(), 525 | token::Transfer { 526 | from: from.to_account_info(), 527 | to: to.to_account_info(), 528 | authority: authority.to_account_info(), 529 | }, 530 | &[&[ 531 | "global".as_bytes(), 532 | &[bump], 533 | ]], 534 | ), 535 | amount, 536 | )?; 537 | 538 | Ok(()) 539 | } 540 | 541 | // fn execute_token_transfer( 542 | // &self, 543 | // source: &Account<'info, TokenAccount>, 544 | // destination: &Account<'info, TokenAccount>, 545 | // transfer_amount: u64, 546 | // token_program: &Program<'info, Token>, 547 | // ) -> Result<()> { 548 | // let context = CpiContext::new_with_signer( 549 | // token_program.to_account_info(), 550 | // token::Transfer { 551 | // from: source.to_account_info(), 552 | // to: destination.to_account_info(), 553 | // authority: self.to_account_info(), 554 | // }, 555 | // &[&[ 556 | // LiquidityPool::POOL_SEED_PREFIX.as_bytes(), 557 | // LiquidityPool::generate_seed(self.token_one.key(), self.token_two.key()) 558 | // .as_bytes(), 559 | // &[self.bump], 560 | // ]], 561 | // ); 562 | 563 | // token::transfer(context, transfer_amount)?; 564 | 565 | // Ok(()) 566 | // } 567 | 568 | fn transfer_token_to_pool( 569 | &self, 570 | from: &Account<'info, TokenAccount>, 571 | to: &Account<'info, TokenAccount>, 572 | amount: u64, 573 | authority: &Signer<'info>, 574 | token_program: &Program<'info, Token>, 575 | ) -> Result<()> { 576 | token::transfer( 577 | CpiContext::new( 578 | token_program.to_account_info(), 579 | token::Transfer { 580 | from: from.to_account_info(), 581 | to: to.to_account_info(), 582 | authority: authority.to_account_info(), 583 | }, 584 | ), 585 | amount, 586 | )?; 587 | 588 | Ok(()) 589 | } 590 | 591 | fn transfer_sol_from_pool( 592 | &self, 593 | from: &AccountInfo<'info>, 594 | to: &AccountInfo<'info>, 595 | amount: u64, 596 | system_program: &Program<'info, System>, 597 | bump: u8 598 | ) -> Result<()> { 599 | system_program::transfer( 600 | CpiContext::new_with_signer( 601 | system_program.to_account_info(), 602 | system_program::Transfer { 603 | from: from.to_account_info().clone(), 604 | to: to.clone(), 605 | }, 606 | &[&[ 607 | "global".as_bytes(), 608 | &[bump], 609 | ]], 610 | ), 611 | amount, 612 | )?; 613 | 614 | Ok(()) 615 | } 616 | 617 | // fn execute_sol_transfer( 618 | // &self, 619 | // recipient: &AccountInfo<'info>, 620 | // transfer_amount: u64, 621 | // system_program: &Program<'info, System>, 622 | // ) -> Result<()> { 623 | // let pool_account = self.to_account_info(); 624 | 625 | // let context = CpiContext::new_with_signer( 626 | // system_program.to_account_info(), 627 | // system_program::Transfer { 628 | // from: pool_account, 629 | // to: recipient.clone(), 630 | // }, 631 | // &[&[ 632 | // LiquidityPool::POOL_SEED_PREFIX.as_bytes(), 633 | // LiquidityPool::generate_seed(self.token_one.key(), self.token_two.key()) 634 | // .as_bytes(), 635 | // &[self.bump], 636 | // ]], 637 | // ); 638 | 639 | // system_program::transfer(context, transfer_amount)?; 640 | 641 | // Ok(()) 642 | // } 643 | 644 | fn transfer_sol_to_pool( 645 | &self, 646 | from: &Signer<'info>, 647 | to: &AccountInfo<'info>, 648 | amount: u64, 649 | system_program: &Program<'info, System>, 650 | ) -> Result<()> { 651 | system_program::transfer( 652 | CpiContext::new( 653 | system_program.to_account_info(), 654 | system_program::Transfer { 655 | from: from.to_account_info(), 656 | to: to.to_account_info(), 657 | }, 658 | ), 659 | amount, 660 | )?; 661 | Ok(()) 662 | } 663 | } 664 | 665 | pub fn transfer_sol_to_pool<'info>( 666 | from: AccountInfo<'info>, 667 | to: AccountInfo<'info>, 668 | amount: u64, 669 | system_program: AccountInfo<'info>, 670 | ) -> Result<()> { 671 | system_program::transfer( 672 | CpiContext::new( 673 | system_program.to_account_info(), 674 | system_program::Transfer { 675 | from: from.to_account_info(), 676 | to: to.to_account_info(), 677 | }, 678 | ), 679 | amount, 680 | )?; 681 | Ok(()) 682 | } -------------------------------------------------------------------------------- /cli/errors/anchor.ts: -------------------------------------------------------------------------------- 1 | export type AnchorError = 2 | | InstructionMissing 3 | | InstructionFallbackNotFound 4 | | InstructionDidNotDeserialize 5 | | InstructionDidNotSerialize 6 | | IdlInstructionStub 7 | | IdlInstructionInvalidProgram 8 | | ConstraintMut 9 | | ConstraintHasOne 10 | | ConstraintSigner 11 | | ConstraintRaw 12 | | ConstraintOwner 13 | | ConstraintRentExempt 14 | | ConstraintSeeds 15 | | ConstraintExecutable 16 | | ConstraintState 17 | | ConstraintAssociated 18 | | ConstraintAssociatedInit 19 | | ConstraintClose 20 | | ConstraintAddress 21 | | ConstraintZero 22 | | ConstraintTokenMint 23 | | ConstraintTokenOwner 24 | | ConstraintMintMintAuthority 25 | | ConstraintMintFreezeAuthority 26 | | ConstraintMintDecimals 27 | | ConstraintSpace 28 | | ConstraintAccountIsNone 29 | | RequireViolated 30 | | RequireEqViolated 31 | | RequireKeysEqViolated 32 | | RequireNeqViolated 33 | | RequireKeysNeqViolated 34 | | RequireGtViolated 35 | | RequireGteViolated 36 | | AccountDiscriminatorAlreadySet 37 | | AccountDiscriminatorNotFound 38 | | AccountDiscriminatorMismatch 39 | | AccountDidNotDeserialize 40 | | AccountDidNotSerialize 41 | | AccountNotEnoughKeys 42 | | AccountNotMutable 43 | | AccountOwnedByWrongProgram 44 | | InvalidProgramId 45 | | InvalidProgramExecutable 46 | | AccountNotSigner 47 | | AccountNotSystemOwned 48 | | AccountNotInitialized 49 | | AccountNotProgramData 50 | | AccountNotAssociatedTokenAccount 51 | | AccountSysvarMismatch 52 | | AccountReallocExceedsLimit 53 | | AccountDuplicateReallocs 54 | | DeclaredProgramIdMismatch 55 | | Deprecated 56 | 57 | export class InstructionMissing extends Error { 58 | static readonly code = 100 59 | readonly code = 100 60 | readonly name = "InstructionMissing" 61 | readonly msg = "8 byte instruction identifier not provided" 62 | 63 | constructor(readonly logs?: string[]) { 64 | super("100: 8 byte instruction identifier not provided") 65 | } 66 | } 67 | 68 | export class InstructionFallbackNotFound extends Error { 69 | static readonly code = 101 70 | readonly code = 101 71 | readonly name = "InstructionFallbackNotFound" 72 | readonly msg = "Fallback functions are not supported" 73 | 74 | constructor(readonly logs?: string[]) { 75 | super("101: Fallback functions are not supported") 76 | } 77 | } 78 | 79 | export class InstructionDidNotDeserialize extends Error { 80 | static readonly code = 102 81 | readonly code = 102 82 | readonly name = "InstructionDidNotDeserialize" 83 | readonly msg = "The program could not deserialize the given instruction" 84 | 85 | constructor(readonly logs?: string[]) { 86 | super("102: The program could not deserialize the given instruction") 87 | } 88 | } 89 | 90 | export class InstructionDidNotSerialize extends Error { 91 | static readonly code = 103 92 | readonly code = 103 93 | readonly name = "InstructionDidNotSerialize" 94 | readonly msg = "The program could not serialize the given instruction" 95 | 96 | constructor(readonly logs?: string[]) { 97 | super("103: The program could not serialize the given instruction") 98 | } 99 | } 100 | 101 | export class IdlInstructionStub extends Error { 102 | static readonly code = 1000 103 | readonly code = 1000 104 | readonly name = "IdlInstructionStub" 105 | readonly msg = "The program was compiled without idl instructions" 106 | 107 | constructor(readonly logs?: string[]) { 108 | super("1000: The program was compiled without idl instructions") 109 | } 110 | } 111 | 112 | export class IdlInstructionInvalidProgram extends Error { 113 | static readonly code = 1001 114 | readonly code = 1001 115 | readonly name = "IdlInstructionInvalidProgram" 116 | readonly msg = 117 | "The transaction was given an invalid program for the IDL instruction" 118 | 119 | constructor(readonly logs?: string[]) { 120 | super( 121 | "1001: The transaction was given an invalid program for the IDL instruction" 122 | ) 123 | } 124 | } 125 | 126 | export class ConstraintMut extends Error { 127 | static readonly code = 2000 128 | readonly code = 2000 129 | readonly name = "ConstraintMut" 130 | readonly msg = "A mut constraint was violated" 131 | 132 | constructor(readonly logs?: string[]) { 133 | super("2000: A mut constraint was violated") 134 | } 135 | } 136 | 137 | export class ConstraintHasOne extends Error { 138 | static readonly code = 2001 139 | readonly code = 2001 140 | readonly name = "ConstraintHasOne" 141 | readonly msg = "A has one constraint was violated" 142 | 143 | constructor(readonly logs?: string[]) { 144 | super("2001: A has one constraint was violated") 145 | } 146 | } 147 | 148 | export class ConstraintSigner extends Error { 149 | static readonly code = 2002 150 | readonly code = 2002 151 | readonly name = "ConstraintSigner" 152 | readonly msg = "A signer constraint was violated" 153 | 154 | constructor(readonly logs?: string[]) { 155 | super("2002: A signer constraint was violated") 156 | } 157 | } 158 | 159 | export class ConstraintRaw extends Error { 160 | static readonly code = 2003 161 | readonly code = 2003 162 | readonly name = "ConstraintRaw" 163 | readonly msg = "A raw constraint was violated" 164 | 165 | constructor(readonly logs?: string[]) { 166 | super("2003: A raw constraint was violated") 167 | } 168 | } 169 | 170 | export class ConstraintOwner extends Error { 171 | static readonly code = 2004 172 | readonly code = 2004 173 | readonly name = "ConstraintOwner" 174 | readonly msg = "An owner constraint was violated" 175 | 176 | constructor(readonly logs?: string[]) { 177 | super("2004: An owner constraint was violated") 178 | } 179 | } 180 | 181 | export class ConstraintRentExempt extends Error { 182 | static readonly code = 2005 183 | readonly code = 2005 184 | readonly name = "ConstraintRentExempt" 185 | readonly msg = "A rent exemption constraint was violated" 186 | 187 | constructor(readonly logs?: string[]) { 188 | super("2005: A rent exemption constraint was violated") 189 | } 190 | } 191 | 192 | export class ConstraintSeeds extends Error { 193 | static readonly code = 2006 194 | readonly code = 2006 195 | readonly name = "ConstraintSeeds" 196 | readonly msg = "A seeds constraint was violated" 197 | 198 | constructor(readonly logs?: string[]) { 199 | super("2006: A seeds constraint was violated") 200 | } 201 | } 202 | 203 | export class ConstraintExecutable extends Error { 204 | static readonly code = 2007 205 | readonly code = 2007 206 | readonly name = "ConstraintExecutable" 207 | readonly msg = "An executable constraint was violated" 208 | 209 | constructor(readonly logs?: string[]) { 210 | super("2007: An executable constraint was violated") 211 | } 212 | } 213 | 214 | export class ConstraintState extends Error { 215 | static readonly code = 2008 216 | readonly code = 2008 217 | readonly name = "ConstraintState" 218 | readonly msg = "Deprecated Error, feel free to replace with something else" 219 | 220 | constructor(readonly logs?: string[]) { 221 | super("2008: Deprecated Error, feel free to replace with something else") 222 | } 223 | } 224 | 225 | export class ConstraintAssociated extends Error { 226 | static readonly code = 2009 227 | readonly code = 2009 228 | readonly name = "ConstraintAssociated" 229 | readonly msg = "An associated constraint was violated" 230 | 231 | constructor(readonly logs?: string[]) { 232 | super("2009: An associated constraint was violated") 233 | } 234 | } 235 | 236 | export class ConstraintAssociatedInit extends Error { 237 | static readonly code = 2010 238 | readonly code = 2010 239 | readonly name = "ConstraintAssociatedInit" 240 | readonly msg = "An associated init constraint was violated" 241 | 242 | constructor(readonly logs?: string[]) { 243 | super("2010: An associated init constraint was violated") 244 | } 245 | } 246 | 247 | export class ConstraintClose extends Error { 248 | static readonly code = 2011 249 | readonly code = 2011 250 | readonly name = "ConstraintClose" 251 | readonly msg = "A close constraint was violated" 252 | 253 | constructor(readonly logs?: string[]) { 254 | super("2011: A close constraint was violated") 255 | } 256 | } 257 | 258 | export class ConstraintAddress extends Error { 259 | static readonly code = 2012 260 | readonly code = 2012 261 | readonly name = "ConstraintAddress" 262 | readonly msg = "An address constraint was violated" 263 | 264 | constructor(readonly logs?: string[]) { 265 | super("2012: An address constraint was violated") 266 | } 267 | } 268 | 269 | export class ConstraintZero extends Error { 270 | static readonly code = 2013 271 | readonly code = 2013 272 | readonly name = "ConstraintZero" 273 | readonly msg = "Expected zero account discriminant" 274 | 275 | constructor(readonly logs?: string[]) { 276 | super("2013: Expected zero account discriminant") 277 | } 278 | } 279 | 280 | export class ConstraintTokenMint extends Error { 281 | static readonly code = 2014 282 | readonly code = 2014 283 | readonly name = "ConstraintTokenMint" 284 | readonly msg = "A token mint constraint was violated" 285 | 286 | constructor(readonly logs?: string[]) { 287 | super("2014: A token mint constraint was violated") 288 | } 289 | } 290 | 291 | export class ConstraintTokenOwner extends Error { 292 | static readonly code = 2015 293 | readonly code = 2015 294 | readonly name = "ConstraintTokenOwner" 295 | readonly msg = "A token owner constraint was violated" 296 | 297 | constructor(readonly logs?: string[]) { 298 | super("2015: A token owner constraint was violated") 299 | } 300 | } 301 | 302 | export class ConstraintMintMintAuthority extends Error { 303 | static readonly code = 2016 304 | readonly code = 2016 305 | readonly name = "ConstraintMintMintAuthority" 306 | readonly msg = "A mint mint authority constraint was violated" 307 | 308 | constructor(readonly logs?: string[]) { 309 | super("2016: A mint mint authority constraint was violated") 310 | } 311 | } 312 | 313 | export class ConstraintMintFreezeAuthority extends Error { 314 | static readonly code = 2017 315 | readonly code = 2017 316 | readonly name = "ConstraintMintFreezeAuthority" 317 | readonly msg = "A mint freeze authority constraint was violated" 318 | 319 | constructor(readonly logs?: string[]) { 320 | super("2017: A mint freeze authority constraint was violated") 321 | } 322 | } 323 | 324 | export class ConstraintMintDecimals extends Error { 325 | static readonly code = 2018 326 | readonly code = 2018 327 | readonly name = "ConstraintMintDecimals" 328 | readonly msg = "A mint decimals constraint was violated" 329 | 330 | constructor(readonly logs?: string[]) { 331 | super("2018: A mint decimals constraint was violated") 332 | } 333 | } 334 | 335 | export class ConstraintSpace extends Error { 336 | static readonly code = 2019 337 | readonly code = 2019 338 | readonly name = "ConstraintSpace" 339 | readonly msg = "A space constraint was violated" 340 | 341 | constructor(readonly logs?: string[]) { 342 | super("2019: A space constraint was violated") 343 | } 344 | } 345 | 346 | export class ConstraintAccountIsNone extends Error { 347 | static readonly code = 2020 348 | readonly code = 2020 349 | readonly name = "ConstraintAccountIsNone" 350 | readonly msg = "A required account for the constraint is None" 351 | 352 | constructor(readonly logs?: string[]) { 353 | super("2020: A required account for the constraint is None") 354 | } 355 | } 356 | 357 | export class RequireViolated extends Error { 358 | static readonly code = 2500 359 | readonly code = 2500 360 | readonly name = "RequireViolated" 361 | readonly msg = "A require expression was violated" 362 | 363 | constructor(readonly logs?: string[]) { 364 | super("2500: A require expression was violated") 365 | } 366 | } 367 | 368 | export class RequireEqViolated extends Error { 369 | static readonly code = 2501 370 | readonly code = 2501 371 | readonly name = "RequireEqViolated" 372 | readonly msg = "A require_eq expression was violated" 373 | 374 | constructor(readonly logs?: string[]) { 375 | super("2501: A require_eq expression was violated") 376 | } 377 | } 378 | 379 | export class RequireKeysEqViolated extends Error { 380 | static readonly code = 2502 381 | readonly code = 2502 382 | readonly name = "RequireKeysEqViolated" 383 | readonly msg = "A require_keys_eq expression was violated" 384 | 385 | constructor(readonly logs?: string[]) { 386 | super("2502: A require_keys_eq expression was violated") 387 | } 388 | } 389 | 390 | export class RequireNeqViolated extends Error { 391 | static readonly code = 2503 392 | readonly code = 2503 393 | readonly name = "RequireNeqViolated" 394 | readonly msg = "A require_neq expression was violated" 395 | 396 | constructor(readonly logs?: string[]) { 397 | super("2503: A require_neq expression was violated") 398 | } 399 | } 400 | 401 | export class RequireKeysNeqViolated extends Error { 402 | static readonly code = 2504 403 | readonly code = 2504 404 | readonly name = "RequireKeysNeqViolated" 405 | readonly msg = "A require_keys_neq expression was violated" 406 | 407 | constructor(readonly logs?: string[]) { 408 | super("2504: A require_keys_neq expression was violated") 409 | } 410 | } 411 | 412 | export class RequireGtViolated extends Error { 413 | static readonly code = 2505 414 | readonly code = 2505 415 | readonly name = "RequireGtViolated" 416 | readonly msg = "A require_gt expression was violated" 417 | 418 | constructor(readonly logs?: string[]) { 419 | super("2505: A require_gt expression was violated") 420 | } 421 | } 422 | 423 | export class RequireGteViolated extends Error { 424 | static readonly code = 2506 425 | readonly code = 2506 426 | readonly name = "RequireGteViolated" 427 | readonly msg = "A require_gte expression was violated" 428 | 429 | constructor(readonly logs?: string[]) { 430 | super("2506: A require_gte expression was violated") 431 | } 432 | } 433 | 434 | export class AccountDiscriminatorAlreadySet extends Error { 435 | static readonly code = 3000 436 | readonly code = 3000 437 | readonly name = "AccountDiscriminatorAlreadySet" 438 | readonly msg = "The account discriminator was already set on this account" 439 | 440 | constructor(readonly logs?: string[]) { 441 | super("3000: The account discriminator was already set on this account") 442 | } 443 | } 444 | 445 | export class AccountDiscriminatorNotFound extends Error { 446 | static readonly code = 3001 447 | readonly code = 3001 448 | readonly name = "AccountDiscriminatorNotFound" 449 | readonly msg = "No 8 byte discriminator was found on the account" 450 | 451 | constructor(readonly logs?: string[]) { 452 | super("3001: No 8 byte discriminator was found on the account") 453 | } 454 | } 455 | 456 | export class AccountDiscriminatorMismatch extends Error { 457 | static readonly code = 3002 458 | readonly code = 3002 459 | readonly name = "AccountDiscriminatorMismatch" 460 | readonly msg = "8 byte discriminator did not match what was expected" 461 | 462 | constructor(readonly logs?: string[]) { 463 | super("3002: 8 byte discriminator did not match what was expected") 464 | } 465 | } 466 | 467 | export class AccountDidNotDeserialize extends Error { 468 | static readonly code = 3003 469 | readonly code = 3003 470 | readonly name = "AccountDidNotDeserialize" 471 | readonly msg = "Failed to deserialize the account" 472 | 473 | constructor(readonly logs?: string[]) { 474 | super("3003: Failed to deserialize the account") 475 | } 476 | } 477 | 478 | export class AccountDidNotSerialize extends Error { 479 | static readonly code = 3004 480 | readonly code = 3004 481 | readonly name = "AccountDidNotSerialize" 482 | readonly msg = "Failed to serialize the account" 483 | 484 | constructor(readonly logs?: string[]) { 485 | super("3004: Failed to serialize the account") 486 | } 487 | } 488 | 489 | export class AccountNotEnoughKeys extends Error { 490 | static readonly code = 3005 491 | readonly code = 3005 492 | readonly name = "AccountNotEnoughKeys" 493 | readonly msg = "Not enough account keys given to the instruction" 494 | 495 | constructor(readonly logs?: string[]) { 496 | super("3005: Not enough account keys given to the instruction") 497 | } 498 | } 499 | 500 | export class AccountNotMutable extends Error { 501 | static readonly code = 3006 502 | readonly code = 3006 503 | readonly name = "AccountNotMutable" 504 | readonly msg = "The given account is not mutable" 505 | 506 | constructor(readonly logs?: string[]) { 507 | super("3006: The given account is not mutable") 508 | } 509 | } 510 | 511 | export class AccountOwnedByWrongProgram extends Error { 512 | static readonly code = 3007 513 | readonly code = 3007 514 | readonly name = "AccountOwnedByWrongProgram" 515 | readonly msg = 516 | "The given account is owned by a different program than expected" 517 | 518 | constructor(readonly logs?: string[]) { 519 | super( 520 | "3007: The given account is owned by a different program than expected" 521 | ) 522 | } 523 | } 524 | 525 | export class InvalidProgramId extends Error { 526 | static readonly code = 3008 527 | readonly code = 3008 528 | readonly name = "InvalidProgramId" 529 | readonly msg = "Program ID was not as expected" 530 | 531 | constructor(readonly logs?: string[]) { 532 | super("3008: Program ID was not as expected") 533 | } 534 | } 535 | 536 | export class InvalidProgramExecutable extends Error { 537 | static readonly code = 3009 538 | readonly code = 3009 539 | readonly name = "InvalidProgramExecutable" 540 | readonly msg = "Program account is not executable" 541 | 542 | constructor(readonly logs?: string[]) { 543 | super("3009: Program account is not executable") 544 | } 545 | } 546 | 547 | export class AccountNotSigner extends Error { 548 | static readonly code = 3010 549 | readonly code = 3010 550 | readonly name = "AccountNotSigner" 551 | readonly msg = "The given account did not sign" 552 | 553 | constructor(readonly logs?: string[]) { 554 | super("3010: The given account did not sign") 555 | } 556 | } 557 | 558 | export class AccountNotSystemOwned extends Error { 559 | static readonly code = 3011 560 | readonly code = 3011 561 | readonly name = "AccountNotSystemOwned" 562 | readonly msg = "The given account is not owned by the system program" 563 | 564 | constructor(readonly logs?: string[]) { 565 | super("3011: The given account is not owned by the system program") 566 | } 567 | } 568 | 569 | export class AccountNotInitialized extends Error { 570 | static readonly code = 3012 571 | readonly code = 3012 572 | readonly name = "AccountNotInitialized" 573 | readonly msg = "The program expected this account to be already initialized" 574 | 575 | constructor(readonly logs?: string[]) { 576 | super("3012: The program expected this account to be already initialized") 577 | } 578 | } 579 | 580 | export class AccountNotProgramData extends Error { 581 | static readonly code = 3013 582 | readonly code = 3013 583 | readonly name = "AccountNotProgramData" 584 | readonly msg = "The given account is not a program data account" 585 | 586 | constructor(readonly logs?: string[]) { 587 | super("3013: The given account is not a program data account") 588 | } 589 | } 590 | 591 | export class AccountNotAssociatedTokenAccount extends Error { 592 | static readonly code = 3014 593 | readonly code = 3014 594 | readonly name = "AccountNotAssociatedTokenAccount" 595 | readonly msg = "The given account is not the associated token account" 596 | 597 | constructor(readonly logs?: string[]) { 598 | super("3014: The given account is not the associated token account") 599 | } 600 | } 601 | 602 | export class AccountSysvarMismatch extends Error { 603 | static readonly code = 3015 604 | readonly code = 3015 605 | readonly name = "AccountSysvarMismatch" 606 | readonly msg = "The given public key does not match the required sysvar" 607 | 608 | constructor(readonly logs?: string[]) { 609 | super("3015: The given public key does not match the required sysvar") 610 | } 611 | } 612 | 613 | export class AccountReallocExceedsLimit extends Error { 614 | static readonly code = 3016 615 | readonly code = 3016 616 | readonly name = "AccountReallocExceedsLimit" 617 | readonly msg = 618 | "The account reallocation exceeds the MAX_PERMITTED_DATA_INCREASE limit" 619 | 620 | constructor(readonly logs?: string[]) { 621 | super( 622 | "3016: The account reallocation exceeds the MAX_PERMITTED_DATA_INCREASE limit" 623 | ) 624 | } 625 | } 626 | 627 | export class AccountDuplicateReallocs extends Error { 628 | static readonly code = 3017 629 | readonly code = 3017 630 | readonly name = "AccountDuplicateReallocs" 631 | readonly msg = "The account was duplicated for more than one reallocation" 632 | 633 | constructor(readonly logs?: string[]) { 634 | super("3017: The account was duplicated for more than one reallocation") 635 | } 636 | } 637 | 638 | export class DeclaredProgramIdMismatch extends Error { 639 | static readonly code = 4100 640 | readonly code = 4100 641 | readonly name = "DeclaredProgramIdMismatch" 642 | readonly msg = "The declared program id does not match the actual program id" 643 | 644 | constructor(readonly logs?: string[]) { 645 | super("4100: The declared program id does not match the actual program id") 646 | } 647 | } 648 | 649 | export class Deprecated extends Error { 650 | static readonly code = 5000 651 | readonly code = 5000 652 | readonly name = "Deprecated" 653 | readonly msg = "The API being used is deprecated and should no longer be used" 654 | 655 | constructor(readonly logs?: string[]) { 656 | super("5000: The API being used is deprecated and should no longer be used") 657 | } 658 | } 659 | 660 | export function fromCode(code: number, logs?: string[]): AnchorError | null { 661 | switch (code) { 662 | case 100: 663 | return new InstructionMissing(logs) 664 | case 101: 665 | return new InstructionFallbackNotFound(logs) 666 | case 102: 667 | return new InstructionDidNotDeserialize(logs) 668 | case 103: 669 | return new InstructionDidNotSerialize(logs) 670 | case 1000: 671 | return new IdlInstructionStub(logs) 672 | case 1001: 673 | return new IdlInstructionInvalidProgram(logs) 674 | case 2000: 675 | return new ConstraintMut(logs) 676 | case 2001: 677 | return new ConstraintHasOne(logs) 678 | case 2002: 679 | return new ConstraintSigner(logs) 680 | case 2003: 681 | return new ConstraintRaw(logs) 682 | case 2004: 683 | return new ConstraintOwner(logs) 684 | case 2005: 685 | return new ConstraintRentExempt(logs) 686 | case 2006: 687 | return new ConstraintSeeds(logs) 688 | case 2007: 689 | return new ConstraintExecutable(logs) 690 | case 2008: 691 | return new ConstraintState(logs) 692 | case 2009: 693 | return new ConstraintAssociated(logs) 694 | case 2010: 695 | return new ConstraintAssociatedInit(logs) 696 | case 2011: 697 | return new ConstraintClose(logs) 698 | case 2012: 699 | return new ConstraintAddress(logs) 700 | case 2013: 701 | return new ConstraintZero(logs) 702 | case 2014: 703 | return new ConstraintTokenMint(logs) 704 | case 2015: 705 | return new ConstraintTokenOwner(logs) 706 | case 2016: 707 | return new ConstraintMintMintAuthority(logs) 708 | case 2017: 709 | return new ConstraintMintFreezeAuthority(logs) 710 | case 2018: 711 | return new ConstraintMintDecimals(logs) 712 | case 2019: 713 | return new ConstraintSpace(logs) 714 | case 2020: 715 | return new ConstraintAccountIsNone(logs) 716 | case 2500: 717 | return new RequireViolated(logs) 718 | case 2501: 719 | return new RequireEqViolated(logs) 720 | case 2502: 721 | return new RequireKeysEqViolated(logs) 722 | case 2503: 723 | return new RequireNeqViolated(logs) 724 | case 2504: 725 | return new RequireKeysNeqViolated(logs) 726 | case 2505: 727 | return new RequireGtViolated(logs) 728 | case 2506: 729 | return new RequireGteViolated(logs) 730 | case 3000: 731 | return new AccountDiscriminatorAlreadySet(logs) 732 | case 3001: 733 | return new AccountDiscriminatorNotFound(logs) 734 | case 3002: 735 | return new AccountDiscriminatorMismatch(logs) 736 | case 3003: 737 | return new AccountDidNotDeserialize(logs) 738 | case 3004: 739 | return new AccountDidNotSerialize(logs) 740 | case 3005: 741 | return new AccountNotEnoughKeys(logs) 742 | case 3006: 743 | return new AccountNotMutable(logs) 744 | case 3007: 745 | return new AccountOwnedByWrongProgram(logs) 746 | case 3008: 747 | return new InvalidProgramId(logs) 748 | case 3009: 749 | return new InvalidProgramExecutable(logs) 750 | case 3010: 751 | return new AccountNotSigner(logs) 752 | case 3011: 753 | return new AccountNotSystemOwned(logs) 754 | case 3012: 755 | return new AccountNotInitialized(logs) 756 | case 3013: 757 | return new AccountNotProgramData(logs) 758 | case 3014: 759 | return new AccountNotAssociatedTokenAccount(logs) 760 | case 3015: 761 | return new AccountSysvarMismatch(logs) 762 | case 3016: 763 | return new AccountReallocExceedsLimit(logs) 764 | case 3017: 765 | return new AccountDuplicateReallocs(logs) 766 | case 4100: 767 | return new DeclaredProgramIdMismatch(logs) 768 | case 5000: 769 | return new Deprecated(logs) 770 | } 771 | 772 | return null 773 | } 774 | -------------------------------------------------------------------------------- /yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | "@babel/runtime@^7.25.0": 6 | version "7.28.2" 7 | resolved "https://registry.npmjs.org/@babel/runtime/-/runtime-7.28.2.tgz" 8 | integrity sha512-KHp2IflsnGywDjBWDkR9iEqiWSpc8GIi0lgTT3mOElT0PP1tG26P4tmFI2YvAdzgq9RGyoHZQEIEdZy6Ec5xCA== 9 | 10 | "@coral-xyz/anchor@^0.29.0": 11 | version "0.29.0" 12 | resolved "https://registry.npmjs.org/@coral-xyz/anchor/-/anchor-0.29.0.tgz" 13 | integrity sha512-eny6QNG0WOwqV0zQ7cs/b1tIuzZGmP7U7EcH+ogt4Gdbl8HDmIYVMh/9aTmYZPaFWjtUaI8qSn73uYEXWfATdA== 14 | dependencies: 15 | "@coral-xyz/borsh" "^0.29.0" 16 | "@noble/hashes" "^1.3.1" 17 | "@solana/web3.js" "^1.68.0" 18 | bn.js "^5.1.2" 19 | bs58 "^4.0.1" 20 | buffer-layout "^1.2.2" 21 | camelcase "^6.3.0" 22 | cross-fetch "^3.1.5" 23 | crypto-hash "^1.3.0" 24 | eventemitter3 "^4.0.7" 25 | pako "^2.0.3" 26 | snake-case "^3.0.4" 27 | superstruct "^0.15.4" 28 | toml "^3.0.0" 29 | 30 | "@coral-xyz/borsh@^0.29.0": 31 | version "0.29.0" 32 | resolved "https://registry.npmjs.org/@coral-xyz/borsh/-/borsh-0.29.0.tgz" 33 | integrity sha512-s7VFVa3a0oqpkuRloWVPdCK7hMbAMY270geZOGfCnaqexrP5dTIpbEHL33req6IYPPJ0hYa71cdvJ1h6V55/oQ== 34 | dependencies: 35 | bn.js "^5.1.2" 36 | buffer-layout "^1.2.0" 37 | 38 | "@noble/curves@^1.4.2": 39 | version "1.9.6" 40 | resolved "https://registry.npmjs.org/@noble/curves/-/curves-1.9.6.tgz" 41 | integrity sha512-GIKz/j99FRthB8icyJQA51E8Uk5hXmdyThjgQXRKiv9h0zeRlzSCLIzFw6K1LotZ3XuB7yzlf76qk7uBmTdFqA== 42 | dependencies: 43 | "@noble/hashes" "1.8.0" 44 | 45 | "@noble/hashes@^1.3.1", "@noble/hashes@^1.4.0", "@noble/hashes@1.8.0": 46 | version "1.8.0" 47 | resolved "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz" 48 | integrity sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A== 49 | 50 | "@solana/buffer-layout-utils@^0.2.0": 51 | version "0.2.0" 52 | resolved "https://registry.npmjs.org/@solana/buffer-layout-utils/-/buffer-layout-utils-0.2.0.tgz" 53 | integrity sha512-szG4sxgJGktbuZYDg2FfNmkMi0DYQoVjN2h7ta1W1hPrwzarcFLBq9UpX1UjNXsNpT9dn+chgprtWGioUAr4/g== 54 | dependencies: 55 | "@solana/buffer-layout" "^4.0.0" 56 | "@solana/web3.js" "^1.32.0" 57 | bigint-buffer "^1.1.5" 58 | bignumber.js "^9.0.1" 59 | 60 | "@solana/buffer-layout@^4.0.0", "@solana/buffer-layout@^4.0.1": 61 | version "4.0.1" 62 | resolved "https://registry.npmjs.org/@solana/buffer-layout/-/buffer-layout-4.0.1.tgz" 63 | integrity sha512-E1ImOIAD1tBZFRdjeM4/pzTiTApC0AOBGwyAMS4fwIodCWArzJ3DWdoh8cKxeFM2fElkxBh2Aqts1BPC373rHA== 64 | dependencies: 65 | buffer "~6.0.3" 66 | 67 | "@solana/codecs-core@2.0.0-rc.1": 68 | version "2.0.0-rc.1" 69 | resolved "https://registry.npmjs.org/@solana/codecs-core/-/codecs-core-2.0.0-rc.1.tgz" 70 | integrity sha512-bauxqMfSs8EHD0JKESaNmNuNvkvHSuN3bbWAF5RjOfDu2PugxHrvRebmYauvSumZ3cTfQ4HJJX6PG5rN852qyQ== 71 | dependencies: 72 | "@solana/errors" "2.0.0-rc.1" 73 | 74 | "@solana/codecs-core@2.3.0": 75 | version "2.3.0" 76 | resolved "https://registry.npmjs.org/@solana/codecs-core/-/codecs-core-2.3.0.tgz" 77 | integrity sha512-oG+VZzN6YhBHIoSKgS5ESM9VIGzhWjEHEGNPSibiDTxFhsFWxNaz8LbMDPjBUE69r9wmdGLkrQ+wVPbnJcZPvw== 78 | dependencies: 79 | "@solana/errors" "2.3.0" 80 | 81 | "@solana/codecs-data-structures@2.0.0-rc.1": 82 | version "2.0.0-rc.1" 83 | resolved "https://registry.npmjs.org/@solana/codecs-data-structures/-/codecs-data-structures-2.0.0-rc.1.tgz" 84 | integrity sha512-rinCv0RrAVJ9rE/rmaibWJQxMwC5lSaORSZuwjopSUE6T0nb/MVg6Z1siNCXhh/HFTOg0l8bNvZHgBcN/yvXog== 85 | dependencies: 86 | "@solana/codecs-core" "2.0.0-rc.1" 87 | "@solana/codecs-numbers" "2.0.0-rc.1" 88 | "@solana/errors" "2.0.0-rc.1" 89 | 90 | "@solana/codecs-numbers@^2.1.0": 91 | version "2.3.0" 92 | resolved "https://registry.npmjs.org/@solana/codecs-numbers/-/codecs-numbers-2.3.0.tgz" 93 | integrity sha512-jFvvwKJKffvG7Iz9dmN51OGB7JBcy2CJ6Xf3NqD/VP90xak66m/Lg48T01u5IQ/hc15mChVHiBm+HHuOFDUrQg== 94 | dependencies: 95 | "@solana/codecs-core" "2.3.0" 96 | "@solana/errors" "2.3.0" 97 | 98 | "@solana/codecs-numbers@2.0.0-rc.1": 99 | version "2.0.0-rc.1" 100 | resolved "https://registry.npmjs.org/@solana/codecs-numbers/-/codecs-numbers-2.0.0-rc.1.tgz" 101 | integrity sha512-J5i5mOkvukXn8E3Z7sGIPxsThRCgSdgTWJDQeZvucQ9PT6Y3HiVXJ0pcWiOWAoQ3RX8e/f4I3IC+wE6pZiJzDQ== 102 | dependencies: 103 | "@solana/codecs-core" "2.0.0-rc.1" 104 | "@solana/errors" "2.0.0-rc.1" 105 | 106 | "@solana/codecs-strings@2.0.0-rc.1": 107 | version "2.0.0-rc.1" 108 | resolved "https://registry.npmjs.org/@solana/codecs-strings/-/codecs-strings-2.0.0-rc.1.tgz" 109 | integrity sha512-9/wPhw8TbGRTt6mHC4Zz1RqOnuPTqq1Nb4EyuvpZ39GW6O2t2Q7Q0XxiB3+BdoEjwA2XgPw6e2iRfvYgqty44g== 110 | dependencies: 111 | "@solana/codecs-core" "2.0.0-rc.1" 112 | "@solana/codecs-numbers" "2.0.0-rc.1" 113 | "@solana/errors" "2.0.0-rc.1" 114 | 115 | "@solana/codecs@2.0.0-rc.1": 116 | version "2.0.0-rc.1" 117 | resolved "https://registry.npmjs.org/@solana/codecs/-/codecs-2.0.0-rc.1.tgz" 118 | integrity sha512-qxoR7VybNJixV51L0G1RD2boZTcxmwUWnKCaJJExQ5qNKwbpSyDdWfFJfM5JhGyKe9DnPVOZB+JHWXnpbZBqrQ== 119 | dependencies: 120 | "@solana/codecs-core" "2.0.0-rc.1" 121 | "@solana/codecs-data-structures" "2.0.0-rc.1" 122 | "@solana/codecs-numbers" "2.0.0-rc.1" 123 | "@solana/codecs-strings" "2.0.0-rc.1" 124 | "@solana/options" "2.0.0-rc.1" 125 | 126 | "@solana/errors@2.0.0-rc.1": 127 | version "2.0.0-rc.1" 128 | resolved "https://registry.npmjs.org/@solana/errors/-/errors-2.0.0-rc.1.tgz" 129 | integrity sha512-ejNvQ2oJ7+bcFAYWj225lyRkHnixuAeb7RQCixm+5mH4n1IA4Qya/9Bmfy5RAAHQzxK43clu3kZmL5eF9VGtYQ== 130 | dependencies: 131 | chalk "^5.3.0" 132 | commander "^12.1.0" 133 | 134 | "@solana/errors@2.3.0": 135 | version "2.3.0" 136 | resolved "https://registry.npmjs.org/@solana/errors/-/errors-2.3.0.tgz" 137 | integrity sha512-66RI9MAbwYV0UtP7kGcTBVLxJgUxoZGm8Fbc0ah+lGiAw17Gugco6+9GrJCV83VyF2mDWyYnYM9qdI3yjgpnaQ== 138 | dependencies: 139 | chalk "^5.4.1" 140 | commander "^14.0.0" 141 | 142 | "@solana/options@2.0.0-rc.1": 143 | version "2.0.0-rc.1" 144 | resolved "https://registry.npmjs.org/@solana/options/-/options-2.0.0-rc.1.tgz" 145 | integrity sha512-mLUcR9mZ3qfHlmMnREdIFPf9dpMc/Bl66tLSOOWxw4ml5xMT2ohFn7WGqoKcu/UHkT9CrC6+amEdqCNvUqI7AA== 146 | dependencies: 147 | "@solana/codecs-core" "2.0.0-rc.1" 148 | "@solana/codecs-data-structures" "2.0.0-rc.1" 149 | "@solana/codecs-numbers" "2.0.0-rc.1" 150 | "@solana/codecs-strings" "2.0.0-rc.1" 151 | "@solana/errors" "2.0.0-rc.1" 152 | 153 | "@solana/spl-token-group@^0.0.7": 154 | version "0.0.7" 155 | resolved "https://registry.npmjs.org/@solana/spl-token-group/-/spl-token-group-0.0.7.tgz" 156 | integrity sha512-V1N/iX7Cr7H0uazWUT2uk27TMqlqedpXHRqqAbVO2gvmJyT0E0ummMEAVQeXZ05ZhQ/xF39DLSdBp90XebWEug== 157 | dependencies: 158 | "@solana/codecs" "2.0.0-rc.1" 159 | 160 | "@solana/spl-token-metadata@^0.1.6": 161 | version "0.1.6" 162 | resolved "https://registry.npmjs.org/@solana/spl-token-metadata/-/spl-token-metadata-0.1.6.tgz" 163 | integrity sha512-7sMt1rsm/zQOQcUWllQX9mD2O6KhSAtY1hFR2hfFwgqfFWzSY9E9GDvFVNYUI1F0iQKcm6HmePU9QbKRXTEBiA== 164 | dependencies: 165 | "@solana/codecs" "2.0.0-rc.1" 166 | 167 | "@solana/spl-token@^0.4.6": 168 | version "0.4.13" 169 | resolved "https://registry.npmjs.org/@solana/spl-token/-/spl-token-0.4.13.tgz" 170 | integrity sha512-cite/pYWQZZVvLbg5lsodSovbetK/eA24gaR0eeUeMuBAMNrT8XFCwaygKy0N2WSg3gSyjjNpIeAGBAKZaY/1w== 171 | dependencies: 172 | "@solana/buffer-layout" "^4.0.0" 173 | "@solana/buffer-layout-utils" "^0.2.0" 174 | "@solana/spl-token-group" "^0.0.7" 175 | "@solana/spl-token-metadata" "^0.1.6" 176 | buffer "^6.0.3" 177 | 178 | "@solana/web3.js@^1.32.0", "@solana/web3.js@^1.68.0", "@solana/web3.js@^1.91.8", "@solana/web3.js@^1.95.3", "@solana/web3.js@^1.95.5": 179 | version "1.98.2" 180 | resolved "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.98.2.tgz" 181 | integrity sha512-BqVwEG+TaG2yCkBMbD3C4hdpustR4FpuUFRPUmqRZYYlPI9Hg4XMWxHWOWRzHE9Lkc9NDjzXFX7lDXSgzC7R1A== 182 | dependencies: 183 | "@babel/runtime" "^7.25.0" 184 | "@noble/curves" "^1.4.2" 185 | "@noble/hashes" "^1.4.0" 186 | "@solana/buffer-layout" "^4.0.1" 187 | "@solana/codecs-numbers" "^2.1.0" 188 | agentkeepalive "^4.5.0" 189 | bn.js "^5.2.1" 190 | borsh "^0.7.0" 191 | bs58 "^4.0.1" 192 | buffer "6.0.3" 193 | fast-stable-stringify "^1.0.0" 194 | jayson "^4.1.1" 195 | node-fetch "^2.7.0" 196 | rpc-websockets "^9.0.2" 197 | superstruct "^2.0.2" 198 | 199 | "@swc/helpers@^0.5.11": 200 | version "0.5.17" 201 | resolved "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.17.tgz" 202 | integrity sha512-5IKx/Y13RsYd+sauPb2x+U/xZikHjolzfuDgTAl/Tdf3Q8rslRvC19NKDLgAJQ6wsqADk10ntlv08nPFw/gO/A== 203 | dependencies: 204 | tslib "^2.8.0" 205 | 206 | "@types/bn.js@^5.1.0": 207 | version "5.2.0" 208 | resolved "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.2.0.tgz" 209 | integrity sha512-DLbJ1BPqxvQhIGbeu8VbUC1DiAiahHtAYvA0ZEAa4P31F7IaArc8z3C3BRQdWX4mtLQuABG4yzp76ZrS02Ui1Q== 210 | dependencies: 211 | "@types/node" "*" 212 | 213 | "@types/chai@^4.3.0": 214 | version "4.3.20" 215 | resolved "https://registry.npmjs.org/@types/chai/-/chai-4.3.20.tgz" 216 | integrity sha512-/pC9HAB5I/xMlc5FP77qjCnI16ChlJfW0tGa0IUcFn38VJrTV6DeZ60NU5KZBtaOZqjdpwTWohz5HU1RrhiYxQ== 217 | 218 | "@types/connect@^3.4.33": 219 | version "3.4.38" 220 | resolved "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz" 221 | integrity sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug== 222 | dependencies: 223 | "@types/node" "*" 224 | 225 | "@types/json5@^0.0.29": 226 | version "0.0.29" 227 | resolved "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz" 228 | integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ== 229 | 230 | "@types/mocha@^9.0.0": 231 | version "9.1.1" 232 | resolved "https://registry.npmjs.org/@types/mocha/-/mocha-9.1.1.tgz" 233 | integrity sha512-Z61JK7DKDtdKTWwLeElSEBcWGRLY8g95ic5FoQqI9CMx0ns/Ghep3B4DfcEimiKMvtamNVULVNKEsiwV3aQmXw== 234 | 235 | "@types/node@*": 236 | version "24.1.0" 237 | resolved "https://registry.npmjs.org/@types/node/-/node-24.1.0.tgz" 238 | integrity sha512-ut5FthK5moxFKH2T1CUOC6ctR67rQRvvHdFLCD2Ql6KXmMuCrjsSsRI9UsLCm9M18BMwClv4pn327UvB7eeO1w== 239 | dependencies: 240 | undici-types "~7.8.0" 241 | 242 | "@types/node@^12.12.54": 243 | version "12.20.55" 244 | resolved "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz" 245 | integrity sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ== 246 | 247 | "@types/uuid@^8.3.4": 248 | version "8.3.4" 249 | resolved "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.4.tgz" 250 | integrity sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw== 251 | 252 | "@types/ws@^7.4.4": 253 | version "7.4.7" 254 | resolved "https://registry.npmjs.org/@types/ws/-/ws-7.4.7.tgz" 255 | integrity sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww== 256 | dependencies: 257 | "@types/node" "*" 258 | 259 | "@types/ws@^8.2.2": 260 | version "8.18.1" 261 | resolved "https://registry.npmjs.org/@types/ws/-/ws-8.18.1.tgz" 262 | integrity sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg== 263 | dependencies: 264 | "@types/node" "*" 265 | 266 | "@ungap/promise-all-settled@1.1.2": 267 | version "1.1.2" 268 | resolved "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz" 269 | integrity sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q== 270 | 271 | agentkeepalive@^4.5.0: 272 | version "4.6.0" 273 | resolved "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.6.0.tgz" 274 | integrity sha512-kja8j7PjmncONqaTsB8fQ+wE2mSU2DJ9D4XKoJ5PFWIdRMa6SLSN1ff4mOr4jCbfRSsxR4keIiySJU0N9T5hIQ== 275 | dependencies: 276 | humanize-ms "^1.2.1" 277 | 278 | ansi-colors@4.1.1: 279 | version "4.1.1" 280 | resolved "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz" 281 | integrity sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA== 282 | 283 | ansi-regex@^5.0.1: 284 | version "5.0.1" 285 | resolved "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz" 286 | integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== 287 | 288 | ansi-styles@^4.0.0, ansi-styles@^4.1.0: 289 | version "4.3.0" 290 | resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz" 291 | integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== 292 | dependencies: 293 | color-convert "^2.0.1" 294 | 295 | anymatch@~3.1.2: 296 | version "3.1.3" 297 | resolved "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz" 298 | integrity sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw== 299 | dependencies: 300 | normalize-path "^3.0.0" 301 | picomatch "^2.0.4" 302 | 303 | argparse@^2.0.1: 304 | version "2.0.1" 305 | resolved "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz" 306 | integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== 307 | 308 | arrify@^1.0.0: 309 | version "1.0.1" 310 | resolved "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz" 311 | integrity sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA== 312 | 313 | assertion-error@^1.1.0: 314 | version "1.1.0" 315 | resolved "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz" 316 | integrity sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw== 317 | 318 | balanced-match@^1.0.0: 319 | version "1.0.2" 320 | resolved "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz" 321 | integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== 322 | 323 | base-x@^3.0.2: 324 | version "3.0.11" 325 | resolved "https://registry.npmjs.org/base-x/-/base-x-3.0.11.tgz" 326 | integrity sha512-xz7wQ8xDhdyP7tQxwdteLYeFfS68tSMNCZ/Y37WJ4bhGfKPpqEIlmIyueQHqOyoPhE6xNUqjzRr8ra0eF9VRvA== 327 | dependencies: 328 | safe-buffer "^5.0.1" 329 | 330 | base64-js@^1.3.1: 331 | version "1.5.1" 332 | resolved "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz" 333 | integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== 334 | 335 | bigint-buffer@^1.1.5: 336 | version "1.1.5" 337 | resolved "https://registry.npmjs.org/bigint-buffer/-/bigint-buffer-1.1.5.tgz" 338 | integrity sha512-trfYco6AoZ+rKhKnxA0hgX0HAbVP/s808/EuDSe2JDzUnCp/xAsli35Orvk67UrTEcwuxZqYZDmfA2RXJgxVvA== 339 | dependencies: 340 | bindings "^1.3.0" 341 | 342 | bignumber.js@^9.0.1: 343 | version "9.3.1" 344 | resolved "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.3.1.tgz" 345 | integrity sha512-Ko0uX15oIUS7wJ3Rb30Fs6SkVbLmPBAKdlm7q9+ak9bbIeFf0MwuBsQV6z7+X768/cHsfg+WlysDWJcmthjsjQ== 346 | 347 | binary-extensions@^2.0.0: 348 | version "2.3.0" 349 | resolved "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz" 350 | integrity sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw== 351 | 352 | bindings@^1.3.0: 353 | version "1.5.0" 354 | resolved "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz" 355 | integrity sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ== 356 | dependencies: 357 | file-uri-to-path "1.0.0" 358 | 359 | bn.js@^5.1.2, bn.js@^5.2.0, bn.js@^5.2.1: 360 | version "5.2.2" 361 | resolved "https://registry.npmjs.org/bn.js/-/bn.js-5.2.2.tgz" 362 | integrity sha512-v2YAxEmKaBLahNwE1mjp4WON6huMNeuDvagFZW+ASCuA/ku0bXR9hSMw0XpiqMoA3+rmnyck/tPRSFQkoC9Cuw== 363 | 364 | borsh@^0.7.0: 365 | version "0.7.0" 366 | resolved "https://registry.npmjs.org/borsh/-/borsh-0.7.0.tgz" 367 | integrity sha512-CLCsZGIBCFnPtkNnieW/a8wmreDmfUtjU2m9yHrzPXIlNbqVs0AQrSatSG6vdNYUqdc83tkQi2eHfF98ubzQLA== 368 | dependencies: 369 | bn.js "^5.2.0" 370 | bs58 "^4.0.0" 371 | text-encoding-utf-8 "^1.0.2" 372 | 373 | brace-expansion@^1.1.7: 374 | version "1.1.12" 375 | resolved "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz" 376 | integrity sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg== 377 | dependencies: 378 | balanced-match "^1.0.0" 379 | concat-map "0.0.1" 380 | 381 | braces@~3.0.2: 382 | version "3.0.3" 383 | resolved "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz" 384 | integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA== 385 | dependencies: 386 | fill-range "^7.1.1" 387 | 388 | browser-stdout@1.3.1: 389 | version "1.3.1" 390 | resolved "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz" 391 | integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== 392 | 393 | bs58@^4.0.0, bs58@^4.0.1: 394 | version "4.0.1" 395 | resolved "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz" 396 | integrity sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw== 397 | dependencies: 398 | base-x "^3.0.2" 399 | 400 | buffer-from@^1.0.0, buffer-from@^1.1.0: 401 | version "1.1.2" 402 | resolved "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz" 403 | integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== 404 | 405 | buffer-layout@^1.2.0, buffer-layout@^1.2.2: 406 | version "1.2.2" 407 | resolved "https://registry.npmjs.org/buffer-layout/-/buffer-layout-1.2.2.tgz" 408 | integrity sha512-kWSuLN694+KTk8SrYvCqwP2WcgQjoRCiF5b4QDvkkz8EmgD+aWAIceGFKMIAdmF/pH+vpgNV3d3kAKorcdAmWA== 409 | 410 | buffer@^6.0.3, buffer@~6.0.3, buffer@6.0.3: 411 | version "6.0.3" 412 | resolved "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz" 413 | integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA== 414 | dependencies: 415 | base64-js "^1.3.1" 416 | ieee754 "^1.2.1" 417 | 418 | bufferutil@^4.0.1: 419 | version "4.0.9" 420 | resolved "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.9.tgz" 421 | integrity sha512-WDtdLmJvAuNNPzByAYpRo2rF1Mmradw6gvWsQKf63476DDXmomT9zUiGypLcG4ibIM67vhAj8jJRdbmEws2Aqw== 422 | dependencies: 423 | node-gyp-build "^4.3.0" 424 | 425 | camelcase@^6.0.0, camelcase@^6.3.0: 426 | version "6.3.0" 427 | resolved "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz" 428 | integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== 429 | 430 | chai@^4.3.4: 431 | version "4.5.0" 432 | resolved "https://registry.npmjs.org/chai/-/chai-4.5.0.tgz" 433 | integrity sha512-RITGBfijLkBddZvnn8jdqoTypxvqbOLYQkGGxXzeFjVHvudaPw0HNFD9x928/eUwYWd2dPCugVqspGALTZZQKw== 434 | dependencies: 435 | assertion-error "^1.1.0" 436 | check-error "^1.0.3" 437 | deep-eql "^4.1.3" 438 | get-func-name "^2.0.2" 439 | loupe "^2.3.6" 440 | pathval "^1.1.1" 441 | type-detect "^4.1.0" 442 | 443 | chalk@^4.1.0: 444 | version "4.1.2" 445 | resolved "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz" 446 | integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== 447 | dependencies: 448 | ansi-styles "^4.1.0" 449 | supports-color "^7.1.0" 450 | 451 | chalk@^5.3.0, chalk@^5.4.1: 452 | version "5.4.1" 453 | resolved "https://registry.npmjs.org/chalk/-/chalk-5.4.1.tgz" 454 | integrity sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w== 455 | 456 | check-error@^1.0.3: 457 | version "1.0.3" 458 | resolved "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz" 459 | integrity sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg== 460 | dependencies: 461 | get-func-name "^2.0.2" 462 | 463 | chokidar@3.5.3: 464 | version "3.5.3" 465 | resolved "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz" 466 | integrity sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw== 467 | dependencies: 468 | anymatch "~3.1.2" 469 | braces "~3.0.2" 470 | glob-parent "~5.1.2" 471 | is-binary-path "~2.1.0" 472 | is-glob "~4.0.1" 473 | normalize-path "~3.0.0" 474 | readdirp "~3.6.0" 475 | optionalDependencies: 476 | fsevents "~2.3.2" 477 | 478 | cliui@^7.0.2: 479 | version "7.0.4" 480 | resolved "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz" 481 | integrity sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ== 482 | dependencies: 483 | string-width "^4.2.0" 484 | strip-ansi "^6.0.0" 485 | wrap-ansi "^7.0.0" 486 | 487 | color-convert@^2.0.1: 488 | version "2.0.1" 489 | resolved "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz" 490 | integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== 491 | dependencies: 492 | color-name "~1.1.4" 493 | 494 | color-name@~1.1.4: 495 | version "1.1.4" 496 | resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz" 497 | integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== 498 | 499 | commander@^12.1.0: 500 | version "12.1.0" 501 | resolved "https://registry.npmjs.org/commander/-/commander-12.1.0.tgz" 502 | integrity sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA== 503 | 504 | commander@^14.0.0: 505 | version "14.0.0" 506 | resolved "https://registry.npmjs.org/commander/-/commander-14.0.0.tgz" 507 | integrity sha512-2uM9rYjPvyq39NwLRqaiLtWHyDC1FvryJDa2ATTVims5YAS4PupsEQsDvP14FqhFr0P49CYDugi59xaxJlTXRA== 508 | 509 | commander@^2.20.3: 510 | version "2.20.3" 511 | resolved "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz" 512 | integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== 513 | 514 | concat-map@0.0.1: 515 | version "0.0.1" 516 | resolved "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz" 517 | integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== 518 | 519 | cross-fetch@^3.1.5: 520 | version "3.2.0" 521 | resolved "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.2.0.tgz" 522 | integrity sha512-Q+xVJLoGOeIMXZmbUK4HYk+69cQH6LudR0Vu/pRm2YlU/hDV9CiS0gKUMaWY5f2NeUH9C1nV3bsTlCo0FsTV1Q== 523 | dependencies: 524 | node-fetch "^2.7.0" 525 | 526 | crypto-hash@^1.3.0: 527 | version "1.3.0" 528 | resolved "https://registry.npmjs.org/crypto-hash/-/crypto-hash-1.3.0.tgz" 529 | integrity sha512-lyAZ0EMyjDkVvz8WOeVnuCPvKVBXcMv1l5SVqO1yC7PzTwrD/pPje/BIRbWhMoPe436U+Y2nD7f5bFx0kt+Sbg== 530 | 531 | debug@4.3.3: 532 | version "4.3.3" 533 | resolved "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz" 534 | integrity sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q== 535 | dependencies: 536 | ms "2.1.2" 537 | 538 | decamelize@^4.0.0: 539 | version "4.0.0" 540 | resolved "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz" 541 | integrity sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ== 542 | 543 | deep-eql@^4.1.3: 544 | version "4.1.4" 545 | resolved "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.4.tgz" 546 | integrity sha512-SUwdGfqdKOwxCPeVYjwSyRpJ7Z+fhpwIAtmCUdZIWZ/YP5R9WAsyuSgpLVDi9bjWoN2LXHNss/dk3urXtdQxGg== 547 | dependencies: 548 | type-detect "^4.0.0" 549 | 550 | delay@^5.0.0: 551 | version "5.0.0" 552 | resolved "https://registry.npmjs.org/delay/-/delay-5.0.0.tgz" 553 | integrity sha512-ReEBKkIfe4ya47wlPYf/gu5ib6yUG0/Aez0JQZQz94kiWtRQvZIQbTiehsnwHvLSWJnQdhVeqYue7Id1dKr0qw== 554 | 555 | diff@^3.1.0: 556 | version "3.5.0" 557 | resolved "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz" 558 | integrity sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA== 559 | 560 | diff@5.0.0: 561 | version "5.0.0" 562 | resolved "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz" 563 | integrity sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w== 564 | 565 | dot-case@^3.0.4: 566 | version "3.0.4" 567 | resolved "https://registry.npmjs.org/dot-case/-/dot-case-3.0.4.tgz" 568 | integrity sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w== 569 | dependencies: 570 | no-case "^3.0.4" 571 | tslib "^2.0.3" 572 | 573 | emoji-regex@^8.0.0: 574 | version "8.0.0" 575 | resolved "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz" 576 | integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== 577 | 578 | es6-promise@^4.0.3: 579 | version "4.2.8" 580 | resolved "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz" 581 | integrity sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w== 582 | 583 | es6-promisify@^5.0.0: 584 | version "5.0.0" 585 | resolved "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz" 586 | integrity sha512-C+d6UdsYDk0lMebHNR4S2NybQMMngAOnOwYBQjTOiv0MkoJMP0Myw2mgpDLBcpfCmRLxyFqYhS/CfOENq4SJhQ== 587 | dependencies: 588 | es6-promise "^4.0.3" 589 | 590 | escalade@^3.1.1: 591 | version "3.2.0" 592 | resolved "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz" 593 | integrity sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA== 594 | 595 | escape-string-regexp@4.0.0: 596 | version "4.0.0" 597 | resolved "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz" 598 | integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== 599 | 600 | eventemitter3@^4.0.7: 601 | version "4.0.7" 602 | resolved "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz" 603 | integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw== 604 | 605 | eventemitter3@^5.0.1: 606 | version "5.0.1" 607 | resolved "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz" 608 | integrity sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA== 609 | 610 | eyes@^0.1.8: 611 | version "0.1.8" 612 | resolved "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz" 613 | integrity sha512-GipyPsXO1anza0AOZdy69Im7hGFCNB7Y/NGjDlZGJ3GJJLtwNSb2vrzYrTYJRrRloVx7pl+bhUaTB8yiccPvFQ== 614 | 615 | fast-stable-stringify@^1.0.0: 616 | version "1.0.0" 617 | resolved "https://registry.npmjs.org/fast-stable-stringify/-/fast-stable-stringify-1.0.0.tgz" 618 | integrity sha512-wpYMUmFu5f00Sm0cj2pfivpmawLZ0NKdviQ4w9zJeR8JVtOpOxHmLaJuj0vxvGqMJQWyP/COUkF75/57OKyRag== 619 | 620 | fastestsmallesttextencoderdecoder@^1.0.22: 621 | version "1.0.22" 622 | resolved "https://registry.npmjs.org/fastestsmallesttextencoderdecoder/-/fastestsmallesttextencoderdecoder-1.0.22.tgz" 623 | integrity sha512-Pb8d48e+oIuY4MaM64Cd7OW1gt4nxCHs7/ddPPZ/Ic3sg8yVGM7O9wDvZ7us6ScaUupzM+pfBolwtYhN1IxBIw== 624 | 625 | file-uri-to-path@1.0.0: 626 | version "1.0.0" 627 | resolved "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz" 628 | integrity sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw== 629 | 630 | fill-range@^7.1.1: 631 | version "7.1.1" 632 | resolved "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz" 633 | integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg== 634 | dependencies: 635 | to-regex-range "^5.0.1" 636 | 637 | find-up@5.0.0: 638 | version "5.0.0" 639 | resolved "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz" 640 | integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== 641 | dependencies: 642 | locate-path "^6.0.0" 643 | path-exists "^4.0.0" 644 | 645 | flat@^5.0.2: 646 | version "5.0.2" 647 | resolved "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz" 648 | integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ== 649 | 650 | fs.realpath@^1.0.0: 651 | version "1.0.0" 652 | resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz" 653 | integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== 654 | 655 | get-caller-file@^2.0.5: 656 | version "2.0.5" 657 | resolved "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz" 658 | integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== 659 | 660 | get-func-name@^2.0.1, get-func-name@^2.0.2: 661 | version "2.0.2" 662 | resolved "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz" 663 | integrity sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ== 664 | 665 | glob-parent@~5.1.2: 666 | version "5.1.2" 667 | resolved "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz" 668 | integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== 669 | dependencies: 670 | is-glob "^4.0.1" 671 | 672 | glob@7.2.0: 673 | version "7.2.0" 674 | resolved "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz" 675 | integrity sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q== 676 | dependencies: 677 | fs.realpath "^1.0.0" 678 | inflight "^1.0.4" 679 | inherits "2" 680 | minimatch "^3.0.4" 681 | once "^1.3.0" 682 | path-is-absolute "^1.0.0" 683 | 684 | growl@1.10.5: 685 | version "1.10.5" 686 | resolved "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz" 687 | integrity sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA== 688 | 689 | has-flag@^4.0.0: 690 | version "4.0.0" 691 | resolved "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz" 692 | integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== 693 | 694 | he@1.2.0: 695 | version "1.2.0" 696 | resolved "https://registry.npmjs.org/he/-/he-1.2.0.tgz" 697 | integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== 698 | 699 | humanize-ms@^1.2.1: 700 | version "1.2.1" 701 | resolved "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz" 702 | integrity sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ== 703 | dependencies: 704 | ms "^2.0.0" 705 | 706 | ieee754@^1.2.1: 707 | version "1.2.1" 708 | resolved "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz" 709 | integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== 710 | 711 | inflight@^1.0.4: 712 | version "1.0.6" 713 | resolved "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz" 714 | integrity sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA== 715 | dependencies: 716 | once "^1.3.0" 717 | wrappy "1" 718 | 719 | inherits@2: 720 | version "2.0.4" 721 | resolved "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz" 722 | integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== 723 | 724 | is-binary-path@~2.1.0: 725 | version "2.1.0" 726 | resolved "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz" 727 | integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== 728 | dependencies: 729 | binary-extensions "^2.0.0" 730 | 731 | is-extglob@^2.1.1: 732 | version "2.1.1" 733 | resolved "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz" 734 | integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ== 735 | 736 | is-fullwidth-code-point@^3.0.0: 737 | version "3.0.0" 738 | resolved "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz" 739 | integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== 740 | 741 | is-glob@^4.0.1, is-glob@~4.0.1: 742 | version "4.0.3" 743 | resolved "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz" 744 | integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== 745 | dependencies: 746 | is-extglob "^2.1.1" 747 | 748 | is-number@^7.0.0: 749 | version "7.0.0" 750 | resolved "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz" 751 | integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== 752 | 753 | is-plain-obj@^2.1.0: 754 | version "2.1.0" 755 | resolved "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz" 756 | integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA== 757 | 758 | is-unicode-supported@^0.1.0: 759 | version "0.1.0" 760 | resolved "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz" 761 | integrity sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw== 762 | 763 | isexe@^2.0.0: 764 | version "2.0.0" 765 | resolved "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz" 766 | integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== 767 | 768 | isomorphic-ws@^4.0.1: 769 | version "4.0.1" 770 | resolved "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz" 771 | integrity sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w== 772 | 773 | jayson@^4.1.1: 774 | version "4.2.0" 775 | resolved "https://registry.npmjs.org/jayson/-/jayson-4.2.0.tgz" 776 | integrity sha512-VfJ9t1YLwacIubLhONk0KFeosUBwstRWQ0IRT1KDjEjnVnSOVHC3uwugyV7L0c7R9lpVyrUGT2XWiBA1UTtpyg== 777 | dependencies: 778 | "@types/connect" "^3.4.33" 779 | "@types/node" "^12.12.54" 780 | "@types/ws" "^7.4.4" 781 | commander "^2.20.3" 782 | delay "^5.0.0" 783 | es6-promisify "^5.0.0" 784 | eyes "^0.1.8" 785 | isomorphic-ws "^4.0.1" 786 | json-stringify-safe "^5.0.1" 787 | stream-json "^1.9.1" 788 | uuid "^8.3.2" 789 | ws "^7.5.10" 790 | 791 | js-yaml@4.1.0: 792 | version "4.1.0" 793 | resolved "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz" 794 | integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== 795 | dependencies: 796 | argparse "^2.0.1" 797 | 798 | json-stringify-safe@^5.0.1: 799 | version "5.0.1" 800 | resolved "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz" 801 | integrity sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA== 802 | 803 | json5@^1.0.2: 804 | version "1.0.2" 805 | resolved "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz" 806 | integrity sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA== 807 | dependencies: 808 | minimist "^1.2.0" 809 | 810 | locate-path@^6.0.0: 811 | version "6.0.0" 812 | resolved "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz" 813 | integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw== 814 | dependencies: 815 | p-locate "^5.0.0" 816 | 817 | log-symbols@4.1.0: 818 | version "4.1.0" 819 | resolved "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz" 820 | integrity sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg== 821 | dependencies: 822 | chalk "^4.1.0" 823 | is-unicode-supported "^0.1.0" 824 | 825 | loupe@^2.3.6: 826 | version "2.3.7" 827 | resolved "https://registry.npmjs.org/loupe/-/loupe-2.3.7.tgz" 828 | integrity sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA== 829 | dependencies: 830 | get-func-name "^2.0.1" 831 | 832 | lower-case@^2.0.2: 833 | version "2.0.2" 834 | resolved "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz" 835 | integrity sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg== 836 | dependencies: 837 | tslib "^2.0.3" 838 | 839 | make-error@^1.1.1: 840 | version "1.3.6" 841 | resolved "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz" 842 | integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== 843 | 844 | minimatch@^3.0.4: 845 | version "3.1.2" 846 | resolved "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz" 847 | integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== 848 | dependencies: 849 | brace-expansion "^1.1.7" 850 | 851 | minimatch@4.2.1: 852 | version "4.2.1" 853 | resolved "https://registry.npmjs.org/minimatch/-/minimatch-4.2.1.tgz" 854 | integrity sha512-9Uq1ChtSZO+Mxa/CL1eGizn2vRn3MlLgzhT0Iz8zaY8NdvxvB0d5QdPFmCKf7JKA9Lerx5vRrnwO03jsSfGG9g== 855 | dependencies: 856 | brace-expansion "^1.1.7" 857 | 858 | minimist@^1.2.0, minimist@^1.2.6: 859 | version "1.2.8" 860 | resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz" 861 | integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== 862 | 863 | mkdirp@^0.5.1: 864 | version "0.5.6" 865 | resolved "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz" 866 | integrity sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw== 867 | dependencies: 868 | minimist "^1.2.6" 869 | 870 | "mocha@^3.X.X || ^4.X.X || ^5.X.X || ^6.X.X || ^7.X.X || ^8.X.X || ^9.X.X || ^10.X.X || ^11.X.X", mocha@^9.0.3: 871 | version "9.2.2" 872 | resolved "https://registry.npmjs.org/mocha/-/mocha-9.2.2.tgz" 873 | integrity sha512-L6XC3EdwT6YrIk0yXpavvLkn8h+EU+Y5UcCHKECyMbdUIxyMuZj4bX4U9e1nvnvUUvQVsV2VHQr5zLdcUkhW/g== 874 | dependencies: 875 | "@ungap/promise-all-settled" "1.1.2" 876 | ansi-colors "4.1.1" 877 | browser-stdout "1.3.1" 878 | chokidar "3.5.3" 879 | debug "4.3.3" 880 | diff "5.0.0" 881 | escape-string-regexp "4.0.0" 882 | find-up "5.0.0" 883 | glob "7.2.0" 884 | growl "1.10.5" 885 | he "1.2.0" 886 | js-yaml "4.1.0" 887 | log-symbols "4.1.0" 888 | minimatch "4.2.1" 889 | ms "2.1.3" 890 | nanoid "3.3.1" 891 | serialize-javascript "6.0.0" 892 | strip-json-comments "3.1.1" 893 | supports-color "8.1.1" 894 | which "2.0.2" 895 | workerpool "6.2.0" 896 | yargs "16.2.0" 897 | yargs-parser "20.2.4" 898 | yargs-unparser "2.0.0" 899 | 900 | ms@^2.0.0, ms@2.1.3: 901 | version "2.1.3" 902 | resolved "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz" 903 | integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== 904 | 905 | ms@2.1.2: 906 | version "2.1.2" 907 | resolved "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz" 908 | integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== 909 | 910 | nanoid@3.3.1: 911 | version "3.3.1" 912 | resolved "https://registry.npmjs.org/nanoid/-/nanoid-3.3.1.tgz" 913 | integrity sha512-n6Vs/3KGyxPQd6uO0eH4Bv0ojGSUvuLlIHtC3Y0kEO23YRge8H9x1GCzLn28YX0H66pMkxuaeESFq4tKISKwdw== 914 | 915 | no-case@^3.0.4: 916 | version "3.0.4" 917 | resolved "https://registry.npmjs.org/no-case/-/no-case-3.0.4.tgz" 918 | integrity sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg== 919 | dependencies: 920 | lower-case "^2.0.2" 921 | tslib "^2.0.3" 922 | 923 | node-fetch@^2.7.0: 924 | version "2.7.0" 925 | resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz" 926 | integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== 927 | dependencies: 928 | whatwg-url "^5.0.0" 929 | 930 | node-gyp-build@^4.3.0: 931 | version "4.8.4" 932 | resolved "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.4.tgz" 933 | integrity sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ== 934 | 935 | normalize-path@^3.0.0, normalize-path@~3.0.0: 936 | version "3.0.0" 937 | resolved "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz" 938 | integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== 939 | 940 | once@^1.3.0: 941 | version "1.4.0" 942 | resolved "https://registry.npmjs.org/once/-/once-1.4.0.tgz" 943 | integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== 944 | dependencies: 945 | wrappy "1" 946 | 947 | p-limit@^3.0.2: 948 | version "3.1.0" 949 | resolved "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz" 950 | integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== 951 | dependencies: 952 | yocto-queue "^0.1.0" 953 | 954 | p-locate@^5.0.0: 955 | version "5.0.0" 956 | resolved "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz" 957 | integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw== 958 | dependencies: 959 | p-limit "^3.0.2" 960 | 961 | pako@^2.0.3: 962 | version "2.1.0" 963 | resolved "https://registry.npmjs.org/pako/-/pako-2.1.0.tgz" 964 | integrity sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug== 965 | 966 | path-exists@^4.0.0: 967 | version "4.0.0" 968 | resolved "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz" 969 | integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== 970 | 971 | path-is-absolute@^1.0.0: 972 | version "1.0.1" 973 | resolved "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz" 974 | integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg== 975 | 976 | pathval@^1.1.1: 977 | version "1.1.1" 978 | resolved "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz" 979 | integrity sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ== 980 | 981 | picomatch@^2.0.4, picomatch@^2.2.1: 982 | version "2.3.1" 983 | resolved "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz" 984 | integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== 985 | 986 | prettier@^2.6.2: 987 | version "2.8.8" 988 | resolved "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz" 989 | integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== 990 | 991 | randombytes@^2.1.0: 992 | version "2.1.0" 993 | resolved "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz" 994 | integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== 995 | dependencies: 996 | safe-buffer "^5.1.0" 997 | 998 | readdirp@~3.6.0: 999 | version "3.6.0" 1000 | resolved "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz" 1001 | integrity sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA== 1002 | dependencies: 1003 | picomatch "^2.2.1" 1004 | 1005 | require-directory@^2.1.1: 1006 | version "2.1.1" 1007 | resolved "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz" 1008 | integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== 1009 | 1010 | rpc-websockets@^9.0.2: 1011 | version "9.1.3" 1012 | resolved "https://registry.npmjs.org/rpc-websockets/-/rpc-websockets-9.1.3.tgz" 1013 | integrity sha512-I+kNjW0udB4Fetr3vvtRuYZJS0PcSPyyvBcH5sDdoV8DFs5E4W2pTr7aiMlKfPxANTClP9RlqCPolj9dd5MsEA== 1014 | dependencies: 1015 | "@swc/helpers" "^0.5.11" 1016 | "@types/uuid" "^8.3.4" 1017 | "@types/ws" "^8.2.2" 1018 | buffer "^6.0.3" 1019 | eventemitter3 "^5.0.1" 1020 | uuid "^8.3.2" 1021 | ws "^8.5.0" 1022 | optionalDependencies: 1023 | bufferutil "^4.0.1" 1024 | utf-8-validate "^5.0.2" 1025 | 1026 | safe-buffer@^5.0.1, safe-buffer@^5.1.0: 1027 | version "5.2.1" 1028 | resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz" 1029 | integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== 1030 | 1031 | serialize-javascript@6.0.0: 1032 | version "6.0.0" 1033 | resolved "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz" 1034 | integrity sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag== 1035 | dependencies: 1036 | randombytes "^2.1.0" 1037 | 1038 | snake-case@^3.0.4: 1039 | version "3.0.4" 1040 | resolved "https://registry.npmjs.org/snake-case/-/snake-case-3.0.4.tgz" 1041 | integrity sha512-LAOh4z89bGQvl9pFfNF8V146i7o7/CqFPbqzYgP+yYzDIDeS9HaNFtXABamRW+AQzEVODcvE79ljJ+8a9YSdMg== 1042 | dependencies: 1043 | dot-case "^3.0.4" 1044 | tslib "^2.0.3" 1045 | 1046 | source-map-support@^0.5.6: 1047 | version "0.5.21" 1048 | resolved "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz" 1049 | integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w== 1050 | dependencies: 1051 | buffer-from "^1.0.0" 1052 | source-map "^0.6.0" 1053 | 1054 | source-map@^0.6.0: 1055 | version "0.6.1" 1056 | resolved "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz" 1057 | integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== 1058 | 1059 | stream-chain@^2.2.5: 1060 | version "2.2.5" 1061 | resolved "https://registry.npmjs.org/stream-chain/-/stream-chain-2.2.5.tgz" 1062 | integrity sha512-1TJmBx6aSWqZ4tx7aTpBDXK0/e2hhcNSTV8+CbFJtDjbb+I1mZ8lHit0Grw9GRT+6JbIrrDd8esncgBi8aBXGA== 1063 | 1064 | stream-json@^1.9.1: 1065 | version "1.9.1" 1066 | resolved "https://registry.npmjs.org/stream-json/-/stream-json-1.9.1.tgz" 1067 | integrity sha512-uWkjJ+2Nt/LO9Z/JyKZbMusL8Dkh97uUBTv3AJQ74y07lVahLY4eEFsPsE97pxYBwr8nnjMAIch5eqI0gPShyw== 1068 | dependencies: 1069 | stream-chain "^2.2.5" 1070 | 1071 | string-width@^4.1.0, string-width@^4.2.0: 1072 | version "4.2.3" 1073 | resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz" 1074 | integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== 1075 | dependencies: 1076 | emoji-regex "^8.0.0" 1077 | is-fullwidth-code-point "^3.0.0" 1078 | strip-ansi "^6.0.1" 1079 | 1080 | strip-ansi@^6.0.0, strip-ansi@^6.0.1: 1081 | version "6.0.1" 1082 | resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz" 1083 | integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== 1084 | dependencies: 1085 | ansi-regex "^5.0.1" 1086 | 1087 | strip-bom@^3.0.0: 1088 | version "3.0.0" 1089 | resolved "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz" 1090 | integrity sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA== 1091 | 1092 | strip-json-comments@3.1.1: 1093 | version "3.1.1" 1094 | resolved "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz" 1095 | integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== 1096 | 1097 | superstruct@^0.15.4: 1098 | version "0.15.5" 1099 | resolved "https://registry.npmjs.org/superstruct/-/superstruct-0.15.5.tgz" 1100 | integrity sha512-4AOeU+P5UuE/4nOUkmcQdW5y7i9ndt1cQd/3iUe+LTz3RxESf/W/5lg4B74HbDMMv8PHnPnGCQFH45kBcrQYoQ== 1101 | 1102 | superstruct@^2.0.2: 1103 | version "2.0.2" 1104 | resolved "https://registry.npmjs.org/superstruct/-/superstruct-2.0.2.tgz" 1105 | integrity sha512-uV+TFRZdXsqXTL2pRvujROjdZQ4RAlBUS5BTh9IGm+jTqQntYThciG/qu57Gs69yjnVUSqdxF9YLmSnpupBW9A== 1106 | 1107 | supports-color@^7.1.0: 1108 | version "7.2.0" 1109 | resolved "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz" 1110 | integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== 1111 | dependencies: 1112 | has-flag "^4.0.0" 1113 | 1114 | supports-color@8.1.1: 1115 | version "8.1.1" 1116 | resolved "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz" 1117 | integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== 1118 | dependencies: 1119 | has-flag "^4.0.0" 1120 | 1121 | text-encoding-utf-8@^1.0.2: 1122 | version "1.0.2" 1123 | resolved "https://registry.npmjs.org/text-encoding-utf-8/-/text-encoding-utf-8-1.0.2.tgz" 1124 | integrity sha512-8bw4MY9WjdsD2aMtO0OzOCY3pXGYNx2d2FfHRVUKkiCPDWjKuOlhLVASS+pD7VkLTVjW268LYJHwsnPFlBpbAg== 1125 | 1126 | to-regex-range@^5.0.1: 1127 | version "5.0.1" 1128 | resolved "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz" 1129 | integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== 1130 | dependencies: 1131 | is-number "^7.0.0" 1132 | 1133 | toml@^3.0.0: 1134 | version "3.0.0" 1135 | resolved "https://registry.npmjs.org/toml/-/toml-3.0.0.tgz" 1136 | integrity sha512-y/mWCZinnvxjTKYhJ+pYxwD0mRLVvOtdS2Awbgxln6iEnt4rk0yBxeSBHkGJcPucRiG0e55mwWp+g/05rsrd6w== 1137 | 1138 | tr46@~0.0.3: 1139 | version "0.0.3" 1140 | resolved "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz" 1141 | integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== 1142 | 1143 | ts-mocha@^10.0.0: 1144 | version "10.1.0" 1145 | resolved "https://registry.npmjs.org/ts-mocha/-/ts-mocha-10.1.0.tgz" 1146 | integrity sha512-T0C0Xm3/WqCuF2tpa0GNGESTBoKZaiqdUP8guNv4ZY316AFXlyidnrzQ1LUrCT0Wb1i3J0zFTgOh/55Un44WdA== 1147 | dependencies: 1148 | ts-node "7.0.1" 1149 | optionalDependencies: 1150 | tsconfig-paths "^3.5.0" 1151 | 1152 | ts-node@7.0.1: 1153 | version "7.0.1" 1154 | resolved "https://registry.npmjs.org/ts-node/-/ts-node-7.0.1.tgz" 1155 | integrity sha512-BVwVbPJRspzNh2yfslyT1PSbl5uIk03EZlb493RKHN4qej/D06n1cEhjlOJG69oFsE7OT8XjpTUcYf6pKTLMhw== 1156 | dependencies: 1157 | arrify "^1.0.0" 1158 | buffer-from "^1.1.0" 1159 | diff "^3.1.0" 1160 | make-error "^1.1.1" 1161 | minimist "^1.2.0" 1162 | mkdirp "^0.5.1" 1163 | source-map-support "^0.5.6" 1164 | yn "^2.0.0" 1165 | 1166 | tsconfig-paths@^3.5.0: 1167 | version "3.15.0" 1168 | resolved "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz" 1169 | integrity sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg== 1170 | dependencies: 1171 | "@types/json5" "^0.0.29" 1172 | json5 "^1.0.2" 1173 | minimist "^1.2.6" 1174 | strip-bom "^3.0.0" 1175 | 1176 | tslib@^2.0.3, tslib@^2.8.0: 1177 | version "2.8.1" 1178 | resolved "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz" 1179 | integrity sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w== 1180 | 1181 | type-detect@^4.0.0, type-detect@^4.1.0: 1182 | version "4.1.0" 1183 | resolved "https://registry.npmjs.org/type-detect/-/type-detect-4.1.0.tgz" 1184 | integrity sha512-Acylog8/luQ8L7il+geoSxhEkazvkslg7PSNKOX59mbB9cOveP5aq9h74Y7YU8yDpJwetzQQrfIwtf4Wp4LKcw== 1185 | 1186 | typescript@^4.3.5, typescript@>=5: 1187 | version "4.9.5" 1188 | resolved "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz" 1189 | integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== 1190 | 1191 | typescript@>=5.3.3: 1192 | version "5.8.3" 1193 | resolved "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz" 1194 | integrity sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ== 1195 | 1196 | undici-types@~7.8.0: 1197 | version "7.8.0" 1198 | resolved "https://registry.npmjs.org/undici-types/-/undici-types-7.8.0.tgz" 1199 | integrity sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw== 1200 | 1201 | utf-8-validate@^5.0.2, utf-8-validate@>=5.0.2: 1202 | version "5.0.10" 1203 | resolved "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz" 1204 | integrity sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ== 1205 | dependencies: 1206 | node-gyp-build "^4.3.0" 1207 | 1208 | uuid@^8.3.2: 1209 | version "8.3.2" 1210 | resolved "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz" 1211 | integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== 1212 | 1213 | webidl-conversions@^3.0.0: 1214 | version "3.0.1" 1215 | resolved "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz" 1216 | integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== 1217 | 1218 | whatwg-url@^5.0.0: 1219 | version "5.0.0" 1220 | resolved "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz" 1221 | integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw== 1222 | dependencies: 1223 | tr46 "~0.0.3" 1224 | webidl-conversions "^3.0.0" 1225 | 1226 | which@2.0.2: 1227 | version "2.0.2" 1228 | resolved "https://registry.npmjs.org/which/-/which-2.0.2.tgz" 1229 | integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== 1230 | dependencies: 1231 | isexe "^2.0.0" 1232 | 1233 | workerpool@6.2.0: 1234 | version "6.2.0" 1235 | resolved "https://registry.npmjs.org/workerpool/-/workerpool-6.2.0.tgz" 1236 | integrity sha512-Rsk5qQHJ9eowMH28Jwhe8HEbmdYDX4lwoMWshiCXugjtHqMD9ZbiqSDLxcsfdqsETPzVUtX5s1Z5kStiIM6l4A== 1237 | 1238 | wrap-ansi@^7.0.0: 1239 | version "7.0.0" 1240 | resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz" 1241 | integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== 1242 | dependencies: 1243 | ansi-styles "^4.0.0" 1244 | string-width "^4.1.0" 1245 | strip-ansi "^6.0.0" 1246 | 1247 | wrappy@1: 1248 | version "1.0.2" 1249 | resolved "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz" 1250 | integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== 1251 | 1252 | ws@*, ws@^7.5.10: 1253 | version "7.5.10" 1254 | resolved "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz" 1255 | integrity sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ== 1256 | 1257 | ws@^8.5.0: 1258 | version "8.18.3" 1259 | resolved "https://registry.npmjs.org/ws/-/ws-8.18.3.tgz" 1260 | integrity sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg== 1261 | 1262 | y18n@^5.0.5: 1263 | version "5.0.8" 1264 | resolved "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz" 1265 | integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== 1266 | 1267 | yargs-parser@^20.2.2: 1268 | version "20.2.9" 1269 | resolved "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz" 1270 | integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== 1271 | 1272 | yargs-parser@20.2.4: 1273 | version "20.2.4" 1274 | resolved "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz" 1275 | integrity sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA== 1276 | 1277 | yargs-unparser@2.0.0: 1278 | version "2.0.0" 1279 | resolved "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz" 1280 | integrity sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA== 1281 | dependencies: 1282 | camelcase "^6.0.0" 1283 | decamelize "^4.0.0" 1284 | flat "^5.0.2" 1285 | is-plain-obj "^2.1.0" 1286 | 1287 | yargs@16.2.0: 1288 | version "16.2.0" 1289 | resolved "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz" 1290 | integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw== 1291 | dependencies: 1292 | cliui "^7.0.2" 1293 | escalade "^3.1.1" 1294 | get-caller-file "^2.0.5" 1295 | require-directory "^2.1.1" 1296 | string-width "^4.2.0" 1297 | y18n "^5.0.5" 1298 | yargs-parser "^20.2.2" 1299 | 1300 | yn@^2.0.0: 1301 | version "2.0.0" 1302 | resolved "https://registry.npmjs.org/yn/-/yn-2.0.0.tgz" 1303 | integrity sha512-uTv8J/wiWTgUTg+9vLTi//leUl5vDQS6uii/emeTb2ssY7vl6QWf2fFbIIGjnhjvbdKlU0ed7QPgY1htTC86jQ== 1304 | 1305 | yocto-queue@^0.1.0: 1306 | version "0.1.0" 1307 | resolved "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz" 1308 | integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== 1309 | --------------------------------------------------------------------------------