Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

web3 demo for spl token swap on raydium pool

NotificationsYou must be signed in to change notification settings

husreo/raydium_spl_swap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This automated script facilitates the swapping of targeted SPL-tokens and SOL on Raydium. Users can customize the script's parameters according to their preferences.For testing purposes, the script can be set to simulate swaps by settingexecuteSwap: false insrc/swapConfig.ts.

Requirements

  • Node.js
  • TypeScript
  • Yarn

Usage

  1. Environment Setup:

    • Rename the existing.env.example file to.env or create a new.env file.
    • Populate the.env file with your keys:
      RPC_URL=YOUR_RPC_URLWALLET_PRIVATE_KEY=YOUR_PRIVATE_KEY
  2. Configuration:

    • Opensrc/swapConfig.ts to adjust the script parameters:
exportconstswapConfig={executeSwap:true,// Send tx when true, simulate tx when falseuseVersionedTransaction:true,// wether you want to user versioned transaction or legacy transactiontokenAAddress:"So11111111111111111111111111111111111111112",// Token to swap for the other, SOL in this casemaxLamports:2000000,// Micro lamports for priority feedirection:"in"as"in"|"out",// Swap direction: 'in' or 'out'liquidityFile:"https://api.raydium.io/v2/sdk/liquidity/mainnet.json",OwnerAddress:"",// Your wallet PublicKeyexitTarget:1,// Exit target in percentage (e.g. +1%)maxRetries:20,intervalMs:4000,// Interval between every swapretryCount:3,// Retry if the transaction fails.};
  1. Installing Packages:
    • To install neecessary packages run:
    yarn
  2. Execution:
    • To run the script, execute the following command in the root directory:
    yarn swap

Example:alt text

About

web3 demo for spl token swap on raydium pool

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp