Skip to content

Latest commit

 

History

History
54 lines (39 loc) · 1.56 KB

README.md

File metadata and controls

54 lines (39 loc) · 1.56 KB

solana program swap token

Overview

Install

  npm install

Run unitest

Run solana vadidator local:

  solana-test-validator --reset

Run Unit test

  anchor test --skip-local-validator

Result example:

Run test Swap SOL -> Token

  • The program deployed on devnet.

Program ID:

  const programId = swapEsYJ7iLDbYeg9154yR1dsUjumanS7LF9KEiJQae

Token mint address:

  const mintAddress = HVTEudbUMJaMRzCnQ2fo1cq6vL9gqHD9mYbvYhfkmQuh

Run swap:

  npx ts-node client/swap.ts

Notes:

  • Currently, I have set default SOL value for swap: 0.5 SOL -> receive 5 Token. use specified value at here
  • I made public authority, master authority, and user private key for convenient testing. All wallet have already been airdrop SOL for network fees.