Skip to content

defi0x1/token-swap-program

Repository files navigation

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.

About

Example token program

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published