New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

flash-sdk

Package Overview
Dependencies
Maintainers
1
Versions
1006
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flash-sdk

Client to interact with the Flash program on Solana

latest
Source
npmnpm
Version
15.14.1
Version published
Weekly downloads
2K
-54.83%
Maintainers
1
Weekly downloads
 
Created
Source

Flash SDK

Client SDK for interacting with FLASH.TRADE's smart-contracts

autogenerated docs : https://flash-trade.github.io/flash-sdk-docs/

npm : https://www.npmjs.com/package/flash-sdk

Install

npm i flash-sdk / yarn add flash-sdk 

Flash SDK

Client SDK for interacting with FLASH.TRADE's smart-contracts

autogenerated docs : https://flash-trade.github.io/flash-sdk-docs/

npm : https://www.npmjs.com/package/flash-sdk

code : https://github.com/flash-trade/flash-trade-sdk.git

Using the SDK

connect sdk locally

  import { AnchorProvider } from "@coral-xyz/anchor";
  import { ComputeBudgetProgram , PublicKey, TransactionInstruction  } from '@solana/web3.js'

  const provider : AnchorProvider = AnchorProvider.local(clusterUrl, {
    commitment: "confirmed",
    preflightCommitment: "confirmed",
    skipPreflight: true
  });
  const perpClient = new PerpetualsClient(provider, programId);

  // NOTE: choose the correct POOL_CONFIG based on the pool you want to interact 
  // flp.1
  const POOL_CONFIG = PoolConfig.fromIdsByName('Crypto.1','mainnet-beta')
  // flp.2
  // const POOL_CONFIG = PoolConfig.fromIdsByName('Virtual.1','mainnet-beta')
  // flp.3
  // const POOL_CONFIG = PoolConfig.fromIdsByName('Governance.1','mainnet-beta')
  // flp.4
  // const POOL_CONFIG = PoolConfig.fromIdsByName('Community.1','mainnet-beta')
  // flp.5
  // const POOL_CONFIG = PoolConfig.fromIdsByName('Community.2','mainnet-beta')
  // flp.7
  // const POOL_CONFIG = PoolConfig.fromIdsByName('Trump.1','mainnet-beta')
  // flp.8
  // const POOL_CONFIG = PoolConfig.fromIdsByName('Ore.1','mainnet-beta')
  // flp.r
  // const POOL_CONFIG = PoolConfig.fromIdsByName('Remora.1','mainnet-beta')

  const poolAddress = POOL_CONFIG.poolAddress.toBase58()
  const backupOracleData: any = await (await fetch(`https://flash.trade/api/backup-oracle?poolAddress=${poolAddress}`)).json()
  const backUpOracleInstruction = new TransactionInstruction({
      keys: backupOracleData.keys,
      programId: new PublicKey(backupOracleData.programId),
      data: Buffer.from(backupOracleData.data),
  })

  <!-- to get any token config from symbol-->
  const USDC_TOKEN = POOL_CONFIG.tokens.find((t) => t.symbol == 'USDC')!
  const BTC_TOKEN = POOL_CONFIG.tokens.find((t) => t.symbol == 'BTC')!
  

  <!-- to get any token config from mint -->
  const tokenMint = new PublicKey('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v') 
  const USDC_TOKEN = POOL_CONFIG.tokens.find((t) => t.mintKey.equals(tokenMint))!

   <!-- load ALT -->
   await perpClient.loadAddressLookupTable(POOL_CONFIG) 

   <!-- Add Liquidity  (USDC -> sFLP.1 ) -->
    const payTokenSymbol = 'USDC'; // 'SOL' , 'BTC', 'ETH'  
    const { instructions : addLiqInstructions, additionalSigners : addLiqAdditionalSigners } = await perpClient.addLiquidityAndStake(
              payTokenSymbol,
              tokenAmountIn,
              minLpAmountOut, // new BN(0)
              POOL_CONFIG
          )
        const setCULimitIx = ComputeBudgetProgram.setComputeUnitLimit({ units: 600_000 })

   let addresslookupTables: AddressLookupTableAccount[] = (
            await flashClient.getOrLoadAddressLookupTable(POOL_CONFIG)
    ).addressLookupTables

    const txid =  perpClient.sendTransaction([backUpOracleInstruction, setCULimitIx, ...addLiqInstructions ], {
            addLiqAdditionalSigners,
            alts: addresslookupTables,
      })

    <!--addCompoundingLiquidity (USDC -> FLP.1 )  -->
     const payTokenSymbol = 'USDC'; // 'SOL' , 'BTC', 'ETH'  
    const { instructions : addCompLiqInstructions, additionalSigners : addCompLiqAdditionalSigners } = await perpClient.addCompoundingLiquidity(
              tokenAmountIn,
              payTokenSymbol,
              minLpAmountOut, // new BN(0)
              USDC_TOKEN.mintKey,
              POOL_CONFIG
          )
        const setCULimitIx = ComputeBudgetProgram.setComputeUnitLimit({ units: 600_000 })

    const txid =  perpClient.sendTransaction([backUpOracleInstruction, setCULimitIx, ...addCompLiqInstructions ], {
            addCompLiqAdditionalSigners,
            alts: perpClient.addressLookupTables,
      })



  <!-- remove Liquidity (FLP -> USDC)  -->
    const recieveTokenSymbol = 'USDC'; // 'SOL' , 'BTC', 'ETH'  
    const { instructions : removeCompLiqInstructions, additionalSigners : removeCompLiqAdditionalSigners } = await  await perpClient.removeCompoundingLiquidity(
            lpAmountIn,
            minTokenAmountOut, // new BN(0)
            recieveTokenSymbol,
             USDC_TOKEN.mintKey,
              POOL_CONFIG,
              true
       )
    const setCULimitIx = ComputeBudgetProgram.setComputeUnitLimit({ units: 600_000 })

    let addresslookupTables: AddressLookupTableAccount[] = (
            await flashClient.getOrLoadAddressLookupTable(POOL_CONFIG)
    ).addressLookupTables

    const txid =  perpClient.sendTransaction([backUpOracleInstruction, setCULimitIx, ...removeCompLiqInstructions ], {
            removeCompLiqAdditionalSigners,
            alts: addresslookupTables,
      })

      <!-- remove Liquidity (sFLP -> USDC) -->
    const recieveTokenSymbol = 'USDC'; // 'SOL' , 'BTC', 'ETH'  
    const { instructions : removeLiqInstructions, additionalSigners : removeLiqAdditionalSigners } = await  await perpClient.removeLiquidity(
            recieveTokenSymbol,
            lpAmountIn,
            minTokenAmountOut, // new BN(0)
            POOL_CONFIG
       )
    const setCULimitIx = ComputeBudgetProgram.setComputeUnitLimit({ units: 600_000 })
    
    let addresslookupTables: AddressLookupTableAccount[] = (
            await flashClient.getOrLoadAddressLookupTable(POOL_CONFIG)
    ).addressLookupTables

    const txid =  perpClient.sendTransaction([backUpOracleInstruction, setCULimitIx, ...removeLiqInstructions ], {
            removeLiqAdditionalSigners,
            alts: perpClient.addressLookupTables,
      })


    <!-- to STAKE sFLP.1 -->
    const { instructions: depositStakeInstructions, additionalSigners: depositStakeAdditionalSigners } =
              await perpClient.depositStake(.provider.wallet.publicKey, provider.wallet.publicKey, flpDepositAmount, POOL_CONFIG)

   let addresslookupTables: AddressLookupTableAccount[] = (
            await flashClient.getOrLoadAddressLookupTable(POOL_CONFIG)
    ).addressLookupTables
    const txid =  perpClient.sendTransaction([...depositStakeInstructions ], {
            depositStakeAdditionalSigners,
            alts: perpClient.addressLookupTables,
      })


  <!-- to UN-STAKE sFLP.1 -->

   const { instructions: unstakeInstantInstructions, additionalSigners : unstakeInstantAdditionalSigners } = await perpClient.unstakeInstant('USDC',flpUnstakeAmount,POOL_CONFIG)

  const { instructions: withdrawStakeInstructions } = await perpClient.withdrawStake(POOL_CONFIG, false)

    let addresslookupTables: AddressLookupTableAccount[] = (
            await flashClient.getOrLoadAddressLookupTable(POOL_CONFIG)
    ).addressLookupTables

  const txid =  perpClient.sendTransaction([...unstakeInstantInstructions, ...withdrawStakeInstructions ], {
          unstakeInstantAdditionalSigners,
          alts: perpClient.addressLookupTables,
    })


  <!-- collect fees -->

    const { instructions, additionalSigners } = await perpClient.collectStakeFees('USDC',POOL_CONFIG)

    let addresslookupTables: AddressLookupTableAccount[] = (
            await flashClient.getOrLoadAddressLookupTable(POOL_CONFIG)
    ).addressLookupTables

    const txid =  perpClient.sendTransaction([...instructions ], {
              additionalSigners,
              alts: perpClient.addressLookupTables,
        })
  

  <!-- call any view function like so -->
    const compoundingLPTokenPrice = await perpClient.getCompoundingLPTokenPrice(POOL_CONFIG.poolAddress, POOL_CONFIG)

For generating docs run yarn run doc

FAQs

Package last updated on 09 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts